Bug 1531693 - For the PrivateBrowsing about page test, ensure we wait for autocomplete to finish. r=mak
authorMark Banner <standard8@mozilla.com>
Tue, 26 Mar 2019 18:01:05 +0000
changeset 466138 0969fd6383cea58141d70fbb2d0895ccb476af6c
parent 466137 d8dcb951f8318bbbca0f7bbc007cd6e764d3483b
child 466139 75d859821fcf2006ba6070bddf80627fbf6aa065
child 466267 ba4174dac8c6af15e8102d3935cefced4280dffd
push id35761
push userdvarga@mozilla.com
push dateTue, 26 Mar 2019 21:49:44 +0000
treeherdermozilla-central@0969fd6383ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1531693
milestone68.0a1
first release with
nightly linux32
0969fd6383ce / 68.0a1 / 20190326214944 / files
nightly linux64
0969fd6383ce / 68.0a1 / 20190326214944 / files
nightly mac
0969fd6383ce / 68.0a1 / 20190326214944 / files
nightly win32
0969fd6383ce / 68.0a1 / 20190326214944 / files
nightly win64
0969fd6383ce / 68.0a1 / 20190326214944 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531693 - For the PrivateBrowsing about page test, ensure we wait for autocomplete to finish. r=mak This ensures test stability, and avoids leaking browser windows when we're closing the private browsing window in the test. Differential Revision: https://phabricator.services.mozilla.com/D24530
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
@@ -1,14 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
 
+const {UrlbarTestUtils} = ChromeUtils.import("resource://testing-common/UrlbarTestUtils.jsm");
+
 /**
  * Opens a new private window and loads "about:privatebrowsing" there.
  */
 async function openAboutPrivateBrowsing() {
   let win = await BrowserTestUtils.openNewBrowserWindow({
     private: true,
     waitForTabURL: "about:privatebrowsing",
   });
@@ -128,22 +130,25 @@ add_task(async function test_search_hand
   ok(urlBarHasHiddenFocus(win), "url bar has hidden focused");
   await new Promise(r => EventUtils.synthesizeKey("f", {}, win, r));
   await ContentTask.spawn(tab, null, async function() {
     ok(content.document.getElementById("search-handoff-button").classList.contains("hidden"),
       "in-content search is hidden");
   });
   ok(urlBarHasNormalFocus(win), "url bar has normal focused");
   is(win.gURLBar.value, "@google f", "url bar has search text");
+  await UrlbarTestUtils.promiseSearchComplete(win);
+  // Close the popup.
+  await UrlbarTestUtils.promisePopupClose(win);
 
   // Hitting ESC should reshow the in-content search
   await new Promise(r => EventUtils.synthesizeKey("KEY_Escape", {}, win, r));
   await ContentTask.spawn(tab, null, async function() {
     ok(!content.document.getElementById("search-handoff-button").classList.contains("hidden"),
-      "in-content search is not");
+      "in-content search is not hidden");
   });
 
   await BrowserTestUtils.closeWindow(win);
 });
 
 /**
  * Tests the search hand-off on composition start in "about:privatebrowsing".
  */
@@ -171,13 +176,18 @@ add_task(async function test_search_hand
   await ContentTask.spawn(tab, null, async function() {
     content.document.getElementById("search-handoff-button").click();
   });
   ok(urlBarHasHiddenFocus(win), "url bar has hidden focused");
   var helper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
      .getService(SpecialPowers.Ci.nsIClipboardHelper);
   helper.copyString("words");
   await new Promise(r => EventUtils.synthesizeKey("v", {accelKey: true}, win, r));
+  // TODO: Bug 1539199 We should be able to wait for search complete for AwesomeBar
+  // as well.
+  if (UrlbarPrefs.get("quantumbar")) {
+    await UrlbarTestUtils.promiseSearchComplete(win);
+  }
   ok(urlBarHasNormalFocus(win), "url bar has normal focused");
   is(win.gURLBar.value, "@google words", "url bar has search text");
 
   await BrowserTestUtils.closeWindow(win);
 });