Bug 1885121 - Fix a few more tests that are broken with search-config-v2 enabled. r=mcheang

Differential Revision: https://phabricator.services.mozilla.com/D204500
This commit is contained in:
Mark Banner 2024-03-13 14:51:07 +00:00
parent 786d8cbb78
commit 660bc76c37
2 changed files with 107 additions and 2 deletions

View File

@ -31,6 +31,47 @@ const CONFIG_DEFAULT = [
},
];
const CONFIG_V2 = [
{
recordType: "engine",
identifier: "basic",
base: {
name: "basic",
urls: {
search: {
base: "https://example.com",
searchTermParamName: "q",
},
},
},
variants: [{ environment: { allRegionsAndLocales: true } }],
},
{
recordType: "engine",
identifier: "private",
base: {
name: "private",
urls: {
search: {
base: "https://example.com",
searchTermParamName: "q",
},
},
},
variants: [{ environment: { allRegionsAndLocales: true } }],
},
{
recordType: "defaultEngines",
globalDefault: "basic",
globalDefaultPrivate: "private",
specificDefaults: [],
},
{
recordType: "engineOrders",
orders: [],
},
];
SearchTestUtils.init(this);
add_setup(async () => {
@ -50,7 +91,9 @@ add_setup(async () => {
});
SearchTestUtils.useMockIdleService();
await SearchTestUtils.updateRemoteSettingsConfig(CONFIG_DEFAULT);
await SearchTestUtils.updateRemoteSettingsConfig(
SearchUtils.newSearchConfigEnabled ? CONFIG_V2 : CONFIG_DEFAULT
);
registerCleanupFunction(async () => {
let settingsWritten = SearchTestUtils.promiseSearchNotification(

View File

@ -21,6 +21,65 @@ const CONFIG_DEFAULT = [
},
];
const CONFIG_V2 = [
{
recordType: "engine",
identifier: "basic",
base: {
name: "basic",
urls: {
search: {
base: "https://example.com",
searchTermParamName: "q",
},
trending: {
base: "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs",
method: "GET",
},
},
aliases: ["basic"],
},
variants: [
{
environment: { allRegionsAndLocales: true },
},
],
},
{
recordType: "engine",
identifier: "private",
base: {
name: "private",
urls: {
search: {
base: "https://example.com",
searchTermParamName: "q",
},
suggestions: {
base: "https://example.com",
method: "GET",
searchTermParamName: "search",
},
},
aliases: ["private"],
},
variants: [
{
environment: { allRegionsAndLocales: true },
},
],
},
{
recordType: "defaultEngines",
globalDefault: "basic",
specificDefaults: [],
},
{
recordType: "engineOrders",
orders: [],
},
];
add_setup(async () => {
await SpecialPowers.pushPrefEnv({
set: [
@ -39,7 +98,10 @@ add_setup(async () => {
});
await UrlbarTestUtils.formHistory.clear();
await SearchTestUtils.setupTestEngines("search-engines", CONFIG_DEFAULT);
await SearchTestUtils.setupTestEngines(
"search-engines",
SearchUtils.newSearchConfigEnabled ? CONFIG_V2 : CONFIG_DEFAULT
);
registerCleanupFunction(async () => {
await UrlbarTestUtils.formHistory.clear();