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
This commit is contained in:
Mark Banner 2019-03-27 00:16:32 +00:00
parent b305d1e13b
commit 08ba3e8c7e
4 changed files with 7 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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