diff --git a/mobile/android/base/tests/helpers/GeckoHelper.java b/mobile/android/base/tests/helpers/GeckoHelper.java index c9fb39f3344..ca68777dd30 100644 --- a/mobile/android/base/tests/helpers/GeckoHelper.java +++ b/mobile/android/base/tests/helpers/GeckoHelper.java @@ -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(); } } diff --git a/mobile/android/base/tests/testAboutHomePageNavigation.java b/mobile/android/base/tests/testAboutHomePageNavigation.java index 485a243a037..405b634c89e 100644 --- a/mobile/android/base/tests/testAboutHomePageNavigation.java +++ b/mobile/android/base/tests/testAboutHomePageNavigation.java @@ -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);