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, suite:bluetooth_sanity' 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 27This autotest include the following test cases: 28 self.test_case_SI200_RA1_CD_UA1() 29 self.test_case_SI200_RA1_CD_RS() 30 self.test_case_RA1_CD_SI200_CD_UA1() 31 self.test_case_RA1_CD_SI200_CD_RS() 32 self.test_case_RA1_CD_SI200_CD_FSI10_UA1_RA1_CD_UA1() 33 self.test_case_RA1_CD_SI200_CD_FSI20000_UA1_RA1_CD_UA1() 34 35Specifically, the subtests included in this autotest verify the 36following operations and parameters. 37 - test_register_advertisement 38 * A single advertisement is registered successfully. 39 * The advertising min/max intervals are set correctly. 40 . The intervals are set to specified values. 41 . The intervals are set to default values after reset. 42 * The manufacturer id is set correctly. 43 * The service UUIDs are set correctly. 44 * The service data is set correctly. 45 * Advertising is enabled consequently. 46 - test_set_advertising_intervals 47 * The new advertising intervals are set correctly. 48 - test_reset_advertising 49 * The single advertisement instance is removed. 50 * Advertising is disabled consequently. 51 52Mnemonics of the test cases: 53 CD: check advertising duration and intervals 54 RA: register advertisements 55 UA: unregister advertisements 56 SI: set advertising intervals 57 RS: reset advertising 58 FRA: fail to register extra advertisements when max ones have 59 been registered. 60 FSI: fail to set advertising intervals beyond legitimate range 61 of [20 ms, 10,240 ms]. 62 PC: power cycle the bluetooth adapter (controller). 63 SR: suspend and resume the DUT (chromebook) 64 65""" 66 67args_dict = utils.args_to_dict(args) 68 69def run(machine): 70 host = hosts.create_host(machine) 71 job.run_test('bluetooth_AdapterLEAdvertising', 72 host=host, 73 advertisements=advertisements_data.ADVERTISEMENTS, 74 test_type='single_advertising') 75 76parallel_simple(run, machines) 77