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"""Server side bluetooth tests on adapter standalone working states.""" 6 7from autotest_lib.client.common_lib import error 8from autotest_lib.server.cros.bluetooth.bluetooth_adpater_tests import ( 9 BluetoothAdapterTests) 10from autotest_lib.server.cros.multimedia import remote_facade_factory 11 12 13class bluetooth_AdapterStandalone(BluetoothAdapterTests): 14 """Server side bluetooth adapter standalone tests. 15 16 This test tries to thoroughly verify most of the important work 17 states of a standalone bluetooth adapter prior to connecting to 18 other bluetooth peripherals. 19 20 In particular, the following subtests are performed. Look at the 21 docstrings of the subtests for more details. 22 - test_start_bluetoothd 23 - test_stop_bluetoothd 24 - test_adapter_work_state 25 - test_power_on_adapter 26 - test_power_off_adapter 27 - test_reset_on_adapter 28 - test_reset_off_adapter 29 - test_UUIDs 30 - test_start_discovery 31 - test_stop_discovery 32 - test_discoverable 33 - test_nondiscoverable 34 - test_pairable 35 - test_nonpairable 36 37 Refer to BluetoothAdapterTests for all subtests performed in this test. 38 39 """ 40 41 def run_once(self, host): 42 """Running Bluetooth adapter standalone tests. 43 44 @param host: device under test host 45 """ 46 self.host = host 47 factory = remote_facade_factory.RemoteFacadeFactory(host) 48 self.bluetooth_facade = factory.create_bluetooth_hid_facade() 49 50 # The bluetoothd must be running in the beginning. 51 self.test_bluetoothd_running() 52 53 # It is possible that the adapter is not powered on yet. 54 # Power it on anyway and verify that it is actually powered on. 55 self.test_power_on_adapter() 56 57 # Verify that the adapter could be powered off and powered on, 58 # and that it is in the correct working state. 59 self.test_power_off_adapter() 60 self.test_power_on_adapter() 61 self.test_adapter_work_state() 62 63 # Verify that the bluetoothd could be simply stopped and then 64 # be started again, and that it is in the correct working state. 65 self.test_stop_bluetoothd() 66 self.test_start_bluetoothd() 67 self.test_adapter_work_state() 68 69 # Verify that the adapter could be reset off and on which includes 70 # removing all cached information. 71 self.test_reset_off_adapter() 72 self.test_reset_on_adapter() 73 self.test_adapter_work_state() 74 75 # Verify that the adapter supports basic profiles. 76 self.test_UUIDs() 77 78 # Verify that the adapter could start and stop discovery. 79 self.test_start_discovery() 80 self.test_stop_discovery() 81 self.test_start_discovery() 82 83 # Verify that the adapter could set discoverable and non-discoverable. 84 self.test_discoverable() 85 self.test_nondiscoverable() 86 self.test_discoverable() 87 88 # Verify that the adapter could set pairable and non-pairable. 89 self.test_pairable() 90 self.test_nonpairable() 91 self.test_pairable() 92 93 if self.fails: 94 raise error.TestFail(self.fails) 95