diff options
author | 2023-05-23 16:54:00 +0000 | |
---|---|---|
committer | 2023-05-23 18:01:20 +0000 | |
commit | 76c09270e8aa762d69545434342b138dec220de2 (patch) | |
tree | 4bf2b74e4b702f4e24c48ea6c70f27ccf2e5536b | |
parent | ff668337bdac25d34a500f8fce4841d3b733eff4 (diff) |
Dismiss system dialogs before running our tests.
Sometimes these dialogs show up in our tests, hopefully dismissing
them will prevent UI test issues.
Bug: 283771695
Test: atest SafetyCenterFunctionalTestCases
Change-Id: Ibda6ae4188de4b585cc26a97ebd93a89ae635846
Relnote: N/A
5 files changed, 15 insertions, 0 deletions
diff --git a/tests/cts/safetycenter/AndroidTest.xml b/tests/cts/safetycenter/AndroidTest.xml index 5ec0c380e..6d8c3069c 100644 --- a/tests/cts/safetycenter/AndroidTest.xml +++ b/tests/cts/safetycenter/AndroidTest.xml @@ -43,9 +43,12 @@ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. --> <option name="run-command" value="am wait-for-broadcast-idle" /> + <option name="run-command" value="am wait-for-broadcast-barrier" /> <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> + <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> diff --git a/tests/functional/safetycenter/multiusers/AndroidTest.xml b/tests/functional/safetycenter/multiusers/AndroidTest.xml index c1e19d2e4..20032357a 100644 --- a/tests/functional/safetycenter/multiusers/AndroidTest.xml +++ b/tests/functional/safetycenter/multiusers/AndroidTest.xml @@ -43,9 +43,12 @@ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. --> <option name="run-command" value="am wait-for-broadcast-idle" /> + <option name="run-command" value="am wait-for-broadcast-barrier" /> <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> + <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> diff --git a/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml index 5357ed4f7..a1826653f 100644 --- a/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml +++ b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml @@ -43,9 +43,12 @@ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. --> <option name="run-command" value="am wait-for-broadcast-idle" /> + <option name="run-command" value="am wait-for-broadcast-barrier" /> <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> + <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> diff --git a/tests/functional/safetycenter/singleuser/AndroidTest.xml b/tests/functional/safetycenter/singleuser/AndroidTest.xml index d9d5b1361..3aa173508 100644 --- a/tests/functional/safetycenter/singleuser/AndroidTest.xml +++ b/tests/functional/safetycenter/singleuser/AndroidTest.xml @@ -43,9 +43,12 @@ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. --> <option name="run-command" value="am wait-for-broadcast-idle" /> + <option name="run-command" value="am wait-for-broadcast-barrier" /> <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> + <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> diff --git a/tests/hostside/safetycenter/AndroidTest.xml b/tests/hostside/safetycenter/AndroidTest.xml index 09ddf9d84..a28b70c3c 100644 --- a/tests/hostside/safetycenter/AndroidTest.xml +++ b/tests/hostside/safetycenter/AndroidTest.xml @@ -28,9 +28,12 @@ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. --> <option name="run-command" value="am wait-for-broadcast-idle" /> + <option name="run-command" value="am wait-for-broadcast-barrier" /> <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> + <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> <target_preparer class="com.android.compatibility.common.tradefed.targetprep.StayAwakePreparer" /> |