• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Verify capture burst of full size images is fast enough to not timeout.
15"""
16
17import logging
18import os
19
20from mobly import test_runner
21
22import its_base_test
23import camera_properties_utils
24import capture_request_utils
25import image_processing_utils
26import its_session_utils
27
28NAME = os.path.splitext(os.path.basename(__file__))[0]
29NUM_TEST_FRAMES = 15
30
31
32class BurstCaptureTest(its_base_test.ItsBaseTest):
33  """Test capture a burst of full size images is fast enough and doesn't timeout.
34
35  This test verifies that the entire capture pipeline can keep up the speed of
36  fullsize capture + CPU read for at least some time.
37  """
38
39  def test_burst_capture(self):
40    with its_session_utils.ItsSession(
41        device_id=self.dut.serial,
42        camera_id=self.camera_id,
43        hidden_physical_id=self.hidden_physical_id) as cam:
44      props = cam.get_camera_properties()
45      props = cam.override_with_hidden_physical_camera_props(props)
46      camera_properties_utils.skip_unless(
47          camera_properties_utils.backward_compatible(props))
48      req = capture_request_utils.auto_capture_request()
49      caps = cam.do_capture([req] * NUM_TEST_FRAMES)
50      cap = caps[0]
51      img = image_processing_utils.convert_capture_to_rgb_image(
52          cap, props=props)
53      name = os.path.join(self.log_path, NAME)
54      img_name = '%s.jpg' % (name)
55      logging.debug('Image Name: %s', img_name)
56      image_processing_utils.write_image(img, img_name)
57
58
59if __name__ == '__main__':
60  test_runner.main()
61