1"""Test of audio source transferring using Mobly and Mobile Harness. 2 3- Requires a testbed with one phones in it that can make calls. 4- Requites sl4a be installed on Android devices. See README.md for details. 5- Optional to use --define="dialer_test_phone_number={$PHONE_NUMBER_VALUE}" 6- Default dialer_test_phone_number=511 7 8 Steps include: 9 1) Pre-call state check on IVI and phone devices. (OK) 10 2) Dial any digits number using Dial Pad 11 3) Change audio source to phone 12 4) Change audio source to car speaker 13""" 14from utilities import constants 15from utilities.main_utils import common_main 16from bluetooth_test import bluetooth_base_test 17 18 19class ChangeAudioSourceTest(bluetooth_base_test.BluetoothBaseTest): 20 21 """Implement audio source transferring test.""" 22 def setup_test(self): 23 """Setup steps before any test is executed.""" 24 # Pair the devices 25 self.bt_utils.pair_primary_to_secondary() 26 super().enable_recording() 27 def test_switch_audio_sources_while_in_call(self): 28 """Test audio source transferring functionality.""" 29 30 dialer_test_phone_number = constants.DIALER_THREE_DIGIT_NUMBER 31 #Tests the calling three digits number functionality 32 33 self.call_utils.dial_a_number(dialer_test_phone_number) 34 self.call_utils.make_call() 35 self.call_utils.wait_with_log(5) 36 self.call_utils.change_audio_source_to_phone() 37 self.call_utils.change_audio_source_to_car_speakers() 38 39 def teardown_test(self): 40 # End call 41 self.call_utils.end_call_using_adb_command(self.target) 42 43 44if __name__ == '__main__': 45 common_main()