xref: /aosp_15_r20/platform_testing/tests/automotive/mobly_tests/media/media_test_device_not_paired.py (revision dd0948b35e70be4c0246aabd6c72554a5eb8b22a)
1#  Copyright (C) 2023 The Android Open Source Project
2#
3#  Licensed under the Apache License, Version 2.0 (the "License");
4#  you may not use this file except in compliance with the License.
5#  You may obtain a copy of the License at
6#
7#       http://www.apache.org/licenses/LICENSE-2.0
8#
9#  Unless required by applicable law or agreed to in writing, software
10#  distributed under the License is distributed on an "AS IS" BASIS,
11#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12#  See the License for the specific language governing permissions and
13#  limitations under the License.
14
15
16from bluetooth_test import bluetooth_base_test
17from mobly import asserts
18from utilities.main_utils import common_main
19
20
21class DeviceNotPairedTest(bluetooth_base_test.BluetoothBaseTest):
22
23    def setup_test(self):
24        """Enable and disable BT on Head unit"""
25        super().setup_test()
26        super().enable_recording()
27
28    def test_device_not_paired(self):
29        """Tests lunch Bluetooth Audio app and verify <Bluetooth Disconnected> displayed."""
30        self.discoverer.mbs.btDisable()
31        self.call_utils.open_bluetooth_media_app()
32        self.call_utils.wait_with_log(5)
33        if not self.call_utils.is_bluetooth_audio_disconnected_label_visible():
34            self.call_utils.wait_with_log(60)
35        asserts.assert_true(self.call_utils.is_bluetooth_audio_disconnected_label_visible(),
36                            '<Bluetooth Audio disconnected> label should be present')
37
38    def teardown_test(self):
39        self.call_utils.press_home()
40        super().teardown_test()
41
42if __name__ == '__main__':
43    common_main()
44
45