Bug 738554 - Fix a couple of race conditions where we could start listening for events after they occur. r=mfinkle
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 23 Mar 2012 11:43:10 -0400
changeset 93472 13cf485e1d1c5e834abc843618e267529cb44b78
parent 93471 45bf5d610be2db78b22734c23b421de3606d9bb7
child 93473 b141942f20675be3630293fbce5ab51af7c1d632
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs738554
milestone14.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 738554 - Fix a couple of race conditions where we could start listening for events after they occur. r=mfinkle
mobile/android/base/tests/testAboutPage.java.in
mobile/android/base/tests/testBookmark.java.in
--- a/mobile/android/base/tests/testAboutPage.java.in
+++ b/mobile/android/base/tests/testAboutPage.java.in
@@ -27,21 +27,25 @@ public class testAboutPage extends BaseT
         // Look for the 'More' menu if this device/OS uses it
         if (mSolo.waitForText("^More$")) {
             mSolo.clickOnText("^More$");
         }
 
         mSolo.waitForText("^Settings$");
         mSolo.clickOnText("^Settings$");
 
+        // Set up listeners to catch the page load we're about to do
+        Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
+        Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
+
         // Tap on the "About Xxxx" setting
         mSolo.waitForText("About (Fennec|Nightly|Aurora|Firefox)");
         mSolo.clickOnText("About (Fennec|Nightly|Aurora|Firefox)");
 
         // Wait for the new tab and page to load
-        mActions.expectGeckoEvent("Tab:Added").blockForEvent();
-        mActions.expectGeckoEvent("DOMContentLoaded").blockForEvent();
+        tabEventExpecter.blockForEvent();
+        contentEventExpecter.blockForEvent();
 
         // Grab the title to make sure the about: page was loaded
         awesomebar = mDriver.findElement(getActivity(), "awesome_bar");
         mAsserter.ok(awesomebar.getText().matches("About (Fennec|Nightly|Aurora|Firefox)"), "page title match", "about: page title is correct");
     }
 }
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -28,20 +28,20 @@ public class testBookmark extends BaseTe
 
         mAsserter.ok(bookmarksList != null, "checking that bookmarks list exists", "bookmarks list exists");
 
         // No folders should be visible if no desktop bookmarks exist
         mAsserter.is(bookmarksList.getChildCount(), 2,
             "bookmarks list has 2 children (the bookmark we added and the hidden header)");
 
         // Click on the bookmark we created (the first item is the header view)
+        // and wait for the bookmarked page to load
+        Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
         mSolo.clickInList(2);
-
-        // Wait for the bookmarked page to load
-        mActions.expectGeckoEvent("DOMContentLoaded").blockForEvent();
+        contentEventExpecter.blockForEvent();
 
         // Clean up the bookmark we created
         cleanUpBookmark();
     }
 
     private ListView openBookmarksList() {
         Activity awesomeBarActivity = clickOnAwesomeBar();