1#/usr/bin/env python3.4 2# 3# Copyright (C) 2016 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); you may not 6# use this file except in compliance with the License. You may obtain a copy of 7# the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14# License for the specific language governing permissions and limitations under 15# the License. 16 17""" 18This test is used to test basic functionality of bluetooth adapter by turning it ON/OFF. 19""" 20 21from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest 22from acts.test_utils.bt import bt_test_utils 23 24class BtCarToggleTest(BluetoothBaseTest): 25 def setup_class(self): 26 self.droid_ad = self.android_devices[0] 27 28 def setup_test(self): 29 self.log.debug(log_energy_info(self.android_devices, "Start")) 30 self.droid_ad.ed.clear_all_events() 31 32 def teardown_test(self): 33 self.log.debug(log_energy_info(self.android_devices, "End")) 34 35 def on_fail(self, test_name, begin_time): 36 bt_test_utils.take_btsnoop_logs(self.android_devices, self, test_name) 37 38 @BluetoothBaseTest.bt_test_wrap 39 def test_bluetooth_reset(self): 40 """Test resetting bluetooth. 41 42 Test the integrity of resetting bluetooth on Android. 43 44 Steps: 45 1. Toggle bluetooth off. 46 2. Toggle bluetooth on. 47 48 Returns: 49 Pass if True 50 Fail if False 51 """ 52 asserts.assert_true(bt_test_utils.reset_bluetooth([self.droid_ad]), "") 53