Home | History | Annotate | Download | only in host
      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 test_runner
     23 from vts.testcases.template.hal_hidl_host_test import hal_hidl_host_test
     24 
     25 
     26 class VrHidlTest(hal_hidl_host_test.HalHidlHostTest):
     27     """A simple testcase for the VR HIDL HAL."""
     28 
     29     TEST_HAL_SERVICES = {"android.hardware.vr (at] 1.0::IVr"}
     30 
     31     def setUpClass(self):
     32         """Creates a mirror and turns on the framework-layer VR service."""
     33         super(VrHidlTest, self).setUpClass()
     34         self.dut.hal.InitHidlHal(
     35             target_type="vr",
     36             target_basepaths=self.dut.libPaths,
     37             target_version=1.0,
     38             target_package="android.hardware.vr",
     39             target_component_name="IVr",
     40             bits=int(self.abi_bitness))
     41 
     42     def testVrBasic(self):
     43         """A simple test case which just calls each registered function."""
     44         result = self.dut.hal.vr.init()
     45         logging.info("init result: %s", result)
     46 
     47         time.sleep(1)
     48 
     49         result = self.dut.hal.vr.setVrMode(True)
     50         logging.info("setVrMode(true) result: %s", result)
     51 
     52         time.sleep(1)
     53 
     54         result = self.dut.hal.vr.setVrMode(False)
     55         logging.info("setVrMode(false) result: %s", result)
     56 
     57 
     58 if __name__ == "__main__":
     59     test_runner.main()
     60