Bug 947550 - Wait for Gecko:DelayedStartup in testAboutHomePageNavigation. r=margaret

This commit is contained in:
Michael Comella 2014-02-04 18:57:54 -08:00
parent c3bc072474
commit 11dabed499
2 changed files with 18 additions and 6 deletions

View File

@ -27,13 +27,25 @@ public final class GeckoHelper {
}
public static void blockForReady() {
final EventExpecter geckoReady = sActions.expectGeckoEvent("Gecko:Ready");
blockForEvent("Gecko:Ready");
}
final boolean isReady = GeckoThread.checkLaunchState(LaunchState.GeckoRunning);
if (!isReady) {
geckoReady.blockForEvent();
/**
* Blocks for the "Gecko:DelayedStartup" event, which occurs after "Gecko:Ready" and the
* first page load.
*/
public static void blockForDelayedStartup() {
blockForEvent("Gecko:DelayedStartup");
}
private static void blockForEvent(final String eventName) {
final EventExpecter eventExpecter = sActions.expectGeckoEvent(eventName);
final boolean isRunning = GeckoThread.checkLaunchState(LaunchState.GeckoRunning);
if (!isRunning) {
eventExpecter.blockForEvent();
}
geckoReady.unregisterListener();
eventExpecter.unregisterListener();
}
}

View File

@ -13,7 +13,7 @@ public class testAboutHomePageNavigation extends UITest {
// enum for both phone and tablet, then swiping through the panels. This will also
// benefit having a HomePager with custom panels.
public void testAboutHomePageNavigation() {
GeckoHelper.blockForReady();
GeckoHelper.blockForDelayedStartup();
mAboutHome.assertVisible()
.assertCurrentPanel(PanelType.TOP_SITES);