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 20 from vts.runners.host import const 21 from vts.runners.host import test_runner 22 from vts.testcases.template.hal_hidl_gtest import hal_hidl_gtest 23 24 25 class VtsHalWifiV1_0Host(hal_hidl_gtest.HidlHalGTest): 26 """Host test class to run the WiFi V1.0 HAL's VTS tests.""" 27 28 WIFI_AWARE_FEATURE_NAME = "android.hardware.wifi.aware" 29 30 def CreateTestCases(self): 31 """Get all registered test components and create test case objects.""" 32 pm_list = self.shell.Execute("pm list features") 33 self._nan_on = self.WIFI_AWARE_FEATURE_NAME in pm_list[const.STDOUT][0] 34 logging.info("Wifi NaN Feature Supported: %s", self._nan_on) 35 super(VtsHalWifiV1_0Host, self).CreateTestCases() 36 37 # @Override 38 def CreateTestCase(self, path, tag=''): 39 """Create a list of VtsHalWifiV1_0TestCase objects. 40 41 Args: 42 path: string, absolute path of a gtest binary on device 43 tag: string, a tag that will be appended to the end of test name 44 45 Returns: 46 A list of VtsHalWifiV1_0TestCase objects 47 """ 48 gtest_cases = super(VtsHalWifiV1_0Host, self).CreateTestCase(path, tag) 49 for gtest_case in gtest_cases: 50 if self._nan_on: 51 gtest_case.args += " --nan_on" 52 return gtest_cases 53 54 55 if __name__ == "__main__": 56 test_runner.main() 57