зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1521534 - Make urlbar mochitests use a TEST_BASE_URL provided via head.js. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D22068 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
edd8d7fc40
Коммит
b4093c5061
|
@ -29,9 +29,7 @@ function assertURL(result, expectedUrl, input, postData) {
|
|||
}
|
||||
}
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://mochi.test:8888");
|
||||
const TEST_URL = `${TEST_PATH}print_postdata.sjs`;
|
||||
const TEST_URL = `${TEST_BASE_URL}print_postdata.sjs`;
|
||||
|
||||
add_task(async function setup() {
|
||||
await PlacesUtils.keywords.insert({ keyword: "get",
|
||||
|
@ -56,7 +54,7 @@ add_task(async function test_display_keyword_without_query() {
|
|||
|
||||
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.KEYWORD,
|
||||
"Should have a keyword result");
|
||||
Assert.equal(result.displayed.title, "mochi.test:8888",
|
||||
Assert.equal(result.displayed.title, "example.com",
|
||||
"Node should contain the name of the bookmark");
|
||||
Assert.equal(result.displayed.action,
|
||||
Services.strings.createBundle("chrome://global/locale/autocomplete.properties")
|
||||
|
@ -71,7 +69,7 @@ add_task(async function test_keyword_using_get() {
|
|||
|
||||
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.KEYWORD,
|
||||
"Should have a keyword result");
|
||||
Assert.equal(result.displayed.title, "mochi.test:8888: something",
|
||||
Assert.equal(result.displayed.title, "example.com: something",
|
||||
"Node should contain the name of the bookmark and query");
|
||||
Assert.ok(!result.displayed.action, "Should have an empty action");
|
||||
|
||||
|
@ -122,7 +120,7 @@ add_task(async function test_keyword_using_post() {
|
|||
|
||||
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.KEYWORD,
|
||||
"Should have a keyword result");
|
||||
Assert.equal(result.displayed.title, "mochi.test:8888: something",
|
||||
Assert.equal(result.displayed.title, "example.com: something",
|
||||
"Node should contain the name of the bookmark and query");
|
||||
Assert.ok(!result.displayed.action, "Should have an empty action");
|
||||
|
||||
|
|
|
@ -9,15 +9,14 @@
|
|||
* change takes place.
|
||||
*/
|
||||
add_task(async function() {
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
|
||||
await BrowserTestUtils.withNewTab(TEST_PATH + "dummy_page.html", async function(browser) {
|
||||
await BrowserTestUtils.withNewTab(TEST_BASE_URL + "dummy_page.html", async function(browser) {
|
||||
gURLBar.value = "";
|
||||
|
||||
let locationChangePromise = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_PATH + "dummy_page2.html");
|
||||
let locationChangePromise = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_BASE_URL + "dummy_page2.html");
|
||||
await ContentTask.spawn(browser, null, function() {
|
||||
content.history.pushState({}, "Page 2", "dummy_page2.html");
|
||||
});
|
||||
await locationChangePromise;
|
||||
is(gURLBar.value, TEST_PATH + "dummy_page2.html", "Should have updated the URL bar.");
|
||||
is(gURLBar.value, TEST_BASE_URL + "dummy_page2.html", "Should have updated the URL bar.");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
async function addBookmark(bookmark) {
|
||||
if (bookmark.keyword) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const REDIRECT_FROM = `${TEST_PATH}redirect_error.sjs`;
|
||||
const REDIRECT_FROM = `${TEST_BASE_URL}redirect_error.sjs`;
|
||||
|
||||
const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
const {SyncedTabs} = ChromeUtils.import("resource://services-sync/SyncedTabs.jsm");
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
const REMOTE_TAB = {
|
||||
"id": "7cqCr77ptzX3",
|
||||
|
|
|
@ -59,8 +59,7 @@ add_task(async function() {
|
|||
const PORT = socket.port;
|
||||
registerCleanupFunction(() => { socket.close(); });
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
const BASE_PAGE = TEST_PATH + "dummy_page.html";
|
||||
const BASE_PAGE = TEST_BASE_URL + "dummy_page.html";
|
||||
const SLOW_HOST = `https://localhost:${PORT}/`;
|
||||
info("Using URLs: " + SLOW_HOST);
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_PAGE);
|
||||
|
@ -105,8 +104,7 @@ add_task(async function() {
|
|||
const PORT2 = socket2.port;
|
||||
registerCleanupFunction(() => { socket.close(); socket2.close(); });
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
const BASE_PAGE = TEST_PATH + "dummy_page.html";
|
||||
const BASE_PAGE = TEST_BASE_URL + "dummy_page.html";
|
||||
const SLOW_HOST1 = `https://localhost:${PORT1}/`;
|
||||
const SLOW_HOST2 = `https://localhost:${PORT2}/`;
|
||||
info("Using URLs: " + SLOW_HOST1 + " and " + SLOW_HOST2);
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html#test%7C1`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html#test%7C1`;
|
||||
|
||||
add_task(async function test_switchtab_decodeuri() {
|
||||
info("Opening first tab");
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org/");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
|
||||
add_task(async function test_switchtab_override() {
|
||||
|
|
|
@ -13,11 +13,9 @@
|
|||
|
||||
requestLongerTimeout(2);
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const TEST_URL_BASES = [
|
||||
`${TEST_PATH}dummy_page.html#tabmatch`,
|
||||
`${TEST_PATH}moz.png#tabmatch`,
|
||||
`${TEST_BASE_URL}dummy_page.html#tabmatch`,
|
||||
`${TEST_BASE_URL}moz.png#tabmatch`,
|
||||
];
|
||||
|
||||
const RESTRICT_TOKEN_OPENPAGE = "%";
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
* private browsing and the other is normal, or vice-versa.
|
||||
*/
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
add_task(async function() {
|
||||
let normalWindow = await BrowserTestUtils.openNewBrowserWindow();
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
"use strict";
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "https://example.org");
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Check that navigating through both the URL bar and using in-page hash- or ref-
|
||||
* based links and back or forward navigation updates the URL bar and identity block correctly.
|
||||
*/
|
||||
add_task(async function() {
|
||||
let baseURL = `${TEST_PATH}dummy_page.html`;
|
||||
let baseURL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
let url = baseURL + "#foo";
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url }, async function(browser) {
|
||||
let identityBox = document.getElementById("identity-box");
|
||||
|
@ -95,7 +95,7 @@ add_task(async function() {
|
|||
// Ensure there's no preloaded newtab browser, since that'll not fire a load event.
|
||||
gBrowser.removePreloadedBrowser();
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:newtab");
|
||||
let url = `${TEST_PATH}dummy_page.html#foo`;
|
||||
let url = `${TEST_BASE_URL}dummy_page.html#foo`;
|
||||
gURLBar.value = url;
|
||||
gURLBar.select();
|
||||
EventUtils.sendKey("return");
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
add_task(async function() {
|
||||
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://www.example.com");
|
||||
const TEST_URL = `${TEST_PATH}file_blank_but_not_blank.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}file_blank_but_not_blank.html`;
|
||||
|
||||
add_task(async function() {
|
||||
for (let page of gInitialPages) {
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
|
||||
add_task(async function() {
|
||||
await BrowserTestUtils.withNewTab(TEST_PATH + "dummy_page.html", async function(browser) {
|
||||
await BrowserTestUtils.withNewTab(TEST_BASE_URL + "dummy_page.html", async function(browser) {
|
||||
let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
|
||||
await ContentTask.spawn(browser, null, function() {
|
||||
content.window.open("", "_BLANK", "toolbar=no,height=300,width=500");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://www.example.com");
|
||||
const TEST_URL = `${TEST_PATH}file_urlbar_edit_dos.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}file_urlbar_edit_dos.html`;
|
||||
|
||||
async function checkURLBarValueStays(browser) {
|
||||
gURLBar.select();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
const URI = TEST_PATH + "file_userTypedValue.html";
|
||||
const URI = TEST_BASE_URL + "file_userTypedValue.html";
|
||||
window.browserDOMWindow.openURI(makeURI(URI),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
|
|
|
@ -12,6 +12,10 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "TEST_BASE_URL", () =>
|
||||
getRootDirectory(gTestPath).replace("chrome://mochitests/content",
|
||||
"https://example.com"));
|
||||
|
||||
SearchTestUtils.init(Assert, registerCleanupFunction);
|
||||
|
||||
function is_element_visible(element, msg) {
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
var testActionURL = "moz-action:switchtab," + JSON.stringify({url: TEST_URL});
|
||||
const testURL = gURLBar.trimValue(TEST_URL);
|
||||
var testTab;
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.org");
|
||||
const TEST_URL = `${TEST_PATH}dummy_page.html`;
|
||||
const TEST_URL = `${TEST_BASE_URL}dummy_page.html`;
|
||||
|
||||
add_task(async function test_switchtab_override_keynav() {
|
||||
info("Opening first tab");
|
||||
|
|
Загрузка…
Ссылка в новой задаче