Bug 719954 - Bracket the clicking on list items with the event expecter to avoid a race condition. r=gbrown
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 21 Jan 2012 12:48:26 -0500
changeset 86290 46716e93feb4a7e5d40a0369cf56db0fad1c0b49
parent 86289 328f9cbb65984bf81db49f9c47310b41d7007bfb
child 86291 8a915ca62e05a13dc41939f071d6d185a06c6890
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs719954
milestone12.0a1
Bug 719954 - Bracket the clicking on list items with the event expecter to avoid a race condition. r=gbrown
mobile/android/base/tests/BaseTest.java.in
mobile/android/base/tests/testBookmark.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -94,22 +94,16 @@ abstract class BaseTest extends Activity
 
     protected final void hitEnterAndWait() {
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
         mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
         // wait for screen to load
         contentEventExpecter.blockForEvent();
     }
 
-    protected final void waitForLoad() {
-        Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
-        // wait for screen to load
-        contentEventExpecter.blockForEvent();
-    }
-
     protected final void loadUrl(String url) {
         enterUrl(url);
         hitEnterAndWait();
     }
 
     protected final void verifyUrl(String url) {
         Activity awesomeBarActivity = clickOnAwesomeBar();
         Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -13,17 +13,21 @@ public class testBookmark extends BaseTe
 
         //Click the top item in the awesome list.
         mActions.sendSpecialKey(Actions.SpecialKey.DOWN);
         hitEnterAndWait();
 
         //Click the top item in the bookmark list.
         clickOnAwesomeBar();
         mActions.sendSpecialKey(Actions.SpecialKey.RIGHT);
+
+        Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
+
         ArrayList<TextView> l = null;
         while (l == null || l.size() < 1) {
             l = mSolo.clickInList(1);
         }
-        waitForLoad();
+
+        contentEventExpecter.blockForEvent();
 
         //Items in bookmarks aren't constant so URL can't be tested.
     }
 }