зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1531347 - Port switch to tab tests to QuantumBar. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D21709 --HG-- rename : browser/components/urlbar/tests/legacy/browser_switchtab_decodeuri.js => browser/components/urlbar/tests/browser/browser_switchTab_decodeuri.js rename : browser/components/urlbar/tests/legacy/browser_switchtab_override.js => browser/components/urlbar/tests/browser/browser_switchTab_override.js extra : moz-landing-system : lando
This commit is contained in:
Родитель
70f8b5c221
Коммит
8decf3e815
|
@ -45,7 +45,11 @@ subsuite = clipboard
|
|||
[browser_search_favicon.js]
|
||||
skip-if = true # Bug 1526222 - Doesn't currently work with QuantumBar
|
||||
[browser_switchTab_closesUrlbarPopup.js]
|
||||
[browser_switchTab_decodeuri.js]
|
||||
[browser_switchTab_override.js]
|
||||
skip-if = ((os == 'win') && verify && debug)
|
||||
[browser_switchToTab_closes_newtab.js]
|
||||
skip-if = true # Bug 1531737 - fails when run after browser_switchTab_override.js
|
||||
[browser_switchToTabHavingURI_aOpenParams.js]
|
||||
[browser_tabMatchesInAwesomebar_perwindowpb.js]
|
||||
skip-if = os == 'linux' # Bug 1104755 (Intermittent failure)
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* This test ensures that switch to tab still works when the URI contains an
|
||||
* encoded part.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html#test%7C1`;
|
||||
|
@ -14,17 +24,16 @@ add_task(async function test_switchtab_decodeuri() {
|
|||
|
||||
info("Select autocomplete popup entry");
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown");
|
||||
ok(gURLBar.value.startsWith("moz-action:switchtab"), "switch to tab entry found");
|
||||
let result = await UrlbarTestUtils.getDetailsOfResultAt(window,
|
||||
UrlbarTestUtils.getSelectedIndex(window));
|
||||
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH);
|
||||
|
||||
info("switch-to-tab");
|
||||
await new Promise((resolve, reject) => {
|
||||
// In case of success it should switch tab.
|
||||
gBrowser.tabContainer.addEventListener("TabSelect", function() {
|
||||
is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
|
||||
resolve();
|
||||
}, {once: true});
|
||||
EventUtils.synthesizeKey("KEY_Enter");
|
||||
});
|
||||
let tabSelectPromise = BrowserTestUtils.waitForEvent(window, "TabSelect", false);
|
||||
EventUtils.synthesizeKey("KEY_Enter");
|
||||
await tabSelectPromise;
|
||||
|
||||
Assert.equal(gBrowser.selectedTab, tab, "Should have switched to the right tab");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
await PlacesUtils.history.clear();
|
|
@ -2,6 +2,13 @@
|
|||
* 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/. */
|
||||
|
||||
/**
|
||||
* This test ensures that overriding switch-to-tab correctly loads the page
|
||||
* rather than switching to it.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org/");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
|
@ -21,28 +28,16 @@ add_task(async function test_switchtab_override() {
|
|||
});
|
||||
|
||||
info("Wait for autocomplete");
|
||||
let deferred = PromiseUtils.defer();
|
||||
let onSearchComplete = gURLBar.onSearchComplete;
|
||||
registerCleanupFunction(() => {
|
||||
gURLBar.onSearchComplete = onSearchComplete;
|
||||
});
|
||||
gURLBar.onSearchComplete = function() {
|
||||
ok(gURLBar.popupOpen, "The autocomplete popup is correctly open");
|
||||
onSearchComplete.apply(gURLBar);
|
||||
deferred.resolve();
|
||||
};
|
||||
|
||||
gURLBar.focus();
|
||||
gURLBar.value = "dummy_pag";
|
||||
EventUtils.sendString("e");
|
||||
await deferred.promise;
|
||||
await promiseAutocompleteResultPopup("dummy_page");
|
||||
|
||||
info("Select second autocomplete popup entry");
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown");
|
||||
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
|
||||
let result = await UrlbarTestUtils.getDetailsOfResultAt(window,
|
||||
UrlbarTestUtils.getSelectedIndex(window));
|
||||
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH);
|
||||
|
||||
info("Override switch-to-tab");
|
||||
deferred = PromiseUtils.defer();
|
||||
let deferred = PromiseUtils.defer();
|
||||
// In case of failure this would switch tab.
|
||||
let onTabSelect = event => {
|
||||
deferred.reject(new Error("Should have overridden switch to tab"));
|
|
@ -12,12 +12,13 @@ support-files =
|
|||
# If you port a test, please move it to the section below to make it clearer
|
||||
# to identify the remaining tests.
|
||||
|
||||
# Not porting browser_switchtab_override_keynav.js/browser_switchtab_copy.js
|
||||
# to QuantumBar as we no longer have moz-action uris, so they aren't relevant
|
||||
# any more.
|
||||
[browser_switchtab_copy.js]
|
||||
subsuite = clipboard
|
||||
[browser_switchtab_decodeuri.js]
|
||||
[browser_switchtab_override_keynav.js]
|
||||
[browser_switchtab_override.js]
|
||||
skip-if = (verify && debug && (os == 'win'))
|
||||
|
||||
[browser_urlbarAddonIframe.js]
|
||||
support-files =
|
||||
../browser/Panel.jsm
|
||||
|
@ -84,6 +85,9 @@ support-files = ../browser/redirect_error.sjs
|
|||
subsuite = clipboard
|
||||
[../browser/browser_search_favicon.js]
|
||||
[../browser/browser_switchTab_closesUrlbarPopup.js]
|
||||
[../browser/browser_switchTab_decodeuri.js]
|
||||
[../browser/browser_switchTab_override.js]
|
||||
skip-if = ((os == 'win') && verify && debug)
|
||||
[../browser/browser_switchToTab_closes_newtab.js]
|
||||
[../browser/browser_switchToTabHavingURI_aOpenParams.js]
|
||||
[../browser/browser_tabMatchesInAwesomebar_perwindowpb.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче