зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1738815: Move quicksuggest tests into own dir. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D131324
This commit is contained in:
Родитель
03606c7ea5
Коммит
8bac8a33ce
|
@ -21,7 +21,11 @@ function removeOverrides(config) {
|
|||
return config;
|
||||
}
|
||||
|
||||
const xpcshellTestPaths = ["**/test*/unit*/**/", "**/test*/xpcshell/**/"];
|
||||
const xpcshellTestPaths = [
|
||||
"**/test*/unit*/**/",
|
||||
"**/test*/*/unit*/",
|
||||
"**/test*/xpcshell/**/",
|
||||
];
|
||||
|
||||
const browserTestPaths = ["**/test*/**/browser*/"];
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ EXTRA_JS_MODULES += [
|
|||
]
|
||||
|
||||
TESTING_JS_MODULES += [
|
||||
"tests/QuickSuggestTestUtils.jsm",
|
||||
"tests/quicksuggest/QuickSuggestTestUtils.jsm",
|
||||
"tests/UrlbarTestUtils.jsm",
|
||||
]
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
|
@ -59,7 +59,11 @@ BROWSER_CHROME_MANIFESTS += [
|
|||
"tests/browser-updateResults/browser.ini",
|
||||
"tests/browser/browser.ini",
|
||||
"tests/ext/browser/browser.ini",
|
||||
"tests/quicksuggest/browser/browser.ini",
|
||||
]
|
||||
XPCSHELL_TESTS_MANIFESTS += [
|
||||
"tests/quicksuggest/unit/xpcshell.ini",
|
||||
"tests/unit/xpcshell.ini",
|
||||
]
|
||||
XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"]
|
||||
|
||||
SPHINX_TREES["/browser/urlbar"] = "docs"
|
||||
|
|
|
@ -171,19 +171,6 @@ support-files =
|
|||
[browser_populateAfterPushState.js]
|
||||
[browser_primary_selection_safe_on_new_tab.js]
|
||||
[browser_privateBrowsingWindowChange.js]
|
||||
[browser_quicksuggest.js]
|
||||
support-files =
|
||||
quicksuggest.sjs
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_configuration.js]
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_indexes.js]
|
||||
support-files =
|
||||
quicksuggest.sjs
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_onboardingDialog.js]
|
||||
support-files =
|
||||
subdialog.xhtml
|
||||
[browser_raceWithTabs.js]
|
||||
[browser_redirect_error.js]
|
||||
support-files = redirect_error.sjs
|
||||
|
@ -333,8 +320,6 @@ tags = search-telemetry
|
|||
[browser_urlbar_telemetry_places.js]
|
||||
https_first_disabled = true
|
||||
tags = search-telemetry
|
||||
[browser_urlbar_telemetry_quicksuggest.js]
|
||||
tags = search-telemetry
|
||||
[browser_urlbar_telemetry_remotetab.js]
|
||||
tags = search-telemetry
|
||||
[browser_urlbar_telemetry_searchmode.js]
|
||||
|
|
|
@ -30,15 +30,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"nsIClipboardHelper"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "QuickSuggestTestUtils", () => {
|
||||
const { QuickSuggestTestUtils: module } = ChromeUtils.import(
|
||||
"resource://testing-common/QuickSuggestTestUtils.jsm"
|
||||
);
|
||||
module.init(this);
|
||||
registerCleanupFunction(() => module.uninit());
|
||||
return module;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "UrlbarTestUtils", () => {
|
||||
const { UrlbarTestUtils: module } = ChromeUtils.import(
|
||||
"resource://testing-common/UrlbarTestUtils.jsm"
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function handleRequest(request, response) {
|
||||
Components.utils.importGlobalProperties(["URLSearchParams"]);
|
||||
let query = new URLSearchParams(request.queryString);
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write(query.get("q"));
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
head.js
|
||||
searchSuggestionEngine.xml
|
||||
searchSuggestionEngine.sjs
|
||||
subdialog.xhtml
|
||||
|
||||
[browser_quicksuggest.js]
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_configuration.js]
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_indexes.js]
|
||||
skip-if = asan # Bug 1701321
|
||||
[browser_quicksuggest_onboardingDialog.js]
|
||||
[browser_quicksuggest_telemetry.js]
|
||||
tags = search-telemetry
|
|
@ -11,8 +11,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
UrlbarQuickSuggest: "resource:///modules/UrlbarQuickSuggest.jsm",
|
||||
});
|
||||
|
||||
const TEST_URL =
|
||||
"http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/quicksuggest.sjs";
|
||||
const TEST_URL = "http://example.com/quicksuggest";
|
||||
|
||||
const TEST_DATA = [
|
||||
{
|
|
@ -25,8 +25,7 @@ const NON_SPONSORED_INDEX_PREF =
|
|||
const SPONSORED_SEARCH_STRING = "frabbits";
|
||||
const NON_SPONSORED_SEARCH_STRING = "nonspon";
|
||||
|
||||
const TEST_URL =
|
||||
"http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/quicksuggest.sjs";
|
||||
const TEST_URL = "http://example.com/quicksuggest";
|
||||
|
||||
const TEST_DATA = [
|
||||
{
|
|
@ -15,9 +15,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
|
||||
});
|
||||
|
||||
const TEST_SJS =
|
||||
"http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/quicksuggest.sjs";
|
||||
const TEST_URL = TEST_SJS + "?q=frabbits";
|
||||
const TEST_URL = "http://example.com/quicksuggest?q=frabbits";
|
||||
const TEST_SEARCH_STRING = "frab";
|
||||
const TEST_DATA = [
|
||||
{
|
|
@ -0,0 +1,31 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
let sandbox;
|
||||
|
||||
/* import-globals-from ../../browser/head-common.js */
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/browser/components/urlbar/tests/browser/head-common.js",
|
||||
this
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "QuickSuggestTestUtils", () => {
|
||||
const { QuickSuggestTestUtils: module } = ChromeUtils.import(
|
||||
"resource://testing-common/QuickSuggestTestUtils.jsm"
|
||||
);
|
||||
module.init(this);
|
||||
registerCleanupFunction(() => module.uninit());
|
||||
return module;
|
||||
});
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
// Ensure the Urlbar popup is always closed at the end of a test, to save having
|
||||
// to do it within each test.
|
||||
await UrlbarTestUtils.promisePopupClose(window);
|
||||
});
|
|
@ -0,0 +1,57 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let gTimer;
|
||||
|
||||
function handleRequest(req, resp) {
|
||||
// Parse the query params. If the params aren't in the form "foo=bar", then
|
||||
// treat the entire query string as a search string.
|
||||
let params = req.queryString.split("&").reduce((memo, pair) => {
|
||||
let [key, val] = pair.split("=");
|
||||
if (!val) {
|
||||
// This part isn't in the form "foo=bar". Treat it as the search string
|
||||
// (the "query").
|
||||
val = key;
|
||||
key = "query";
|
||||
}
|
||||
memo[decode(key)] = decode(val);
|
||||
return memo;
|
||||
}, {});
|
||||
|
||||
let timeout = parseInt(params.timeout);
|
||||
if (timeout) {
|
||||
// Write the response after a timeout.
|
||||
resp.processAsync();
|
||||
gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
gTimer.init(
|
||||
() => {
|
||||
writeResponse(params, resp);
|
||||
resp.finish();
|
||||
},
|
||||
timeout,
|
||||
Ci.nsITimer.TYPE_ONE_SHOT
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
writeResponse(params, resp);
|
||||
}
|
||||
|
||||
function writeResponse(params, resp) {
|
||||
// Echo back the search string with "foo" and "bar" appended.
|
||||
let suffixes = ["foo", "bar"];
|
||||
if (params.count) {
|
||||
// Add more suffixes.
|
||||
let serial = 0;
|
||||
while (suffixes.length < params.count) {
|
||||
suffixes.push(++serial);
|
||||
}
|
||||
}
|
||||
let data = [params.query, suffixes.map(s => params.query + s)];
|
||||
resp.setHeader("Content-Type", "application/json", false);
|
||||
resp.write(JSON.stringify(data));
|
||||
}
|
||||
|
||||
function decode(str) {
|
||||
return decodeURIComponent(str.replace(/\+/g, encodeURIComponent(" ")));
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>browser_searchSuggestionEngine searchSuggestionEngine.xml</ShortName>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/searchSuggestionEngine.sjs?{searchTerms}"/>
|
||||
<Url type="text/html" method="GET" template="http://mochi.test:8888/" rel="searchform">
|
||||
<Param name="terms" value="{searchTerms}"/>
|
||||
</Url>
|
||||
</SearchPlugin>
|
|
@ -0,0 +1,4 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* import-globals-from ../../unit/head.js */
|
|
@ -0,0 +1,10 @@
|
|||
[DEFAULT]
|
||||
skip-if = toolkit == 'android' # bug 1730213
|
||||
head = head.js ../../unit/head.js
|
||||
firefox-appdir = browser
|
||||
|
||||
[test_quicksuggest.js]
|
||||
[test_quicksuggest_keywordtree.js]
|
||||
[test_quicksuggest_merino.js]
|
||||
[test_quicksuggest_migrate_v1.js]
|
||||
[test_quicksuggest_offlineDefault.js]
|
|
@ -70,11 +70,6 @@ skip-if = !sync
|
|||
[test_tags_general.js]
|
||||
[test_tags_matchBookmarkTitles.js]
|
||||
[test_tags_returnedInSearches.js]
|
||||
[test_quicksuggest.js]
|
||||
[test_quicksuggest_keywordtree.js]
|
||||
[test_quicksuggest_merino.js]
|
||||
[test_quicksuggest_migrate_v1.js]
|
||||
[test_quicksuggest_offlineDefault.js]
|
||||
[test_tokenizer.js]
|
||||
[test_trimming.js]
|
||||
[test_unitConversion.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче