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
Родитель b305d1e13b
Коммит 08ba3e8c7e
4 изменённых файлов: 7 добавлений и 25 удалений

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

@ -81,7 +81,7 @@ add_task(async function test_keyword_using_get() {
// QuantumBar doesn't have separate boxes for items. // QuantumBar doesn't have separate boxes for items.
let urlHbox = element._urlText.parentNode.parentNode; let urlHbox = element._urlText.parentNode.parentNode;
Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); 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 // Click on the result

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

@ -35,7 +35,7 @@
// QuantumBar doesn't have separate boxes for items. // QuantumBar doesn't have separate boxes for items.
let urlHbox = element._urlText.parentNode.parentNode; let urlHbox = element._urlText.parentNode.parentNode;
Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); 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"); info("During override");
@ -53,7 +53,7 @@
// QuantumBar doesn't have separate boxes for items. // QuantumBar doesn't have separate boxes for items.
let urlHbox = element._urlText.parentNode.parentNode; let urlHbox = element._urlText.parentNode.parentNode;
Assert.ok(urlHbox.classList.contains("ac-url"), "URL hbox element sanity check"); 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" }); EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });

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

@ -18,16 +18,6 @@ XPCOMUtils.defineLazyGetter(this, "TEST_BASE_URL", () =>
SearchTestUtils.init(Assert, registerCleanupFunction); 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. * Initializes an HTTP Server, and runs a task with it.
* @param {object} details {scheme, host, port} * @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) { function promiseSearchComplete(win = window, dontAnimate = false) {
return UrlbarTestUtils.promiseSearchComplete(win, dontAnimate); return UrlbarTestUtils.promiseSearchComplete(win, dontAnimate);
} }
@ -87,7 +69,3 @@ async function waitForAutocompleteResultAt(index) {
function promiseSuggestionsPresent(msg = "") { function promiseSuggestionsPresent(msg = "") {
return UrlbarTestUtils.promiseSuggestionsPresent(window, msg); return UrlbarTestUtils.promiseSuggestionsPresent(window, msg);
} }
function suggestionsPresent() {
return UrlbarTestUtils.suggestionsPresent(window);
}

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

@ -5,3 +5,7 @@
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/browser/components/urlbar/tests/legacy/head-common.js", "chrome://mochitests/content/browser/browser/components/urlbar/tests/legacy/head-common.js",
this); this);
function promisePopupShown(popup) {
return BrowserTestUtils.waitForPopupEvent(popup, "shown");
}