Home | History | Annotate | Download | only in network_WiFi_ScanPerformance
      1 # Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
      6 from autotest_lib.server.cros.network import hostap_config
      7 from autotest_lib.server.cros.network import wifi_cell_test_base
      8 
      9 
     10 class network_WiFi_ScanPerformance(wifi_cell_test_base.WiFiCellTestBase):
     11     """Performance test for scanning operation in various setup"""
     12     version = 1
     13 
     14     def run_once(self):
     15         """Sets up a router, scan for APs """
     16 
     17         # Default router configuration
     18         router_conf = hostap_config.HostapConfig(channel=6);
     19         freq = hostap_config.HostapConfig.get_frequency_for_channel(6)
     20         self.context.configure(router_conf)
     21         ssids = [self.context.router.get_ssid()]
     22 
     23         # Single channel scan
     24         scan_time = self.context.client.timed_scan(frequencies=[freq],
     25                 ssids=ssids, scan_timeout_seconds=10)
     26         self.write_perf_keyval({'scan_time_single_channel_scan': scan_time})
     27 
     28         # Foreground full scan
     29         scan_time = self.context.client.timed_scan(frequencies=[], ssids=ssids,
     30                                                    scan_timeout_seconds=10)
     31         self.write_perf_keyval({'scan_time_foreground_full_scan': scan_time})
     32 
     33         # Background full scan
     34         client_conf = xmlrpc_datatypes.AssociationParameters(
     35                 ssid=self.context.router.get_ssid())
     36         self.context.assert_connect_wifi(client_conf)
     37         scan_time = self.context.client.timed_scan(frequencies=[], ssids=ssids,
     38                                                    scan_timeout_seconds=15)
     39         self.write_perf_keyval({'scan_time_background_full_scan': scan_time})
     40 
     41         # Deconfigure router
     42         self.context.router.deconfig()
     43