1# Copyright 2016 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
5from autotest_lib.server import utils
6from autotest_lib.server.cros.bluetooth import advertisements_data
7
8
9AUTHOR = 'chromeos-chameleon'
10NAME = 'bluetooth_AdapterLEAdvertising.single'
11PURPOSE = 'Test bluetooth adapter advertising.'
12CRITERIA = 'Adapter should advertise with correct parameters.'
13ATTRIBUTES = 'suite:bluetooth'
14TIME = 'SHORT'
15TEST_CATEGORY = 'Functional'
16TEST_CLASS = 'bluetooth'
17TEST_TYPE = 'server'
18DEPENDENCIES = 'bluetooth'
19
20DOC = """
21This test case verifies that the Bluetooth adapter of the DUT can
22behave as a Bluetooth low-energy device and register a single
23advertisement with data and parameters correctly. This test case also
24verifies that the single advertisement could be registered and
25unregistered continuously.
26
27Specifically, the subtests included in this autotest verify the
28following operations and parameters.
29    - test_register_advertisement
30      * A single advertisement is registered successfully.
31      * The advertising min/max intervals are set correctly.
32        . The intervals are set to specified values.
33        . The intervals are set to default values after reset.
34      * The manufacturer id is set correctly.
35      * The service UUIDs are set correctly.
36      * The service data is set correctly.
37      * Advertising is enabled consequently.
38    - test_set_advertising_intervals
39      * The new advertising intervals are set correctly.
40    - test_reset_advertising
41      * The single advertisement instance is removed.
42      * Advertising is disabled consequently.
43"""
44
45
46MIN_ADV_INTERVAL_MS = 300
47MAX_ADV_INTERVAL_MS = 400
48
49
50args_dict = utils.args_to_dict(args)
51
52def run(machine):
53    host = hosts.create_host(machine)
54    job.run_test('bluetooth_AdapterLEAdvertising', host=host,
55                 advertisements=advertisements_data.ADVERTISEMENTS,
56                 multi_advertising=False,
57                 min_adv_interval_ms=MIN_ADV_INTERVAL_MS,
58                 max_adv_interval_ms=MAX_ADV_INTERVAL_MS)
59
60parallel_simple(run, machines)
61