1# Copyright 2017 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 = 'rjahagir'
10NAME = 'bluetooth_AdapterLEAdvertising.reboot.stress_50'
11PURPOSE = 'Test bluetooth adapter advertising.'
12CRITERIA = 'Adapter should advertise with correct parameters.'
13ATTRIBUTES = 'suite:bluetooth, suite:bluetooth_stress'
14TIME = 'SHORT'  # Takes approximately 4 hours on elm
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 advertisement
23with data and parameters while suspending and resuming correctly.
24
25This autotest include the following test cases:
26     self.test_case_SI200_RA3_CD_PC_CD_UA3()
27     self.test_case_RA3_CD_SI200_CD_PC_CD_UA3()
28     self.test_case_RA1_CD_SI200_CD_PC_CD_UA1()
29
30Specifically, the subtests included in this autotest verify the
31following operations and parameters.
32    - test_register_advertisement
33      * A single advertisement is registered successfully.
34      * The advertising min/max intervals are set correctly.
35        . The intervals are set to specified values.
36        . The intervals are set to default values after reset.
37      * The manufacturer id is set correctly.
38      * The service UUIDs are set correctly.
39      * The service data is set correctly.
40      * Advertising is enabled consequently.
41    - test_set_advertising_intervals
42      * The new advertising intervals are set correctly.
43    - test_reset_advertising
44      * The single advertisement instance is removed.
45      * Advertising is disabled consequently.
46
47Mnemonics of the test cases:
48    CD: check advertising duration and intervals
49    RA: register advertisements
50    UA: unregister advertisements
51    SI: set advertising intervals
52    RS: reset advertising
53    FRA: fail to register extra advertisements when max ones have
54         been registered.
55    FSI: fail to set advertising intervals beyond legitimate range
56         of [20 ms, 10,240 ms].
57    PC: power cycle the bluetooth adapter (controller).
58    SR: suspend and resume the DUT (chromebook)
59
60"""
61
62args_dict = utils.args_to_dict(args)
63
64def run(machine):
65    host = hosts.create_host(machine)
66    job.run_test('bluetooth_AdapterLEAdvertising', host=host,
67                 advertisements=advertisements_data.ADVERTISEMENTS,
68                 test_type='reboot', num_iterations=50)
69
70parallel_simple(run, machines)
71