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 = 'The Chromium OS Authors'
6DOC = """
7This test puts the network interfaces through hundred(s) of
8connect/disconnect cycles and verifies that flimflam properly detects
9that the service is either in online or portal state.
10
11Use test_that with --args=service_name=cell to test the
12portal code on cellular devices.
13"""
14NAME = 'network_PortalStress'
15PURPOSE = 'Stress test the portal detection code.'
16CRITERIA = """
17    Fails if portal code detects portal state when
18    clients3.google.com is accessible or if portal code detects online
19    when clients3.google.com is not accessible.
20"""
21TIME = 'LONG'
22TEST_CATEGORY = 'Stress'
23TEST_CLASS = 'network'
24TEST_TYPE = 'client'
25
26import logging
27logging.info('args = %s' % args)
28
29if args:
30    args = args[0].split(':')
31
32if args:
33    dict_args = dict([x.split('=') for x in args])
34else:
35    dict_args = {}
36
37# Run online cycle for hundred(s) of iterations because this is fast
38job.run_test('network_Portal',
39             force_portal=False, tag='online', test_iterations=100, **dict_args)
40
41# Run the portal cycle for fewer iterations because each test must time
42# out and that makes it exceedingly slow (15 seconds/iteration)
43job.run_test('network_Portal',
44             force_portal=True, tag='portal', test_iterations=20, **dict_args)
45