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# Licensed under the Apache License, Version 2.0 (the "License"); 16# you may not use this file except in compliance with the License. 17# You may obtain a copy of the License at 18# 19# http://www.apache.org/licenses/LICENSE-2.0 20# 21# Unless required by applicable law or agreed to in writing, software 22# distributed under the License is distributed on an "AS IS" BASIS, 23# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24# See the License for the specific language governing permissions and 25# limitations under the License. 26 27"""This file is just a proof-of-concept stub checking to make sure the MBS utilities are 28working as expected. """ 29 30 31import sys 32import logging 33import pprint 34 35from bluetooth_test import bluetooth_base_test 36 37 38from mobly import asserts 39from mobly import base_test 40from mobly import test_runner 41from mobly.controllers import android_device 42 43from mbs_utils import constants 44from mbs_utils import spectatio_utils 45from mbs_utils import bt_utils 46 47# Number of seconds for the target to stay discoverable on Bluetooth. 48DISCOVERABLE_TIME = 60 49 50class UtilityClassTest(bluetooth_base_test.BluetoothBaseTest): 51 52 def setup_test(self): 53 # Upload contacts to phone device 54 file_path = constants.PATH_TO_CONTACTS_VCF_FILE 55 56 # Make sure bluetooth is on. 57 self.target.mbs.btEnable() 58 self.discoverer.mbs.btEnable() 59 60 # Set Bluetooth name on target device. 61 self.target.mbs.btSetName('FIND THIS') 62 63 self.bt_utils.discover_secondary_from_primary() 64 65 def test_call_utility(self): 66 # Navigate to the constants page 67 self.call_utils.open_phone_app() 68 69 def teardown_test(self): 70 # Turn Bluetooth off on both devices after test finishes. 71 self.target.mbs.btDisable() 72 self.discoverer.mbs.btDisable() 73 74 75if __name__ == '__main__': 76 # Take test args 77 test_runner.main()