summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zimuzo <zezeozue@google.com> 2019-02-05 11:18:58 +0000
committer Zimuzo <zezeozue@google.com> 2019-02-05 11:24:27 +0000
commit753626b42f3a1fbdae9c417e78571f077316b00b (patch)
tree57b7e5f8fbc1e29742591d9c088c5034a1b1d323
parent80ced71afdb1202469d5a9df715f6ed990995f30 (diff)
Fix RollbackTest#testBadUpdateRollback
It appears that the device can be under high broadcast pressure and 5 seconds may not be a long enough wait to receive broadcast from test app in instrumented app. We now remove the 5 seconds wait and rely on test runner timeout to not wait forever. Test: atest RollbackTest Bug: 123886893 120598832 Change-Id: Ic686da15cfb64e5a84fb9f7c2795b94ef481d3bd
-rw-r--r--tests/RollbackTest/src/com/android/tests/rollback/RollbackTest.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/RollbackTest/src/com/android/tests/rollback/RollbackTest.java b/tests/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
index ace0e6d14c58..9a668fb58714 100644
--- a/tests/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
+++ b/tests/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
@@ -689,7 +689,7 @@ public class RollbackTest {
ActivityManager am = context.getSystemService(ActivityManager.class);
am.killBackgroundProcesses(TEST_APP_A);
// Allow another package launch
- crashQueue.offer(intent.getIntExtra("count", 0), 5, TimeUnit.SECONDS);
+ crashQueue.put(intent.getIntExtra("count", 0));
} catch (InterruptedException e) {
fail("Failed to communicate with test app");
}
@@ -698,14 +698,9 @@ public class RollbackTest {
context.registerReceiver(crashCountReceiver, crashCountFilter);
// Start apps PackageWatchdog#TRIGGER_FAILURE_COUNT times so TEST_APP_A crashes
- Integer crashCount = null;
do {
RollbackTestUtils.launchPackage(TEST_APP_A);
- crashCount = crashQueue.poll(5, TimeUnit.SECONDS);
- if (crashCount == null) {
- fail("Timed out waiting for crash signal from test app");
- }
- } while(crashCount < 5);
+ } while(crashQueue.take() < 5);
// TEST_APP_A is automatically rolled back by the RollbackPackageHealthObserver
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));