Home | History | Annotate | Download | only in host_basic
      1 #!/usr/bin/env python
      2 #
      3 # Copyright (C) 2017 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 keys
     24 from vts.runners.host import test_runner
     25 from vts.utils.python.controllers import android_device
     26 from vts.utils.python.precondition import precondition_utils
     27 
     28 class VtsHalMediaOmxV1_0HostBasic(base_test.BaseTestClass):
     29     """Host test class to run the Media_Omx HAL."""
     30 
     31     def setUpClass(self):
     32         self.dut = self.registerController(android_device)[0]
     33 
     34         self.dut.shell.InvokeTerminal("one")
     35         self.dut.shell.one.Execute("setenforce 0")  # SELinux permissive mode
     36         if not precondition_utils.CanRunHidlHalTest(
     37             self, self.dut, self.dut.shell.one):
     38             self._skip_all_testcases = True
     39             return
     40 
     41         self.dut.hal.InitHidlHal(
     42             target_type="media_omx",
     43             target_basepaths=self.dut.libPaths,
     44             target_version=1.0,
     45             target_package="android.hardware.media.omx",
     46             target_component_name="IOmxStore",
     47             bits=int(self.abi_bitness))
     48 
     49         if self.coverage.enabled:
     50             self.coverage.LoadArtifacts()
     51             self.coverage.InitializeDeviceCoverage(self._dut)
     52 
     53     def testIOmxStoreBase(self):
     54         """A simple test case which just calls each registered function."""
     55 
     56         self.vtypes = self.dut.hal.media_omx.GetHidlTypeInterface("types")
     57         status, attributes = self.dut.hal.media_omx.listServiceAttributes()
     58         asserts.assertEqual(self.vtypes.Status.OK, status)
     59 
     60         prefix = self.dut.hal.media_omx.getNodePrefix()
     61         logging.info("getNodePrefix: %s", prefix)
     62 
     63         roles = self.dut.hal.media_omx.listRoles()
     64         logging.info("roles: %s", roles)
     65 
     66         omx = self.dut.hal.media_omx.getOmx("default")
     67         logging.info("omx: %s", omx)
     68 
     69 if __name__ == "__main__":
     70     test_runner.main()
     71