From 08ba3e8c7ec67f0fb0255e70f8732aff686594eb Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 27 Mar 2019 00:16:32 +0000 Subject: [PATCH] Bug 1539284 - Remove some redundant functions from urlbar's head-common.js. r=adw Differential Revision: https://phabricator.services.mozilla.com/D24986 --HG-- extra : moz-landing-system : lando --- .../urlbar/tests/browser/browser_keyword.js | 2 +- .../tests/browser/browser_keyword_override.js | 4 ++-- .../urlbar/tests/browser/head-common.js | 22 ------------------- .../components/urlbar/tests/legacy/head.js | 4 ++++ 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/browser/components/urlbar/tests/browser/browser_keyword.js b/browser/components/urlbar/tests/browser/browser_keyword.js index ff69154eb8a9..4cfa4bbb0e2f 100644 --- a/browser/components/urlbar/tests/browser/browser_keyword.js +++ b/browser/components/urlbar/tests/browser/browser_keyword.js @@ -81,7 +81,7 @@ add_task(async function test_keyword_using_get() { // QuantumBar doesn't have separate boxes for items. let urlHbox = element._urlText.parentNode.parentNode; Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); - is_element_hidden(urlHbox, "URL element should be hidden"); + BrowserTestUtils.is_hidden(urlHbox, "URL element should be hidden"); } // Click on the result diff --git a/browser/components/urlbar/tests/browser/browser_keyword_override.js b/browser/components/urlbar/tests/browser/browser_keyword_override.js index 1c2ad2138f65..06944b3b6692 100644 --- a/browser/components/urlbar/tests/browser/browser_keyword_override.js +++ b/browser/components/urlbar/tests/browser/browser_keyword_override.js @@ -35,7 +35,7 @@ // QuantumBar doesn't have separate boxes for items. let urlHbox = element._urlText.parentNode.parentNode; Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); - is_element_hidden(urlHbox, "URL element should be hidden"); + BrowserTestUtils.is_hidden(urlHbox, "URL element should be hidden"); } info("During override"); @@ -53,7 +53,7 @@ // QuantumBar doesn't have separate boxes for items. let urlHbox = element._urlText.parentNode.parentNode; Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); - is_element_hidden(urlHbox, "URL element should be hidden"); + BrowserTestUtils.is_hidden(urlHbox, "URL element should be hidden"); } EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" }); diff --git a/browser/components/urlbar/tests/browser/head-common.js b/browser/components/urlbar/tests/browser/head-common.js index 91cd5200f6ad..78b3dcec18b2 100644 --- a/browser/components/urlbar/tests/browser/head-common.js +++ b/browser/components/urlbar/tests/browser/head-common.js @@ -18,16 +18,6 @@ XPCOMUtils.defineLazyGetter(this, "TEST_BASE_URL", () => SearchTestUtils.init(Assert, registerCleanupFunction); -function is_element_visible(element, msg) { - isnot(element, null, "Element should not be null, when checking visibility"); - ok(BrowserTestUtils.is_visible(element), msg || "Element should be visible"); -} - -function is_element_hidden(element, msg) { - isnot(element, null, "Element should not be null, when checking visibility"); - ok(BrowserTestUtils.is_hidden(element), msg || "Element should be hidden"); -} - /** * Initializes an HTTP Server, and runs a task with it. * @param {object} details {scheme, host, port} @@ -61,14 +51,6 @@ async function withHttpServer(details = { scheme: "http", host: "localhost", por } } -function promisePopupShown(popup) { - return BrowserTestUtils.waitForPopupEvent(popup, "shown"); -} - -function promisePopupHidden(popup) { - return BrowserTestUtils.waitForPopupEvent(popup, "hidden"); -} - function promiseSearchComplete(win = window, dontAnimate = false) { return UrlbarTestUtils.promiseSearchComplete(win, dontAnimate); } @@ -87,7 +69,3 @@ async function waitForAutocompleteResultAt(index) { function promiseSuggestionsPresent(msg = "") { return UrlbarTestUtils.promiseSuggestionsPresent(window, msg); } - -function suggestionsPresent() { - return UrlbarTestUtils.suggestionsPresent(window); -} diff --git a/browser/components/urlbar/tests/legacy/head.js b/browser/components/urlbar/tests/legacy/head.js index b1522673a568..90bbc16a2fdd 100644 --- a/browser/components/urlbar/tests/legacy/head.js +++ b/browser/components/urlbar/tests/legacy/head.js @@ -5,3 +5,7 @@ Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/browser/components/urlbar/tests/legacy/head-common.js", this); + +function promisePopupShown(popup) { + return BrowserTestUtils.waitForPopupEvent(popup, "shown"); +}