blob: 313a289101de3a38afd5ab1d990fd5b02bb6ecf8 [file] [log] [blame]
# Copyright (c) 2011 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.
# This is designed to test that the connection manager is able to scan
# and connect to a configured network after resume-from-suspend
# even if we were not connected at the time we went into suspend.
# To accomplish this, we join an AP (so we are sure that flimflam
# remembers it), then turn off the AP and wait for the service to
# disappear. We suspend the DUT, re-instate the AP, then resume,
# so that when the device awakes, the AP is in full view. We then
# wait for the DUT to re-connect.
{ "name":"ConnectResume",
"steps":[
# Start up an AP
[ "create", { "type":"hostap" } ],
[ "config", { "channel":"2412", "mode":"11g" } ],
# Connect to the AP. This just guarantees that this AP has
# been placed in the connection manager profile.
[ "connect", { "security":"none" } ],
[ "client_ping", { "count":"10" } ],
[ "deconfig" ],
# Wait for the AP to disappear from the service list. We cause this
# to happen via a side-effect of "connect" causing scans to occur,
# which will eventually age the AP out of the scan caches.
[ "!connect", { "security":"none" } ],
[ "!connect", { "security":"none" } ],
[ "!connect", { "security":"none" } ],
[ "!connect", { "security":"none" } ],
# Ask the DUT to sleep for 20 seconds while we reinstate the AP,
# then see how long it takes for the DUT to return the service to the
# "ready" state. As a result, the arguments to this command are a
# combination of suspend and wait_service arguments. In this case,
# except for "suspend_time", all arguments are to wait_change. Note
# that the wait_change occurs AFTER the suspend, 20 seconds later in
# this specific example.
[ "wait_service_suspend_bg",
{ "suspend_time": "20", # How long to sleep
"run_timeout":40, # Maximum time to wait
"debug":True, # Output all state changes
"states": [(None, 'ready')] # Wait for "ready" state
} ],
# Locally, let's wait 15 seconds to make sure the DUT is really asleep
# before we proceed.
[ "sleep", { "time":"15" } ],
# Bring the AP back up
[ "config", { "channel":"2412", "mode":"11g" } ],
# Wait for the DUT to wake up and return the results of wait_suspend
[ "wait_service_suspend_end", { } ],
[ "client_ping", { "count":"10" } ],
[ "destroy" ],
],
}