Home | History | Annotate | Download | only in 3_4
      1 #!/usr/bin/env python
      2 #
      3 # Copyright (C) 2016 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #      http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 #
     17 
     18 import logging
     19 import time
     20 
     21 from vts.runners.host import asserts
     22 from vts.runners.host import base_test
     23 from vts.runners.host import test_runner
     24 
     25 
     26 class SampleCameraV3Test(base_test.BaseTestClass):
     27     """A sample testcase for the non-HIDL, conventional Camera HAL."""
     28     # Camera HAL version value (v3.4).
     29     VERSION_3_4 = 0x1000304
     30     MAX_RETRIES = 3
     31 
     32     def setUpClass(self):
     33         self.dut = self.android_devices[0]
     34         self.dut.hal.InitConventionalHal(
     35             target_type="camera",
     36             target_version=3.4,
     37             target_basepaths=["/system/lib/hw"],
     38             bits=32,
     39             target_package="hal.conventional.camera")
     40 
     41     def setUp(self):
     42         self.call_count_camera_device_status_change = 0
     43         self.call_count_torch_mode_status_change = 0
     44 
     45     def testCameraNormal(self):
     46         """A simple testcase which just emulates a normal usage pattern."""
     47         version = self.dut.hal.camera.common.GetAttributeValue("version")
     48         logging.info("version: %s", hex(version))
     49         if version != self.VERSION_3_4:
     50             asserts.skip("HAL version != v3.4")
     51 
     52         self.dut.hal.camera.common.module.methods.open(
     53         )  # note args are skipped
     54 
     55         ops = self.dut.hal.camera.GetAttributeValue("ops")
     56         logging.info("ops: %s", ops)
     57         ops.flush(None)
     58 
     59 
     60 if __name__ == "__main__":
     61     test_runner.main()
     62