Bug 1407547 - Wait until all tabs are restored. r=mikedeboer
authorLiang-Heng Chen <xeonchen@gmail.com>
Fri, 03 Nov 2017 17:15:00 -0400
changeset 694280 0d5c2d176a454b25ee8aa893165d9e95f1d63f92
parent 694279 53ce0e7d27e7e3022fb21cc2d38ef56a84d86929
child 694281 04d539bc9bca98f22ca51de00a40eceb516405e3
child 695079 7dbb71574255c5a02a203a4031c5902016b73e50
child 695093 7c5282d46f60a495d9aa3ae5d87ab7d46783690a
child 695528 594e360e3bd67d8614bf9bca351ee852ea194cef
push id88091
push userbmo:rail@mozilla.com
push dateTue, 07 Nov 2017 16:07:19 +0000
reviewersmikedeboer
bugs1407547
milestone58.0a1
Bug 1407547 - Wait until all tabs are restored. r=mikedeboer MozReview-Commit-ID: 8hRibuBOJBf
browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
--- a/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
@@ -67,38 +67,45 @@ add_task(async function clearURLBarAfter
 });
 
 /**
  * Ensure we don't show 'about:home' in the URL bar temporarily in new tabs
  * while we're switching remoteness (when the URL we're loading and the
  * default content principal are different).
  */
 add_task(async function dontTemporarilyShowAboutHome() {
+  requestLongerTimeout(2);
+
   await SpecialPowers.pushPrefEnv({set: [["browser.startup.page", 1]]});
   let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
   let win = OpenBrowserWindow();
   await windowOpenedPromise;
   let promiseTabSwitch = BrowserTestUtils.switchTab(win.gBrowser, () => {});
   win.BrowserOpenTab();
   await promiseTabSwitch;
+  is(win.gBrowser.visibleTabs.length, 2, "2 tabs opened");
   await TabStateFlusher.flush(win.gBrowser.selectedBrowser);
   await BrowserTestUtils.closeWindow(win);
   ok(SessionStore.getClosedWindowCount(), "Should have a closed window");
 
   await SessionSaver.run();
 
   windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
   win = SessionStore.undoCloseWindow(0);
   await windowOpenedPromise;
   let wpl = {
     onLocationChange() {
       is(win.gURLBar.value, "", "URL bar value should stay empty.");
     },
   };
   win.gBrowser.addProgressListener(wpl);
+
+  if (win.gBrowser.visibleTabs.length < 2) {
+    await BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen");
+  }
   let otherTab = win.gBrowser.selectedTab.previousSibling;
   let tabLoaded = BrowserTestUtils.browserLoaded(otherTab.linkedBrowser, false, "about:home");
   await BrowserTestUtils.switchTab(win.gBrowser, otherTab);
   await tabLoaded;
   win.gBrowser.removeProgressListener(wpl);
   is(win.gURLBar.value, "", "URL bar value should be empty.");
 
   await BrowserTestUtils.closeWindow(win);