blob: 61f84616438cd67e936ea7a06c708218c1de8b45 [file] [log] [blame]
Keun Soo Yim2314dd82017-07-10 15:55:32 -07001#!/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
18import logging
19
20from vts.runners.host import const
21from vts.runners.host import test_runner
22from vts.testcases.template.hal_hidl_gtest import hal_hidl_gtest
Keun Soo Yim2314dd82017-07-10 15:55:32 -070023
24
25class 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
Keun Soo Yim2314dd82017-07-10 15:55:32 -070030 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)
Keun Soo Yim2314dd82017-07-10 15:55:32 -070049 for gtest_case in gtest_cases:
Zhuoyao Zhang1d5b84e2018-02-09 15:52:57 -080050 if self._nan_on:
51 gtest_cases.args += "--nan_on"
52 return gtest_cases
Keun Soo Yim2314dd82017-07-10 15:55:32 -070053
54
55if __name__ == "__main__":
56 test_runner.main()