Bug 879505 - Use getCurrentActivity() in getActivityFromClick(). r=gbrown
authorBrian Nicholson <bnicholson@mozilla.com>
Mon, 10 Jun 2013 15:37:39 -0700
changeset 146063 c0218a6cb1ed384010e6e6cb731186216723c4ae
parent 146062 b0afcbcafb72585a956a53e04384536bba81f9c9
child 146064 1a7469edb07eea09276bf46a3cf3eb1339cde299
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs879505
milestone24.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 879505 - Use getCurrentActivity() in getActivityFromClick(). r=gbrown
mobile/android/base/tests/BaseTest.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -168,29 +168,25 @@ 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).
-        // Previously, waitForIdleSync was used here but it was found
-        // to hang very occasionally.
-        mSolo.sleep(2000);
-        Activity activity = inst.waitForMonitor(monitor);
+        inst.waitForMonitor(monitor);
         // Give the activity time to render itself and initialize views 
         // before continuing, so that views are created before access
         // 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;
+
+        return mSolo.getCurrentActivity();
     }
 
     /**
      * Click on the awesome bar element and return the resulting activity.
      * @return The created activity, or null if the awesome bar cannot be clicked.
      */
     private Activity mAwesomeActivity;
     protected final Activity clickOnAwesomeBar() {