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

This commit is contained in:
Michael Comella 2014-02-05 13:55:45 -08:00
Родитель df799274a7
Коммит a212721265
2 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -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();
}
}

Просмотреть файл

@ -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);