From 504de523f28b282ed93afbfeca9c33b4414716fb Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Sat, 9 Jun 2012 12:24:57 -0400 Subject: [PATCH] Bug 758792 - Robocop: remove waitForIdleSync calls in getActivityFromClick. r=jmaher --- mobile/android/base/tests/BaseTest.java.in | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mobile/android/base/tests/BaseTest.java.in b/mobile/android/base/tests/BaseTest.java.in index e42ef9500048..52abd6b46f37 100644 --- a/mobile/android/base/tests/BaseTest.java.in +++ b/mobile/android/base/tests/BaseTest.java.in @@ -118,14 +118,18 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 { mAsserter.ok(clicked != false, "checking that awesome bar clicked", "awesome bar was clicked"); return null; } - // wait for click to take effect before waiting for activity - // (otherwise we sometimes get the previous activity) - getInstrumentation().waitForIdleSync(); + // Wait for click to take effect before waiting for activity + // (otherwise we sometimes get the previous activity). + // Previously, waitForIdleSync was used here but it was found + // to hang very occasionally. + mSolo.sleep(2000); Activity activity = inst.waitForMonitor(monitor); - // give the activity time to render itself and initialize views + // Give the activity time to render itself and initialize views // before continuing, so that views are created before access - // attempts are made - getInstrumentation().waitForIdleSync(); + // attempts are made. Again, waitForIdleSync was used here + // previously, but replaced with a sleep to avoid hangs. + // TODO: Investigate and document why these pauses are required. + mSolo.sleep(2000); return activity; }