bluetooth: Update sr_while_discovering with filter
The sr_while_discovering test was not using the discovery filter but
ChromeOS is using this by default in the latest images. Update the test
to match what ChromeOS is doing.
BUG=b:175653326
TEST=Ran sr_while_discovering on Morphius and confirm it fails (since
MGMT_OP_START_SERVICE_DISCOVERY doesn't honor
hdev->discovery_paused). Run it again with the fix and verify the
test passes.
Change-Id: I43d69cfd737ee7d16d031d5569937af6cc2c9d51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2594790
Tested-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Commit-Queue: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
diff --git a/server/site_tests/bluetooth_AdapterSRHealth/bluetooth_AdapterSRHealth.py b/server/site_tests/bluetooth_AdapterSRHealth/bluetooth_AdapterSRHealth.py
index 9970513..0de2837 100644
--- a/server/site_tests/bluetooth_AdapterSRHealth/bluetooth_AdapterSRHealth.py
+++ b/server/site_tests/bluetooth_AdapterSRHealth/bluetooth_AdapterSRHealth.py
@@ -424,17 +424,20 @@
""" Suspend while discovering. """
device = self.devices['BLE_MOUSE'][0]
boot_id = self.host.get_boot_id()
+
+ self.test_device_set_discoverable(device, True)
+
+ # Test discovery without setting discovery filter
+ # ----------------------------------------------------------------------
suspend = self.suspend_async(suspend_time=EXPECT_NO_WAKE_SUSPEND_SEC)
start_time = self.bluetooth_facade.get_device_time()
# We don't pair to the peer device because we don't want it in the
# allowlist. However, we want an advertising peer in this test
# responding to the discovery requests.
- self.test_device_set_discoverable(device, True)
-
self.test_start_discovery()
- self.test_suspend_and_wait_for_sleep(
- suspend, sleep_timeout=EXPECT_NO_WAKE_SUSPEND_SEC)
+ self.test_suspend_and_wait_for_sleep(suspend,
+ sleep_timeout=SUSPEND_SEC)
# If discovery events wake us early, we will raise and suspend.exitcode
# will be non-zero
@@ -445,7 +448,25 @@
# Discovering should restore after suspend
self.test_is_discovering()
+ self.test_stop_discovery()
+ # Test discovery with discovery filter set
+ # ----------------------------------------------------------------------
+ suspend = self.suspend_async(suspend_time=EXPECT_NO_WAKE_SUSPEND_SEC)
+
+ self.test_set_discovery_filter({'Transport': 'auto'})
+ self.test_start_discovery()
+ self.test_suspend_and_wait_for_sleep(suspend,
+ sleep_timeout=SUSPEND_SEC)
+
+ # If discovery events wake us early, we will raise and suspend.exitcode
+ # will be non-zero
+ self.test_wait_for_resume(boot_id,
+ suspend,
+ resume_timeout=EXPECT_NO_WAKE_SUSPEND_SEC)
+
+ # Discovering should restore after suspend
+ self.test_is_discovering()
self.test_stop_discovery()
# TODO(b/150897528) - Scarlet Dru loses firmware around suspend