Bug 758792 - Robocop: remove waitForIdleSync calls in getActivityFromClick. r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Sat, 09 Jun 2012 12:24:57 -0400
changeset 96253 c3b1df7ffdab612eda76eec9d9ef80740c65b174
parent 96252 db442eb60f9a4385b114f333adffcbb9f9153060
child 96254 9c11efe876627c626265704712b5c51e0ff26519
push id10469
push userryanvm@gmail.com
push dateSat, 09 Jun 2012 16:24:57 +0000
treeherdermozilla-inbound@c3b1df7ffdab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs758792
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758792 - Robocop: remove waitForIdleSync calls in getActivityFromClick. r=jmaher
mobile/android/base/tests/BaseTest.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -113,24 +113,28 @@ abstract class BaseTest extends Activity
     protected final Activity getActivityFromClick(Element element) {
         Instrumentation inst = getInstrumentation();
         Instrumentation.ActivityMonitor monitor = inst.addMonitor((String)null, null, false);
         boolean clicked = element.click();
         if (!clicked) {
             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;
     }
 
     /**
      * Click on the awesome bar element and return the resulting activity.
      * @return The created activity, or null if the awesome bar cannot be clicked.
      */
     protected final Activity clickOnAwesomeBar() {