1# Copyright 2015 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
5from autotest_lib.server import utils
6
7AUTHOR = 'samueltan, ejcaruso'
8NAME = 'network_WiFi_DarkResumeActiveScans'
9TIME = 'MEDIUM'
10TEST_TYPE = 'Server'
11DEPENDENCIES = 'wificell, servo_state:WORKING, lucidsleep'
12ATTRIBUTES = 'suite:wifi_lucidsleep'
13
14DOC = """
15When wake on WiFi is supported and enabled, our system could wake up from
16suspend in dark resume for several reasons. Due to privacy concerns, we do not
17want active scans to be launched on certain types of dark resume wakes where the
18user does not expect information that can uniquely identify their system
19(e.g. MAC addresses) to be broadcasted.
20
21We permit active scans to be launched when the system wakes up due to a SSID
22match or disconnect, since we might try to connect or reconnect to known
23networks during these periods, and the connection/authentication process
24inevitably broadcasts MAC addresses.
25
26However, when the system wakes up due to a RTC timer (e.g. the periodic scan
27timer or DHCP lease renewal timer) or a packet pattern match, we expect the
28system to carry out its tasks and re-suspend without active scanning and
29broadcasting MAC addresses.
30
31This test attempts to verify that no active scans are started in dark resumes
32that are triggered by RTC timers or packet pattern matches. Verify this by
33triggering these wake events and analyzing packet captures to ensure that the
34DUT does not launch any probe requests during these dark resumes.
35"""
36
37args_dict = utils.args_to_dict(args)
38servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
39
40def run(machine):
41    host = hosts.create_host(machine, servo_args=servo_args)
42    job.run_test('network_WiFi_DarkResumeActiveScans',
43                 host=host,
44                 raw_cmdline_args=args)
45
46parallel_simple(run, machines)
47