Dialer Test bluetooth HFP Error
Command: ./prebuilts/build-tools/path/linux-x86/python3 out/host/linux-x86/nativetest64/DialerHFPErrorTest/DialerHFPErrorTest -c /usr/local/google/home/saivyshnavic/udc-qpr-dev/platform_testing/tests/automotive/mobly_tests/dialer/dialer_hfp_error_config.yaml
Test: https://paste.googleplex.com/5506352662183936
BUG: b/287323571
Change-Id: I01b8476f00ddc088ea789c75f2282954cb939c7d
diff --git a/tests/automotive/mobly_tests/bluetooth_base_test.py b/tests/automotive/mobly_tests/bluetooth_base_test.py
index d066419..a343a34 100644
--- a/tests/automotive/mobly_tests/bluetooth_base_test.py
+++ b/tests/automotive/mobly_tests/bluetooth_base_test.py
@@ -66,10 +66,8 @@
if target_address in discoverer_paired_addresses:
logging.info(f"forget {target_address}")
self.discoverer.mbs.btUnpairDevice(target_address)
- # disable BT
- self.target.mbs.btDisable()
- self.discoverer.mbs.btDisable()
-
+ self.target.mbs.btDisable()
+ self.discoverer.mbs.btDisable()
if __name__ == '__main__':
# Pass test arguments after '--' to the test runner.
diff --git a/tests/automotive/mobly_tests/dialer/Android.bp b/tests/automotive/mobly_tests/dialer/Android.bp
index 88bade8..5fe0a09 100644
--- a/tests/automotive/mobly_tests/dialer/Android.bp
+++ b/tests/automotive/mobly_tests/dialer/Android.bp
@@ -121,4 +121,31 @@
embedded_launcher: true,
},
},
+}
+
+python_test_host {
+ name: "DialerHFPErrorTest",
+ main: "dialer_hfp_error_test.py",
+ srcs: ["dialer_hfp_error_test.py"],
+ libs: [
+ "mobly",
+ "mbs_utils",
+ "BluetoothTestLibrary"
+ ],
+ test_suites: [
+ "catbox",
+ ],
+ test_options: {
+ unit_test: false,
+ },
+ data: [
+ // Package the snippet with the mobly test
+ ":AutomotiveSnippet",
+ ":PhoneSnippet",
+ ],
+ version: {
+ py3: {
+ embedded_launcher: true,
+ },
+ },
}
\ No newline at end of file
diff --git a/tests/automotive/mobly_tests/dialer/dialer_hfp_error_test.py b/tests/automotive/mobly_tests/dialer/dialer_hfp_error_test.py
new file mode 100644
index 0000000..8c17a00
--- /dev/null
+++ b/tests/automotive/mobly_tests/dialer/dialer_hfp_error_test.py
@@ -0,0 +1,44 @@
+"""
+Pairing Test
+"""
+
+import sys
+import logging
+import pprint
+
+from mobly import asserts
+from mobly import base_test
+from mobly import test_runner
+from mobly.controllers import android_device
+from bluetooth_test import bluetooth_base_test
+
+from mbs_utils import constants
+from mbs_utils import spectatio_utils
+from mbs_utils import bt_utils
+
+
+class DialerHFPError(bluetooth_base_test.BluetoothBaseTest):
+ """Enable and Disable Bluetooth from Bluetooth Palette."""
+
+ def setup_test(self):
+ """Setup steps before any test is executed."""
+ # Pair caller phone with automotive device
+ self.bt_utils.pair_primary_to_secondary()
+
+
+ def test_dialer_hfp_error(self):
+ """Disable - Enable Phone-HFP Bluetooth profile"""
+ self.call_utils.open_phone_app()
+ self.call_utils.wait_with_log(5)
+ self.target.mbs.btDisable()
+ self.call_utils.wait_with_log(5)
+ asserts.assert_true(self.call_utils.is_bluetooth_hfp_error_displayed(),'hfp error is displayed')
+
+if __name__ == '__main__':
+ # Pass test arguments after '--' to the test runner.
+ # Needed for Mobly Test Runner
+ # TODO:(b/303452618) remove main after bug resolved
+ if '--' in sys.argv:
+ index = sys.argv.index('--')
+ sys.argv = sys.argv[:1] + sys.argv[index + 1:]
+ test_runner.main()
diff --git a/tests/automotive/mobly_tests/utilities/spectatio_utils.py b/tests/automotive/mobly_tests/utilities/spectatio_utils.py
index 094365a..04df918 100644
--- a/tests/automotive/mobly_tests/utilities/spectatio_utils.py
+++ b/tests/automotive/mobly_tests/utilities/spectatio_utils.py
@@ -137,7 +137,7 @@
def press_home(self):
""" Press the Home button to go back to the home page."""
logging.info("Pressing HOME ")
- self.device.mbs.pressHome();
+ self.device.mbs.pressHome()
def press_enter_on_device(self, device_target):
"""Press ENTER on device"""
@@ -218,4 +218,9 @@
if expected_timezone not in actual_timezone:
raise CallUtilsError(
"Time Zone did not set properly."
- )
\ No newline at end of file
+ )
+ def is_bluetooth_hfp_error_displayed(self):
+ logging.info('Verify Bluetooth HFP error is displayed,'
+ 'when bluetooth is disconnected')
+ return self.device.mbs.isBluetoothHfpErrorDisplayed()
+