• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.droid_ad.ed.clear_all_events()
30
31    def on_fail(self, test_name, begin_time):
32        bt_test_utils.take_btsnoop_logs(self.android_devices, self, test_name)
33
34    @BluetoothBaseTest.bt_test_wrap
35    def test_bluetooth_reset(self):
36        """Test resetting bluetooth.
37
38        Test the integrity of resetting bluetooth on Android.
39
40        Steps:
41        1. Toggle bluetooth off.
42        2. Toggle bluetooth on.
43
44        Returns:
45          Pass if True
46          Fail if False
47        """
48        asserts.assert_true(bt_test_utils.reset_bluetooth([self.droid_ad]), "")
49