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 5 from autotest_lib.server import utils 6 from autotest_lib.server.cros.bluetooth import advertisements_data 7 8 9 AUTHOR = 'chromeos-chameleon' 10 NAME = 'bluetooth_AdapterLEAdvertising.single' 11 PURPOSE = 'Test bluetooth adapter advertising.' 12 CRITERIA = 'Adapter should advertise with correct parameters.' 13 ATTRIBUTES = 'suite:bluetooth, suite:bluetooth_sanity' 14 TIME = 'SHORT' 15 TEST_CATEGORY = 'Functional' 16 TEST_CLASS = 'bluetooth' 17 TEST_TYPE = 'server' 18 DEPENDENCIES = 'bluetooth' 19 20 DOC = """ 21 This test case verifies that the Bluetooth adapter of the DUT can 22 behave as a Bluetooth low-energy device and register a single 23 advertisement with data and parameters correctly. This test case also 24 verifies that the single advertisement could be registered and 25 unregistered continuously. 26 27 This 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 35 Specifically, the subtests included in this autotest verify the 36 following 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 52 Mnemonics 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 67 args_dict = utils.args_to_dict(args) 68 69 def 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 76 parallel_simple(run, machines) 77