Bug 927394 - adding waiting periods to fix intermittent fails in testReaderMode; r=gbrown
authorpaul.feher@softvision.ro
Thu, 17 Oct 2013 12:39:48 +0300
changeset 166632 dd124524d90ff135d7fff523ed75eb76a7608b71
parent 166631 eef41cc0b232890e7f5f3671f325a8bc471d4fdb
child 166633 4566cb8edb0372d3bda71438bdd99f1b340ade52
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs927394
milestone27.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 927394 - adding waiting periods to fix intermittent fails in testReaderMode; r=gbrown
mobile/android/base/tests/testReaderMode.java.in
--- a/mobile/android/base/tests/testReaderMode.java.in
+++ b/mobile/android/base/tests/testReaderMode.java.in
@@ -24,50 +24,58 @@ public class testReaderMode extends Abou
         return TEST_MOCHITEST;
     }
     public void testReaderMode() {
         blockForGeckoReady();
 
         Actions.EventExpecter contentEventExpecter;
         Actions.EventExpecter contentReaderAddedExpecter;
         Actions.EventExpecter faviconExpecter;
+        Actions.EventExpecter contentPageShowExpecter;
+        Actions.RepeatedEventExpecter paintExpecter;
         ListView list;
         View child;
         String textUrl = getAbsoluteUrl(StringHelper.ROBOCOP_TEXT_PAGE_URL);
         String devType = mDevice.type;
         int childNo;
+        int eventClearDelay = 3000;
 
         contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
         loadAndPaint(textUrl);
         contentEventExpecter.blockForEvent();
         contentEventExpecter.unregisterListener();
-        View readerIcon = getReaderIcon();
 
         // Add the page to the Reading List using log click on the reader icon
         contentReaderAddedExpecter = mActions.expectGeckoEvent("Reader:Added");
-        mSolo.clickLongOnView(readerIcon);
+        mSolo.clickLongOnView(getReaderIcon());
         String eventData = contentReaderAddedExpecter.blockForEventData();
         isAdded(eventData);
         contentReaderAddedExpecter.unregisterListener();
 
         // Try to add the page to the Reading List using log click on the reader icon a second time
         contentReaderAddedExpecter = mActions.expectGeckoEvent("Reader:Added");
-        mSolo.clickLongOnView(readerIcon);
+        mSolo.clickLongOnView(getReaderIcon());
         eventData = contentReaderAddedExpecter.blockForEventData();
         isAdded(eventData);
         contentReaderAddedExpecter.unregisterListener();
 
         // Waiting for the favicon since is the last element loaded usually
         faviconExpecter = mActions.expectGeckoEvent("Reader:FaviconRequest");
+        contentPageShowExpecter = mActions.expectGeckoEvent("Content:PageShow");
+        paintExpecter = mActions.expectPaint();
         mSolo.clickOnView(getReaderIcon());
 
         // Changing devices orientation to be sure that all devices are in portrait when will access the reader toolbar
         mSolo.setActivityOrientation(Solo.PORTRAIT);
         faviconExpecter.blockForEvent();
         faviconExpecter.unregisterListener();
+        contentPageShowExpecter.blockForEvent();
+        contentPageShowExpecter.unregisterListener();
+        paintExpecter.blockUntilClear(eventClearDelay);
+        paintExpecter.unregisterListener();
         verifyPageTitle("Robocop Text Page");
 
         // Open the share menu for the reader toolbar
         height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
         width = mDriver.getGeckoLeft() + mDriver.getGeckoWidth() - 10;
         mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
         mSolo.clickOnScreen(width,height);
         mAsserter.ok(mSolo.waitForText("Share via"), "Waiting for the share menu", "The share menu is present");