1# Copyright (c) 2013 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 = 'wiley, pstew, quiche'
6NAME = 'network_WiFi_SimpleConnect.wifi_checkNonAsciiSSID'
7TIME = 'SHORT'
8TEST_TYPE = 'Server'
9ATTRIBUTES = ('suite:wifi_matfunc, suite:wifi_release, subsystem:wifi')
10DEPENDENCIES = 'wificell'
11
12DOC = """
13This test case verifies that the DUT accepts ascii and non-ascii
14type characters as the SSID
15"""
16
17
18from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
19from autotest_lib.server.cros.network import hostap_config
20
21
22def get_ssids():
23    SSID_SIZE = 32
24    ssids = []
25    for i in range(256 / SSID_SIZE):
26        base = i * SSID_SIZE
27        ssids.append(''.join(map(chr, range(base, base + SSID_SIZE))))
28    # Using valid Unicode characters only as SSID
29    ssids.append('\xe4\xb8\xad\xe5\x9b\xbd')
30    # Using a single extended ASCII character (a-grave) as SSID
31    ssids.append('\xe0')
32    # Using mix of ASCII and Unicode characters as SSID
33    ssids.append('Chrome\xe7\xac\x94\xe8\xae\xb0\xe6\x9c\xac')
34    return ssids
35
36
37def run(machine):
38    g_mode = hostap_config.HostapConfig.MODE_11G
39    configurations = []
40    for ssid in get_ssids():
41        ap_config = hostap_config.HostapConfig(channel=1, mode=g_mode)
42        client_config = xmlrpc_datatypes.AssociationParameters()
43        configurations.append((ap_config, client_config))
44    host = hosts.create_host(machine)
45    job.run_test('network_WiFi_SimpleConnect',
46                 tag=NAME.split('.')[1],
47                 host=host,
48                 raw_cmdline_args=args,
49                 additional_params=configurations)
50
51
52parallel_simple(run, machines)
53