Alexander Dorokhine | 7abf60e | 2016-02-10 10:56:09 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
| 2 | # |
| 3 | # Copyright 2016 - The Android Open Source Project |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 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 | import queue |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 18 | import time |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 19 | |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 20 | from acts import asserts |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 21 | from acts import base_test |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 22 | from acts import signals |
Girish Moturu | 00304f8 | 2017-04-13 09:28:37 +0530 | [diff] [blame] | 23 | from acts.test_decorators import test_tracker_info |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 24 | from acts.test_utils.wifi import wifi_test_utils as wutils |
Bindu Mahadev | d34835d | 2017-06-12 17:21:09 -0700 | [diff] [blame] | 25 | from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 26 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 27 | WifiChannelUS = wutils.WifiChannelUS |
| 28 | WifiEnums = wutils.WifiEnums |
| 29 | |
| 30 | SCAN_EVENT_TAG = "WifiScannerScan" |
| 31 | |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 32 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 33 | class WifiScanResultEvents(): |
| 34 | """This class stores the setting of a scan, parameters generated |
| 35 | from starting the scan, and events reported later from the scan |
| 36 | for validation. |
| 37 | |
| 38 | Attributes: |
| 39 | scan_setting: Setting used to perform the scan. |
| 40 | scan_channels: Channels used for scanning. |
| 41 | events: A list to store the scan result events. |
| 42 | """ |
| 43 | |
| 44 | def __init__(self, scan_setting, scan_channels): |
| 45 | self.scan_setting = scan_setting |
| 46 | self.scan_channels = scan_channels |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 47 | self.results_events = [] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 48 | |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 49 | def add_results_event(self, event): |
| 50 | self.results_events.append(event) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 51 | |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 52 | def check_interval(self, scan_result, scan_result_next): |
| 53 | """Verifies that the time gap between two consecutive results is within |
| 54 | expected range. |
| 55 | |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 56 | Right now it is hard coded to be 20 percent of the interval specified |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 57 | by scan settings. This threshold can be imported from the configuration |
| 58 | file in the future if necessary later. |
| 59 | |
| 60 | Note the scan result timestamps are in microseconds, but "periodInMs" |
| 61 | in scan settings is in milliseconds. |
| 62 | |
| 63 | Args: |
| 64 | scan_result: A dictionary representing a scan result for a BSSID. |
| 65 | scan_result_next: A dictionary representing a scan result for a |
| 66 | BSSID, whose scan happened after scan_result. |
| 67 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 68 | actual_interval = scan_result_next["timestamp"] - scan_result[ |
| 69 | "timestamp"] |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 70 | expected_interval = self.scan_setting['periodInMs'] * 1000 |
| 71 | delta = abs(actual_interval - expected_interval) |
Girish Moturu | 95de688 | 2017-04-03 13:16:40 +0530 | [diff] [blame] | 72 | margin = expected_interval * 0.25 # 25% of the expected_interval |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 73 | asserts.assert_true( |
| 74 | delta < margin, "The difference in time between scan %s and " |
| 75 | "%s is %dms, which is out of the expected range %sms" % ( |
| 76 | scan_result, scan_result_next, delta / 1000, |
| 77 | self.scan_setting['periodInMs'])) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 78 | |
| 79 | def verify_one_scan_result(self, scan_result): |
| 80 | """Verifies the scan result of a single BSSID. |
| 81 | |
| 82 | 1. Verifies the frequency of the network is within the range requested |
| 83 | in the scan. |
| 84 | |
| 85 | Args: |
| 86 | scan_result: A dictionary representing the scan result of a single |
| 87 | BSSID. |
| 88 | """ |
| 89 | freq = scan_result["frequency"] |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 90 | asserts.assert_true( |
| 91 | freq in self.scan_channels, |
| 92 | "Frequency %d of result entry %s is out of the expected range %s." |
| 93 | % (freq, scan_result, self.scan_channels)) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 94 | # TODO(angli): add RSSI check. |
| 95 | |
| 96 | def verify_one_scan_result_group(self, batch): |
| 97 | """Verifies a group of scan results obtained during one scan. |
| 98 | |
| 99 | 1. Verifies the number of BSSIDs in the batch is less than the |
| 100 | threshold set by scan settings. |
| 101 | 2. Verifies each scan result for individual BSSID. |
| 102 | |
| 103 | Args: |
| 104 | batch: A list of dictionaries, each dictionary represents a scan |
| 105 | result. |
| 106 | """ |
| 107 | scan_results = batch["ScanResults"] |
| 108 | actual_num_of_results = len(scan_results) |
| 109 | expected_num_of_results = self.scan_setting['numBssidsPerScan'] |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 110 | asserts.assert_true(actual_num_of_results <= expected_num_of_results, |
| 111 | "Expected no more than %d BSSIDs, got %d." % |
| 112 | (expected_num_of_results, actual_num_of_results)) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 113 | for scan_result in scan_results: |
| 114 | self.verify_one_scan_result(scan_result) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 115 | |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 116 | def have_enough_events(self): |
| 117 | """Check if there are enough events to properly validate the scan""" |
| 118 | return len(self.results_events) >= 2 |
| 119 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 120 | def check_scan_results(self): |
| 121 | """Validate the reported scan results against the scan settings. |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 122 | Assert if any error detected in the results. |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 123 | |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 124 | 1. For each scan setting there should be no less than 2 events received. |
| 125 | 2. For batch scan, the number of buffered results in each event should |
| 126 | be exactly what the scan setting specified. |
| 127 | 3. Each scan result should contain no more BBSIDs than what scan |
| 128 | setting specified. |
| 129 | 4. The frequency reported by each scan result should comply with its |
| 130 | scan setting. |
| 131 | 5. The time gap between two consecutive scan results should be |
| 132 | approximately equal to the scan interval specified by the scan |
| 133 | setting. |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 134 | A scan result looks like this: |
| 135 | { |
| 136 | 'data': |
| 137 | { |
| 138 | 'Type': 'onResults', |
| 139 | 'ResultElapsedRealtime': 4280931, |
| 140 | 'Index': 10, |
| 141 | 'Results': [ |
| 142 | { |
| 143 | 'Flags': 0, |
| 144 | 'Id': 4, |
| 145 | 'ScanResults':[ |
| 146 | { |
| 147 | 'is80211McRTTResponder': False, |
| 148 | 'channelWidth': 0, |
| 149 | 'numUsage': 0, |
| 150 | 'SSID': '"wh_ap1_2g"', |
| 151 | 'timestamp': 4280078660, |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 152 | 'BSSID': '30:b5:c2:33:f9:05', |
| 153 | 'frequency': 2412, |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 154 | 'distanceSdCm': 0, |
| 155 | 'distanceCm': 0, |
| 156 | 'centerFreq1': 0, |
| 157 | 'centerFreq0': 0, |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 158 | 'venueName': '', |
| 159 | 'seen': 0, |
| 160 | 'operatorFriendlyName': '', |
| 161 | 'level': -31, |
| 162 | 'passpointNetwork': False, |
| 163 | 'untrusted': False |
| 164 | } |
| 165 | ] |
| 166 | } |
| 167 | ] |
| 168 | }, |
| 169 | 'time': 1491744576383, |
| 170 | 'name': 'WifiScannerScan10onResults' |
| 171 | } |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 172 | """ |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 173 | num_of_events = len(self.results_events) |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 174 | asserts.assert_true( |
| 175 | num_of_events >= 2, |
| 176 | "Expected more than one scan result events, got %d." % |
| 177 | num_of_events) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 178 | for event_idx in range(num_of_events): |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 179 | batches = self.results_events[event_idx]["data"]["Results"] |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 180 | actual_num_of_batches = len(batches) |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 181 | if not actual_num_of_batches: |
| 182 | raise signals.TestFailure("Scan returned empty Results list %s " |
| 183 | "% batches") |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 184 | # For batch scan results. |
| 185 | report_type = self.scan_setting['reportEvents'] |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 186 | if not (report_type & WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN): |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 187 | # Verifies that the number of buffered results matches the |
| 188 | # number defined in scan settings. |
| 189 | expected_num_of_batches = self.scan_setting['maxScansToCache'] |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 190 | asserts.assert_true( |
| 191 | actual_num_of_batches <= expected_num_of_batches, |
| 192 | "Expected to get at most %d batches in event No.%d, got %d." |
| 193 | % (expected_num_of_batches, event_idx, |
| 194 | actual_num_of_batches)) |
Bindu Mahadev | 15af8e3 | 2017-04-10 17:57:57 -0700 | [diff] [blame] | 195 | # Check the results within each event of batch scan |
| 196 | for batch_idx in range(actual_num_of_batches): |
| 197 | if not len(batches[batch_idx]["ScanResults"]): |
| 198 | raise signals.TestFailure("Scan event %d returned empty" |
| 199 | " scan results in batch %d" % (event_idx, batch_idx)) |
| 200 | # Start checking interval from the second batch. |
| 201 | if batch_idx >=1: |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 202 | self.check_interval( |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 203 | batches[batch_idx - 1]["ScanResults"][0], |
| 204 | batches[batch_idx]["ScanResults"][0]) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 205 | for batch in batches: |
| 206 | self.verify_one_scan_result_group(batch) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 207 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 208 | # Check the time gap between the first result of an event and |
| 209 | # the last result of its previous event |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 210 | # Skip the very first event. |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 211 | if event_idx >= 1: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 212 | previous_batches = self.results_events[event_idx - 1]["data"][ |
| 213 | "Results"] |
| 214 | self.check_interval(previous_batches[-1]["ScanResults"][0], |
| 215 | batches[0]["ScanResults"][0]) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 216 | |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 217 | |
Bindu Mahadev | d34835d | 2017-06-12 17:21:09 -0700 | [diff] [blame] | 218 | class WifiScannerMultiScanTest(WifiBaseTest): |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 219 | """This class is the WiFi Scanner Multi-Scan Test suite. |
| 220 | It collects a number of test cases, sets up and executes |
| 221 | the tests, and validates the scan results. |
| 222 | |
| 223 | Attributes: |
| 224 | tests: A collection of tests to excute. |
| 225 | leeway: Scan interval drift time (in seconds). |
| 226 | stime_channels: Dwell time plus 2ms. |
| 227 | dut: Android device(s). |
| 228 | wifi_chs: WiFi channels according to the device model. |
| 229 | max_bugreports: Max number of bug reports allowed. |
| 230 | """ |
| 231 | |
Bindu Mahadev | d34835d | 2017-06-12 17:21:09 -0700 | [diff] [blame] | 232 | def __init__(self, controllers): |
| 233 | WifiBaseTest.__init__(self, controllers) |
Girish Moturu | 147063d | 2019-08-18 11:46:55 -0700 | [diff] [blame] | 234 | self.tests = ( |
| 235 | 'test_wifi_two_scans_at_same_interval', |
| 236 | 'test_wifi_two_scans_at_different_interval', |
| 237 | 'test_wifi_scans_24GHz_and_both', |
| 238 | 'test_wifi_scans_5GHz_and_both', |
| 239 | 'test_wifi_scans_batch_and_24GHz', |
| 240 | 'test_wifi_scans_batch_and_5GHz', |
| 241 | 'test_wifi_scans_24GHz_5GHz_full_result',) |
Bindu Mahadev | d34835d | 2017-06-12 17:21:09 -0700 | [diff] [blame] | 242 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 243 | def setup_class(self): |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 244 | # If running in a setup with attenuators, set attenuation on all |
| 245 | # channels to zero. |
| 246 | if getattr(self, "attenuators", []): |
| 247 | for a in self.attenuators: |
| 248 | a.set_atten(0) |
| 249 | self.leeway = 5 # seconds, for event wait time computation |
| 250 | self.stime_channel = 47 #dwell time plus 2ms |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 251 | self.dut = self.android_devices[0] |
| 252 | wutils.wifi_test_device_init(self.dut) |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 253 | asserts.assert_true(self.dut.droid.wifiIsScannerSupported(), |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 254 | "Device %s doesn't support WifiScanner, abort." % |
| 255 | self.dut.model) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 256 | """ Setup the required dependencies and fetch the user params from |
| 257 | config file. |
| 258 | """ |
Girish Moturu | 9df1d8b | 2019-08-16 22:28:05 -0700 | [diff] [blame] | 259 | req_params = ["max_bugreports"] |
Bindu Mahadev | d34835d | 2017-06-12 17:21:09 -0700 | [diff] [blame] | 260 | opt_param = ["reference_networks"] |
| 261 | self.unpack_userparams( |
| 262 | req_param_names=req_params, opt_param_names=opt_param) |
| 263 | |
| 264 | if "AccessPoint" in self.user_params: |
| 265 | self.legacy_configure_ap_and_start() |
| 266 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 267 | self.wifi_chs = WifiChannelUS(self.dut.model) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 268 | |
| 269 | def on_fail(self, test_name, begin_time): |
| 270 | if self.max_bugreports > 0: |
Ang Li | 20377aa | 2016-02-26 13:19:51 -0800 | [diff] [blame] | 271 | self.dut.take_bug_report(test_name, begin_time) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 272 | self.max_bugreports -= 1 |
Ang Li | 20377aa | 2016-02-26 13:19:51 -0800 | [diff] [blame] | 273 | self.dut.cat_adb_log(test_name, begin_time) |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 274 | |
Bindu Mahadev | ccfe0cc | 2017-08-28 21:08:30 -0700 | [diff] [blame] | 275 | def teardown_class(self): |
| 276 | if "AccessPoint" in self.user_params: |
| 277 | del self.user_params["reference_networks"] |
| 278 | del self.user_params["open_network"] |
| 279 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 280 | """ Helper Functions Begin """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 281 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 282 | def start_scan(self, scan_setting): |
| 283 | data = wutils.start_wifi_background_scan(self.dut, scan_setting) |
| 284 | idx = data["Index"] |
| 285 | # Calculate event wait time from scan setting plus leeway |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 286 | scan_time, scan_channels = wutils.get_scan_time_and_channels( |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 287 | self.wifi_chs, scan_setting, self.stime_channel) |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 288 | scan_period = scan_setting['periodInMs'] |
| 289 | report_type = scan_setting['reportEvents'] |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 290 | if report_type & WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN: |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 291 | scan_time += scan_period |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 292 | else: |
| 293 | max_scan = scan_setting['maxScansToCache'] |
| 294 | scan_time += max_scan * scan_period |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 295 | wait_time = scan_time / 1000 + self.leeway |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 296 | return idx, wait_time, scan_channels |
| 297 | |
| 298 | def validate_scan_results(self, scan_results_dict): |
| 299 | # Sanity check to make sure the dict is not empty |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 300 | asserts.assert_true(scan_results_dict, "Scan result dict is empty.") |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 301 | for scan_result_obj in scan_results_dict.values(): |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 302 | # Validate the results received for each scan setting |
Ang Li | a01a8db | 2015-12-16 16:30:52 -0800 | [diff] [blame] | 303 | scan_result_obj.check_scan_results() |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 304 | |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 305 | def wait_for_scan_events(self, wait_time_list, scan_results_dict): |
| 306 | """Poll for WifiScanner events and record them""" |
| 307 | |
| 308 | # Compute the event wait time |
| 309 | event_wait_time = min(wait_time_list) |
| 310 | |
| 311 | # Compute the maximum test time that guarantee that even the scan |
| 312 | # which requires the most wait time will receive at least two |
| 313 | # results. |
| 314 | max_wait_time = max(wait_time_list) |
| 315 | max_end_time = time.monotonic() + max_wait_time |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 316 | self.log.debug("Event wait time %s seconds", event_wait_time) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 317 | |
| 318 | try: |
| 319 | # Wait for scan results on all the caller specified bands |
| 320 | event_name = SCAN_EVENT_TAG |
| 321 | while True: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 322 | self.log.debug("Waiting for events '%s' for up to %s seconds", |
| 323 | event_name, event_wait_time) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 324 | events = self.dut.ed.pop_events(event_name, event_wait_time) |
| 325 | for event in events: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 326 | self.log.debug("Event received: %s", event) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 327 | # Event name is the key to the scan results dictionary |
| 328 | actual_event_name = event["name"] |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 329 | asserts.assert_true( |
| 330 | actual_event_name in scan_results_dict, |
| 331 | "Expected one of these event names: %s, got '%s'." % |
| 332 | (scan_results_dict.keys(), actual_event_name)) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 333 | |
| 334 | # TODO validate full result callbacks also |
| 335 | if event["name"].endswith("onResults"): |
| 336 | # Append the event |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 337 | scan_results_dict[actual_event_name].add_results_event( |
| 338 | event) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 339 | |
| 340 | # If we time out then stop waiting for events. |
| 341 | if time.monotonic() >= max_end_time: |
| 342 | break |
| 343 | # If enough scan results have been returned to validate the |
| 344 | # results then break early. |
| 345 | have_enough_events = True |
| 346 | for key in scan_results_dict: |
| 347 | if not scan_results_dict[key].have_enough_events(): |
| 348 | have_enough_events = False |
| 349 | if have_enough_events: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 350 | break |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 351 | except queue.Empty: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 352 | asserts.fail("Event did not trigger for {} in {} seconds".format( |
| 353 | event_name, event_wait_time)) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 354 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 355 | def scan_and_validate_results(self, scan_settings): |
| 356 | """Perform WifiScanner scans and check the scan results |
| 357 | |
| 358 | Procedures: |
| 359 | * Start scans for each caller specified setting |
| 360 | * Wait for at least two results for each scan |
| 361 | * Check the results received for each scan |
| 362 | """ |
| 363 | # Awlays get a clean start |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 364 | self.dut.ed.clear_all_events() |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 365 | |
| 366 | # Start scanning with the caller specified settings and |
| 367 | # compute parameters for receiving events |
| 368 | idx_list = [] |
| 369 | wait_time_list = [] |
| 370 | scan_results_dict = {} |
| 371 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 372 | try: |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 373 | for scan_setting in scan_settings: |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 374 | self.log.debug( |
| 375 | "Scan setting: band %s, interval %s, reportEvents " |
| 376 | "%s, numBssidsPerScan %s", scan_setting["band"], |
| 377 | scan_setting["periodInMs"], scan_setting["reportEvents"], |
| 378 | scan_setting["numBssidsPerScan"]) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 379 | idx, wait_time, scan_chan = self.start_scan(scan_setting) |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 380 | self.log.debug( |
| 381 | "Scan started for band %s: idx %s, wait_time %ss, scan_channels %s", |
| 382 | scan_setting["band"], idx, wait_time, scan_chan) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 383 | idx_list.append(idx) |
| 384 | wait_time_list.append(wait_time) |
| 385 | |
| 386 | report_type = scan_setting['reportEvents'] |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 387 | scan_results_events = WifiScanResultEvents(scan_setting, |
| 388 | scan_chan) |
| 389 | scan_results_dict["{}{}onResults".format( |
| 390 | SCAN_EVENT_TAG, idx)] = scan_results_events |
| 391 | if (scan_setting['reportEvents'] |
| 392 | & WifiEnums.REPORT_EVENT_FULL_SCAN_RESULT): |
| 393 | scan_results_dict["{}{}onFullResult".format( |
| 394 | SCAN_EVENT_TAG, idx)] = scan_results_events |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 395 | |
| 396 | self.wait_for_scan_events(wait_time_list, scan_results_dict) |
| 397 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 398 | # Validate the scan results |
| 399 | self.validate_scan_results(scan_results_dict) |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 400 | |
| 401 | finally: |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 402 | # Tear down and clean up |
| 403 | for idx in idx_list: |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 404 | self.dut.droid.wifiScannerStopBackgroundScan(idx) |
| 405 | self.dut.ed.clear_all_events() |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 406 | |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 407 | """ Helper Functions End """ |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 408 | """ Tests Begin """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 409 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 410 | @test_tracker_info(uuid="d490b146-5fc3-4fc3-9958-78ba0ad63211") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 411 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 412 | def test_wifi_two_scans_at_same_interval(self): |
| 413 | """Perform two WifiScanner background scans, one at 2.4GHz and the other |
| 414 | at 5GHz, the same interval and number of BSSIDs per scan. |
| 415 | |
| 416 | Initial Conditions: |
| 417 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 418 | |
| 419 | Expected Results: |
| 420 | * DUT reports success for starting both scans |
| 421 | * Scan results for each callback contains only the results on the |
| 422 | frequency scanned |
| 423 | * Wait for at least two scan results and confirm that separation |
| 424 | between them approximately equals to the expected interval |
| 425 | * Number of BSSIDs doesn't exceed |
| 426 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 427 | scan_settings = [{"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 428 | "periodInMs": 10000, # ms |
| 429 | "reportEvents": |
| 430 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 431 | "numBssidsPerScan": 24}, |
| 432 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 433 | "periodInMs": 10000, # ms |
| 434 | "reportEvents": |
| 435 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 436 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 437 | |
| 438 | self.scan_and_validate_results(scan_settings) |
| 439 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 440 | @test_tracker_info(uuid="0ec9a554-f942-41a9-8096-6b0b400f60b0") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 441 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 442 | def test_wifi_two_scans_at_different_interval(self): |
| 443 | """Perform two WifiScanner background scans, one at 2.4GHz and the other |
| 444 | at 5GHz, different interval and number of BSSIDs per scan. |
| 445 | |
| 446 | Initial Conditions: |
| 447 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 448 | |
| 449 | Expected Results: |
| 450 | * DUT reports success for starting both scans |
| 451 | * Scan results for each callback contains only the results on the |
| 452 | frequency scanned |
| 453 | * Wait for at least two scan results and confirm that separation |
| 454 | between them approximately equals to the expected interval |
| 455 | * Number of BSSIDs doesn't exceed |
| 456 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 457 | scan_settings = [{"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 458 | "periodInMs": 10000, # ms |
| 459 | "reportEvents": |
| 460 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 461 | "numBssidsPerScan": 20}, |
| 462 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 463 | "periodInMs": 30000, # ms |
| 464 | "reportEvents": |
| 465 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 466 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 467 | |
| 468 | self.scan_and_validate_results(scan_settings) |
| 469 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 470 | @test_tracker_info(uuid="0d616591-0d32-4be6-8fd4-e4a5e9ccdce0") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 471 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 472 | def test_wifi_scans_24GHz_and_both(self): |
| 473 | """Perform two WifiScanner background scans, one at 2.4GHz and |
| 474 | the other at both 2.4GHz and 5GHz |
| 475 | |
| 476 | Initial Conditions: |
| 477 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 478 | |
| 479 | Expected Results: |
| 480 | * DUT reports success for starting both scans |
| 481 | * Scan results for each callback contains only the results on the |
| 482 | frequency scanned |
| 483 | * Wait for at least two scan results and confirm that separation |
| 484 | between them approximately equals to the expected interval |
| 485 | * Number of BSSIDs doesn't exceed |
| 486 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 487 | scan_settings = [{"band": WifiEnums.WIFI_BAND_BOTH, |
| 488 | "periodInMs": 10000, # ms |
| 489 | "reportEvents": |
| 490 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 491 | "numBssidsPerScan": 24}, |
| 492 | {"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 493 | "periodInMs": 10000, # ms |
| 494 | "reportEvents": |
| 495 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 496 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 497 | |
| 498 | self.scan_and_validate_results(scan_settings) |
| 499 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 500 | @test_tracker_info(uuid="ddcf959e-512a-4e86-b3d3-18cebd0b22a0") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 501 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 502 | def test_wifi_scans_5GHz_and_both(self): |
| 503 | """Perform two WifiScanner scans, one at 5GHz and the other at both |
| 504 | 2.4GHz and 5GHz |
| 505 | |
| 506 | Initial Conditions: |
| 507 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 508 | |
| 509 | Expected Results: |
| 510 | * DUT reports success for starting both scans |
| 511 | * Scan results for each callback contains only the results on the |
| 512 | frequency scanned |
| 513 | * Wait for at least two scan results and confirm that separation |
| 514 | between them approximately equals to the expected interval |
| 515 | * Number of BSSIDs doesn't exceed |
| 516 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 517 | scan_settings = [{"band": WifiEnums.WIFI_BAND_BOTH, |
| 518 | "periodInMs": 10000, # ms |
| 519 | "reportEvents": |
| 520 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 521 | "numBssidsPerScan": 24}, |
| 522 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 523 | "periodInMs": 10000, # ms |
| 524 | "reportEvents": |
| 525 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 526 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 527 | |
| 528 | self.scan_and_validate_results(scan_settings) |
| 529 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 530 | @test_tracker_info(uuid="060469f1-fc6b-4255-ab6e-b1d5b54db53d") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 531 | @WifiBaseTest.wifi_test_wrap |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 532 | def test_wifi_scans_24GHz_5GHz_and_DFS(self): |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 533 | """Perform three WifiScanner scans, one at 5GHz, one at 2.4GHz and the |
Mitchell Wills | 4b2e4f0 | 2016-02-16 18:09:27 -0800 | [diff] [blame] | 534 | other at just 5GHz DFS channels |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 535 | |
| 536 | Initial Conditions: |
| 537 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 538 | |
| 539 | Expected Results: |
| 540 | * DUT reports success for starting both scans |
| 541 | * Scan results for each callback contains only the results on the |
| 542 | frequency scanned |
| 543 | * Wait for at least two scan results and confirm that separation |
| 544 | between them approximately equals to the expected interval |
| 545 | * Number of BSSIDs doesn't exceed |
| 546 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 547 | scan_settings = [ |
| 548 | {"band": WifiEnums.WIFI_BAND_5_GHZ_DFS_ONLY, |
| 549 | "periodInMs": 10000, # ms |
| 550 | "reportEvents": WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 551 | "numBssidsPerScan": 24}, |
| 552 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 553 | "periodInMs": 10000, # ms |
| 554 | "reportEvents": WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 555 | "numBssidsPerScan": 24}, |
| 556 | {"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 557 | "periodInMs": 30000, # ms |
| 558 | "reportEvents": WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 559 | "numBssidsPerScan": 24} |
| 560 | ] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 561 | |
| 562 | self.scan_and_validate_results(scan_settings) |
| 563 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 564 | @test_tracker_info(uuid="14104e98-27a0-43d5-9525-b36b65ac3957") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 565 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 566 | def test_wifi_scans_batch_and_24GHz(self): |
| 567 | """Perform two WifiScanner background scans, one in batch mode for both |
| 568 | bands and the other in periodic mode at 2.4GHz |
| 569 | |
| 570 | Initial Conditions: |
| 571 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 572 | |
| 573 | Expected Results: |
| 574 | * DUT reports success for starting both scans |
| 575 | * Scan results for each callback contains only the results on the |
| 576 | frequency scanned |
| 577 | * Wait for at least two scan results and confirm that separation |
| 578 | between them approximately equals to the expected interval |
| 579 | * Number of results in batch mode should match the setting |
| 580 | * Number of BSSIDs doesn't exceed |
| 581 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 582 | scan_settings = [{"band": WifiEnums.WIFI_BAND_BOTH, |
| 583 | "periodInMs": 10000, # ms |
| 584 | "reportEvents": |
| 585 | WifiEnums.REPORT_EVENT_AFTER_BUFFER_FULL, |
| 586 | "numBssidsPerScan": 24, |
| 587 | "maxScansToCache": 2}, |
| 588 | {"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 589 | "periodInMs": 10000, # ms |
| 590 | "reportEvents": |
| 591 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 592 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 593 | |
| 594 | self.scan_and_validate_results(scan_settings) |
| 595 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 596 | @test_tracker_info(uuid="cd6064b5-840b-4334-8cd4-8320a6cda52f") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 597 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 598 | def test_wifi_scans_batch_and_5GHz(self): |
| 599 | """Perform two WifiScanner background scans, one in batch mode for both |
| 600 | bands and the other in periodic mode at 5GHz |
| 601 | |
| 602 | Initial Conditions: |
| 603 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 604 | |
| 605 | Expected Results: |
| 606 | * DUT reports success for starting both scans |
| 607 | * Scan results for each callback contains only the results on the |
| 608 | frequency scanned |
| 609 | * Wait for at least two scan results and confirm that separation |
| 610 | between them approximately equals to the expected interval |
| 611 | * Number of results in batch mode should match the setting |
| 612 | * Number of BSSIDs doesn't exceed |
| 613 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 614 | scan_settings = [{"band": WifiEnums.WIFI_BAND_BOTH, |
| 615 | "periodInMs": 10000, # ms |
| 616 | "reportEvents": |
| 617 | WifiEnums.REPORT_EVENT_AFTER_BUFFER_FULL, |
| 618 | "numBssidsPerScan": 24, |
| 619 | "maxScansToCache": 2}, |
| 620 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 621 | "periodInMs": 10000, # ms |
| 622 | "reportEvents": |
| 623 | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 624 | "numBssidsPerScan": 24}] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 625 | |
| 626 | self.scan_and_validate_results(scan_settings) |
| 627 | |
Girish Moturu | 5a509a3 | 2017-04-03 10:50:18 +0530 | [diff] [blame] | 628 | @test_tracker_info(uuid="9f48cb0c-de87-4cd2-9e50-857579d44079") |
lutina | f02723f | 2020-03-24 19:22:47 +0800 | [diff] [blame] | 629 | @WifiBaseTest.wifi_test_wrap |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 630 | def test_wifi_scans_24GHz_5GHz_full_result(self): |
| 631 | """Perform two WifiScanner background scans, one at 2.4GHz and |
| 632 | the other at 5GHz. Report full scan results. |
| 633 | |
| 634 | Initial Conditions: |
| 635 | * Set multiple APs broadcasting 2.4GHz and 5GHz. |
| 636 | |
| 637 | Expected Results: |
| 638 | * DUT reports success for starting both scans |
| 639 | * Scan results for each callback contains only the results on the |
| 640 | frequency scanned |
| 641 | * Wait for at least two scan results and confirm that separation |
| 642 | between them approximately equals to the expected interval |
| 643 | * Number of BSSIDs doesn't exceed |
| 644 | """ |
Ang Li | 233e89b | 2016-06-07 14:49:30 -0700 | [diff] [blame] | 645 | scan_settings = [ |
| 646 | {"band": WifiEnums.WIFI_BAND_24_GHZ, |
| 647 | "periodInMs": 10000, # ms |
| 648 | "reportEvents": WifiEnums.REPORT_EVENT_FULL_SCAN_RESULT |
| 649 | | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 650 | "numBssidsPerScan": 24}, |
| 651 | {"band": WifiEnums.WIFI_BAND_5_GHZ, |
| 652 | "periodInMs": 10000, # ms |
| 653 | "reportEvents": WifiEnums.REPORT_EVENT_FULL_SCAN_RESULT |
| 654 | | WifiEnums.REPORT_EVENT_AFTER_EACH_SCAN, |
| 655 | "numBssidsPerScan": 24} |
| 656 | ] |
Randy Pan | 120dfa3 | 2015-12-11 13:29:48 -0800 | [diff] [blame] | 657 | |
| 658 | self.scan_and_validate_results(scan_settings) |
| 659 | |
| 660 | """ Tests End """ |