blob: 3d1f1e3bf06227278d58cdbfaadbb7f732cc54a2 [file] [log] [blame]
Tom Turney35d297e2018-05-11 13:37:41 -07001#!/usr/bin/env python3.4
2#
3# Copyright 2018 - 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
17import math
18import acts.test_utils.power.PowerCoexBaseTest as PCoBT
19from acts.test_decorators import test_tracker_info
20
21
22class PowerCoexscanTest(PCoBT.PowerCoexBaseTest):
23 def setup_class(self):
24
25 super().setup_class()
26 iterations = math.floor((self.mon_duration + self.mon_offset + 10) /
27 self.wifi_scan_interval)
28
29 self.PERIODIC_WIFI_SCAN = (
30 'am instrument -w -r -e scan-interval \"%d\" -e scan-iterations'
31 ' \"%d\" -e class com.google.android.platform.powertests.'
32 'WifiTests#testGScanAllChannels com.google.android.platform.'
33 'powertests/android.test.InstrumentationTestRunner > /dev/null &' %
34 (self.wifi_scan_interval, iterations))
35
36 def coex_scan_test_func(self):
37 """Base test function for coex scan tests.
38
39 Steps:
40 1. Setup phone in correct state
41 2. Start desired scans
42 3. Measure power and validate result
43 """
44 attrs = [
45 'screen_status', 'wifi_status', 'wifi_band', 'wifi_scan',
46 'bt_status', 'ble_status', 'ble_scan_mode', 'cellular_status',
47 'cellular_band'
48 ]
49 indices = [2, 4, 6, 8, 10, 12, 15, 17, 19]
50 self.decode_test_configs(attrs, indices)
51 if self.test_configs.ble_scan_mode == 'lowpower':
52 ble_scan_mode = 'low_power'
53 elif self.test_configs.ble_scan_mode == 'lowlatency':
54 ble_scan_mode = 'low_latency'
55 else:
56 ble_scan_mode = self.test_configs.ble_scan_mode
57 self.phone_setup_for_BT(self.test_configs.bt_status,
58 self.test_configs.ble_status,
59 self.test_configs.screen_status)
60 self.coex_scan_setup(self.test_configs.wifi_scan, ble_scan_mode,
61 self.PERIODIC_WIFI_SCAN)
62 self.measure_power_and_validate()
63
64 @test_tracker_info(uuid='a998dd2b-f5f1-4361-b5da-83e42a69e80b')
65 def test_screen_ON_WiFi_Connected_band_2g_scan_OFF_bt_ON_ble_ON_default_scan_balanced_cellular_OFF_band_None(
66 self):
67 self.coex_scan_test_func()
68
69 @test_tracker_info(uuid='87146825-787a-4ea7-9622-30e9286c8a76')
70 def test_screen_OFF_WiFi_Connected_band_2g_scan_OFF_bt_ON_ble_ON_filtered_scan_lowpower_cellular_OFF_band_None(
71 self):
72 self.coex_scan_test_func()
73
74 @test_tracker_info(uuid='2e645deb-b744-4272-8578-5d4cb159d5aa')
75 def test_screen_OFF_WiFi_Connected_band_5g_scan_OFF_bt_ON_ble_ON_filtered_scan_lowpower_cellular_OFF_band_None(
76 self):
77 self.coex_scan_test_func()
78
79 @test_tracker_info(uuid='d458bc41-f1c8-4ed6-a7b5-0bec34780dda')
80 def test_screen_OFF_WiFi_Disconnected_band_2g_scan_ON_bt_ON_ble_ON_page_scan_None_cellular_OFF_band_None(
81 self):
82 self.coex_scan_test_func()
83
84 @test_tracker_info(uuid='6d9c0e8e-6a0f-458b-84d2-7d60fc254170')
85 def test_screen_OFF_WiFi_Disconnected_band_2g_scan_ON_bt_ON_ble_ON_filtered_scan_lowpower_cellular_OFF_band_None(
86 self):
87 self.coex_scan_test_func()
88
89 @test_tracker_info(uuid='ba52317f-426a-4688-a0a5-1394bcc7b092')
90 def test_screen_OFF_WiFi_Disconnected_band_2g_scan_ON_bt_ON_ble_ON_filtered_scan_lowlatency_cellular_OFF_band_None(
91 self):
92 self.coex_scan_test_func()
93
94 @test_tracker_info(uuid='b4c63eac-bc77-4e76-afff-ade98dde4411')
95 def test_screen_OFF_WiFi_Connected_band_2g_scan_PNO_bt_ON_ble_ON_filtered_scan_lowlatency_cellular_OFF_band_None(
96 self):
97 self.coex_scan_test_func()
98
99 @test_tracker_info(uuid='798796dc-960c-42b2-a835-2b2aefa028d5')
100 def test_screen_OFF_WiFi_Disconnected_band_5g_scan_ON_bt_OFF_ble_OFF_no_scan_None_cellular_ON_band_Verizon(
101 self):
102 self.coex_scan_test_func()
103
104 @test_tracker_info(uuid='6ae44d84-0e68-4524-99b2-d3bfbd2253b8')
105 def test_screen_OFF_WiFi_Disconnected_band_5g_scan_ON_bt_OFF_ble_ON_background_scan_lowpower_cellular_ON_band_Verizon(
106 self):
107 self.coex_scan_test_func()
108
109 @test_tracker_info(uuid='2cb915a3-6319-4ac4-9e4d-9325b3b731c8')
110 def test_screen_OFF_WiFi_Disconnected_band_2g_scan_ON_bt_OFF_ble_ON_background_scan_lowlatency_cellular_ON_band_Verizon(
111 self):
112 self.coex_scan_test_func()