1# Copyright (c) 2011 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
5AUTHOR = "ChromeOS Team"
6NAME = "cellular_GobiDisableWhileConnecting"
7PURPOSE = "Check that the 3G modem can handle a disconnect while connecting."
8CRITERIA = """
9This test will fail if a disconnect request while the modem is
10connecting is not promptly executed.  (Includes Gobi-specific
11tests: delaying asynchronous connect and QMI failure.)
12"""
13TIME = "SHORT"
14TEST_CATEGORY = "Functional"
15TEST_CLASS = "network"
16TEST_TYPE = "client"
17
18DOC = """
19Check that the 3G modem can handle a disconnect while connecting.
20"""
21
22from autotest_lib.client.cros.cellular import test_environment
23
24ITERATIONS_PER_TEST=1
25
26test_env = test_environment.CellularOTATestEnvironment()
27job.run_test('cellular_DisableWhileConnecting',
28             test_env=test_env,
29             timeout_s=20,
30             delay_before_disable_ms=0,
31             disable_delay_per_iteration_ms=0,
32             iterations=ITERATIONS_PER_TEST,
33             tag='instant_disable')
34
35# Since dbus-python emits our calls asynchronously, it is sometimes
36# (often?) the case that the disable arrives before the connect.
37# There's no good way to track what actually gets sent first, so we
38# sleep.
39test_env = test_environment.CellularOTATestEnvironment()
40job.run_test('cellular_DisableWhileConnecting',
41             test_env=test_env,
42             timeout_s=20,
43             delay_before_disable_ms=0,
44             disable_delay_per_iteration_ms=int(1000.0 / ITERATIONS_PER_TEST),
45             iterations=ITERATIONS_PER_TEST,
46             tag='disable_delay_ramp')
47
48# Gobi-specific tests:
49
50# Similarly, we can't be sure what the relative timings of the
51# completion of the session starter thread and arrival of the disable
52# request are.  Try pushing the start thread completion way out.
53test_env = test_environment.CellularOTATestEnvironment()
54job.run_test('cellular_DisableWhileConnecting',
55             test_env=test_env,
56             timeout_s=20,
57             delay_before_disable_ms=200,
58             async_connect_sleep_ms=3000,
59             iterations=ITERATIONS_PER_TEST,
60             tag='short_delay_disable')
61
62test_env = test_environment.CellularOTATestEnvironment()
63job.run_test('cellular_DisableWhileConnecting',
64             test_env=test_env,
65             timeout_s=20,
66             delay_before_disable_ms=0,
67             disable_delay_per_iteration_ms=0,
68             connect_fails_with_error_sending_qmi_request=1,
69             iterations=1,
70             tag='qmi_failure')
71