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_multiple_advertising_test' 9PURPOSE = 'Test bluetooth adapter advertising.' 10CRITERIA = 'Adapter should advertise with correct parameters.' 11ATTRIBUTES = 'suite:bluetooth_flaky' 12TIME = 'SHORT' # It takes about 15 minutes on a Samus. 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 multiple 21advertisements with data and parameters correctly. This test case also 22verifies that advertisements could be registered and unregistered 23continuously. 24 25Specifically, this autotest include the following test cases: 26 self.test_case_SI200_RA3_CD_UA3() 27 self.test_case_SI200_RA3_CD_RA1_CD_UA1_CD_UA3() 28 self.test_case_SI200_RA3_CD_RS() 29 self.test_case_SI200_RA3_CD_UA1_CD_RS() 30 self.test_case_SI200_RA3_CD_UA1_CD_RA2_CD_UA4() 31 self.test_case_SI200_RA5_CD_FRA1_CD_UA5() 32 self.test_case_RA3_CD_SI200_CD_UA3() 33 self.test_case_RA3_CD_SI200_CD_RS() 34 self.test_case_RA3_CD_SI200_CD_UA1_CD_RS() 35 self.test_case_RA3_CD_SI200_CD_SI2000_CD_UA3() 36 self.test_case_RA5_CD_SI200_CD_FRA1_CD_UA5() 37 self.test_case_RA3_CD_SI200_CD_FSI10_CD_FSI20000_CD_UA3() 38 39 40Mnemonics of the test cases: 41 CD: check advertising duration and intervals 42 RA: register advertisements 43 UA: unregister advertisements 44 SI: set advertising intervals 45 RS: reset advertising 46 FRA: fail to register extra advertisements when max ones have 47 been registered. 48 FSI: fail to set advertising intervals beyond legitimate range 49 of [20 ms, 10,240 ms]. 50 PC: power cycle the bluetooth adapter (controller). 51 SR: suspend and resume the DUT (chromebook) 52 53 54Every test case consists of a sequence of tests: 55 test_register_advertisement 56 * All advertisements are registered successfully. 57 * The advertising min/max intervals are set correctly. 58 . The intervals are set to specified values. 59 . The intervals are set to default values after reset. 60 * The manufacturer id is set correctly. 61 * The service UUIDs are set correctly. 62 * The service data is set correctly. 63 * Advertising is enabled consequently. 64 test_set_advertising_intervals 65 * The new advertising intervals are set correctly. 66 test_reset_advertising 67 * All advertisement instances are removed. 68 * Advertising is disabled consequently. 69 test_check_duration_and_intervals 70 * The duration is correct. 71 * The new advertising intervals are set correctly. 72 test_fail_to_register_advertisement 73 * Max advertisements reached error. 74 * Extra advertisement is not added. 75 * The advertising min/max intervals remain the same. 76 * Advertising remains enabled. 77 test_unregister_advertisement 78 * The advertisement is removed. 79 * Advertising is disabled when the last one is removed. 80 test_fail_to_set_advertising_intervals 81 * It incurs invalid interval error. 82 * The advertising min/max intervals remain the same. 83""" 84 85 86args_dict = utils.args_to_dict(args) 87 88def run(machine): 89 host = hosts.create_host(machine) 90 job.run_test('bluetooth_AdapterSASanity', host=host, 91 num_iterations=1, test_name=NAME.split('.')[1]) 92 93parallel_simple(run, machines) 94