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""" 17This test is used to test basic functionality of bluetooth adapter by turning it ON/OFF. 18""" 19 20from acts.test_decorators import test_tracker_info 21from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest 22from acts.test_utils.bt import bt_test_utils 23 24 25class BtCarToggleTest(BluetoothBaseTest): 26 def setup_class(self): 27 self.droid_ad = self.android_devices[0] 28 29 def setup_test(self): 30 self.droid_ad.ed.clear_all_events() 31 32 def on_fail(self, test_name, begin_time): 33 bt_test_utils.take_btsnoop_logs(self.android_devices, self, test_name) 34 35 @test_tracker_info(uuid='290eb41f-6e66-4dc1-8f3e-55783901d116') 36 @BluetoothBaseTest.bt_test_wrap 37 def test_bluetooth_reset(self): 38 """Test resetting bluetooth. 39 40 Test the integrity of resetting bluetooth on Android. 41 42 Steps: 43 1. Toggle bluetooth off. 44 2. Toggle bluetooth on. 45 46 Returns: 47 Pass if True 48 Fail if False 49 """ 50 return bt_test_utils.reset_bluetooth([self.droid_ad]) 51