mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 1530405 - Port the UITour tests to QuantumBar. r=MattN,mak.
Differential Revision: https://phabricator.services.mozilla.com/D21028 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f9817933f0
commit
57ab0d5de2
@ -31,6 +31,8 @@ ChromeUtils.defineModuleGetter(this, "ResetProfile",
|
||||
"resource://gre/modules/ResetProfile.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UrlbarPrefs",
|
||||
"resource:///modules/UrlbarPrefs.jsm");
|
||||
|
||||
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
|
||||
const PREF_LOG_LEVEL = "browser.uitour.loglevel";
|
||||
@ -1321,22 +1323,29 @@ var UITour = {
|
||||
}
|
||||
pageAction.doCommand(aWindow);
|
||||
} else if (aMenuName == "urlbar") {
|
||||
this.getTarget(aWindow, "urlbar").then(target => {
|
||||
let urlbar = target.node;
|
||||
if (aOpenCallback) {
|
||||
let urlbar = aWindow.gURLBar;
|
||||
let quantumbar = UrlbarPrefs.get("quantumbar");
|
||||
if (aOpenCallback) {
|
||||
if (quantumbar) {
|
||||
urlbar.panel.addEventListener("popupshown", aOpenCallback, { once: true });
|
||||
} else {
|
||||
urlbar.popup.addEventListener("popupshown", aOpenCallback, { once: true });
|
||||
}
|
||||
urlbar.focus();
|
||||
// To demonstrate the ability of searching, we type "Firefox" in advance
|
||||
// for URLBar's dropdown. To limit the search results on browser-related
|
||||
// items, we use "Firefox" hard-coded rather than l10n brandShortName
|
||||
// entity to avoid unrelated or unpredicted results for, like, Nightly
|
||||
// or translated entites.
|
||||
const SEARCH_STRING = "Firefox";
|
||||
urlbar.value = SEARCH_STRING;
|
||||
urlbar.select();
|
||||
}
|
||||
urlbar.focus();
|
||||
// To demonstrate the ability of searching, we type "Firefox" in advance
|
||||
// for URLBar's dropdown. To limit the search results on browser-related
|
||||
// items, we use "Firefox" hard-coded rather than l10n brandShortName
|
||||
// entity to avoid unrelated or unpredicted results for, like, Nightly
|
||||
// or translated entites.
|
||||
const SEARCH_STRING = "Firefox";
|
||||
urlbar.value = SEARCH_STRING;
|
||||
urlbar.select();
|
||||
if (quantumbar) {
|
||||
urlbar.startQuery();
|
||||
} else {
|
||||
urlbar.controller.startSearch(SEARCH_STRING);
|
||||
}).catch(Cu.reportError);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
const CONTROL_CENTER_PANEL = gIdentityHandler._identityPopup;
|
||||
const CONTROL_CENTER_MENU_NAME = "controlCenter";
|
||||
|
||||
const {UrlbarTestUtils} = ChromeUtils.import("resource://testing-common/UrlbarTestUtils.jsm");
|
||||
|
||||
var gTestTab;
|
||||
var gContentAPI;
|
||||
var gContentWindow;
|
||||
@ -43,15 +45,9 @@ add_UITour_task(async function test_hideMenu_controlCenter() {
|
||||
});
|
||||
|
||||
add_UITour_task(async function test_showMenu_hideMenu_urlbarPopup() {
|
||||
let shownPromise = promisePanelElementShown(window, gURLBar.popup);
|
||||
await showMenuPromise("urlbar");
|
||||
await shownPromise;
|
||||
is(gURLBar.popup.state, "open", "The urlbar popup should open after showMenu");
|
||||
is(gURLBar.controller.searchString, "Firefox", "Search string is Firefox");
|
||||
let hidePromise = promisePanelElementHidden(window, gURLBar.popup);
|
||||
await gContentAPI.hideMenu("urlbar");
|
||||
await hidePromise;
|
||||
is(gURLBar.popup.state, "closed", "The urlbar popup should close after hideMenu");
|
||||
await UrlbarTestUtils.promisePopupOpen(window, () => showMenuPromise("urlbar"));
|
||||
is(gURLBar.value, "Firefox", "Search string is Firefox");
|
||||
await UrlbarTestUtils.promisePopupClose(window, () => gContentAPI.hideMenu("urlbar"));
|
||||
});
|
||||
|
||||
add_UITour_task(async function test_showMenu_hideMenu_pageActionPanel() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user