blob: fdf41857c711899175efb7791a0ed0845c7f9956 [file] [log] [blame]
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import time
from autotest_lib.client.common_lib import error
from import hostap_config
from import lucid_sleep_test_base
from import wifi_client
class network_WiFi_FastReconnectInDarkResume(
Test that we can reconnect quickly (within the span of one dark resume)
if we are disconnected during suspend but the AP is still up.
version = 1
def run_once(self):
"""Body of the test"""
client = self.context.client
client_mac = client.wifi_mac
router = self.context.router
# Enable the dark connect feature in shill.
with client.wake_on_wifi_features(wifi_client.WAKE_ON_WIFI_DARKCONNECT):'Set up WoWLAN')
prev_dark_resume_count = self.dr_utils.count_dark_resumes()
with self.dr_utils.suspend():
# Wait for suspend actions to finish.
time.sleep(wifi_client.SUSPEND_WAIT_TIME_SECONDS)'Deauthenticating the DUT')
# A deauth packet should instantaneously disconnect the DUT
# from the AP without bringing the AP down.
# Wait for the DUT to receive the disconnect, wake in
# dark resume, reconnect, then suspend again.
time.sleep(wifi_client.DISCONNECT_WAIT_TIME_SECONDS +
dark_resume_count = (self.dr_utils.count_dark_resumes() -
if dark_resume_count != 1:
# If there was more than 1 dark resume, the DUT might not have
# reconnected on the dark resume triggered by the disconnect.
raise error.TestFail('Expected exactly one dark resume')