1# Copyright 2020 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 6 7AUTHOR = 'chromeos-bluetooth' 8NAME = 'bluetooth_AdapterSASanity.sa_single_advertising_test' 9PURPOSE = 'Test bluetooth adapter advertising.' 10CRITERIA = 'Adapter should advertise with correct parameters.' 11ATTRIBUTES = 'suite:bluetooth_flaky' 12TIME = 'SHORT' 13TEST_CATEGORY = 'Functional' 14TEST_CLASS = 'bluetooth' 15TEST_TYPE = 'server' 16DEPENDENCIES = 'bluetooth' 17 18DOC = """ 19This test case verifies that the Bluetooth adapter of the DUT can 20behave as a Bluetooth low-energy device and register a single 21advertisement with data and parameters correctly. This test case also 22verifies that the single advertisement could be registered and 23unregistered continuously. 24 25This autotest include the following test cases: 26 self.test_case_SI200_RA1_CD_UA1() 27 self.test_case_SI200_RA1_CD_RS() 28 self.test_case_RA1_CD_SI200_CD_UA1() 29 self.test_case_RA1_CD_SI200_CD_RS() 30 self.test_case_RA1_CD_SI200_CD_FSI10_UA1_RA1_CD_UA1() 31 self.test_case_RA1_CD_SI200_CD_FSI20000_UA1_RA1_CD_UA1() 32 33Specifically, the subtests included in this autotest verify the 34following operations and parameters. 35 - test_register_advertisement 36 * A single advertisement is registered successfully. 37 * The advertising min/max intervals are set correctly. 38 . The intervals are set to specified values. 39 . The intervals are set to default values after reset. 40 * The manufacturer id is set correctly. 41 * The service UUIDs are set correctly. 42 * The service data is set correctly. 43 * Advertising is enabled consequently. 44 - test_set_advertising_intervals 45 * The new advertising intervals are set correctly. 46 - test_reset_advertising 47 * The single advertisement instance is removed. 48 * Advertising is disabled consequently. 49 50Mnemonics of the test cases: 51 CD: check advertising duration and intervals 52 RA: register advertisements 53 UA: unregister advertisements 54 SI: set advertising intervals 55 RS: reset advertising 56 FRA: fail to register extra advertisements when max ones have 57 been registered. 58 FSI: fail to set advertising intervals beyond legitimate range 59 of [20 ms, 10,240 ms]. 60 PC: power cycle the bluetooth adapter (controller). 61 SR: suspend and resume the DUT (chromebook) 62 63""" 64 65args_dict = utils.args_to_dict(args) 66 67def run(machine): 68 host = hosts.create_host(machine) 69 job.run_test('bluetooth_AdapterSASanity', host=host, 70 num_iterations=1, test_name=NAME.split('.')[1]) 71 72parallel_simple(run, machines) 73