mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1730218 - Fix suggest_url in policies. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D131291
This commit is contained in:
parent
4c184ca81b
commit
342e6a407b
@ -1962,7 +1962,7 @@ var Policies = {
|
||||
newEngine.Method == "POST"
|
||||
? newEngine.PostData
|
||||
: undefined,
|
||||
suggestUrlGetParams: newEngine.SuggestURLTemplate,
|
||||
suggest_url: newEngine.SuggestURLTemplate,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -349,7 +349,7 @@ add_task(async function test_install_with_encoding() {
|
||||
is(
|
||||
Services.search.getEngineByName("Encoding"),
|
||||
null,
|
||||
'Engine "Foo" should not be present when test starts'
|
||||
'Engine "Encoding" should not be present when test starts'
|
||||
);
|
||||
|
||||
await setupPolicyEngineWithJson({
|
||||
@ -430,3 +430,41 @@ add_task(async function test_install_and_update() {
|
||||
await Services.search.removeEngine(engine);
|
||||
EnterprisePolicyTesting.resetRunOnceState();
|
||||
});
|
||||
|
||||
add_task(async function test_install_with_suggest() {
|
||||
// Make sure we are starting in an expected state to avoid false positive
|
||||
// test results.
|
||||
is(
|
||||
Services.search.getEngineByName("Suggest"),
|
||||
null,
|
||||
'Engine "Suggest" should not be present when test starts'
|
||||
);
|
||||
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
SearchEngines: {
|
||||
Add: [
|
||||
{
|
||||
Name: "Suggest",
|
||||
URLTemplate: "http://example.com/?q={searchTerms}",
|
||||
SuggestURLTemplate: "http://suggest.example.com/?q={searchTerms}",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
// Get in line, because the Search policy callbacks are async.
|
||||
await TestUtils.waitForTick();
|
||||
|
||||
let engine = Services.search.getEngineByName("Suggest");
|
||||
|
||||
is(
|
||||
engine.getSubmission("test", "application/x-suggestions+json").uri.spec,
|
||||
"http://suggest.example.com/?q=test",
|
||||
"Updated Submission URL should be correct."
|
||||
);
|
||||
|
||||
// Clean up
|
||||
await Services.search.removeEngine(engine);
|
||||
EnterprisePolicyTesting.resetRunOnceState();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user