Extend SearchTestUtils utility functions to provide options for automatically setting an installed engine as default
Categories
(Firefox :: Search, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox109 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
Details
Attachments
(3 files)
In working on a different bug that was changing the setDefault
and setDefaultPrivate
interfaces, I realised that we have a lot of boilerplate in tests along the lines of:
let originalEngine = await Services.search.getDefault
await SearchTestUtils.installSearchExtension(...);
const defaultEngine = Services.search.getEngineByName("Example");
await Services.search.setDefault(defaultEngine);
registerCleanupFunction(async => {
await Services.search.setDefault(originalEngine);
});
Generally the purpose of this is to set an alternative engine as default for use in the tests - for suggestions or other reasons.
If we added an additional argument to the various install functions to set the engine as default, we could avoid most of this boilerplate. We may also be able to use resetToAppDefaultEngine
in the cleanup function.
Assignee | ||
Comment 1•7 months ago
|
||
Try push (from before I restructured the patches slightly): https://treeherder.mozilla.org/jobs?repo=try&revision=2c4adb78cf88218d4850a51f9633a5407e107c05
Assignee | ||
Comment 2•7 months ago
|
||
Assignee | ||
Comment 3•7 months ago
|
||
and convert existing would-be-broken consumers to use the new format arguments
Depends on D161043
Assignee | ||
Comment 4•7 months ago
|
||
Depends on D161044
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Assignee | ||
Comment 5•7 months ago
|
||
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e20401f6948b Add set as default (private) search engine options to SearchTestUtils.promiseNewSearchEngine. r=mcheang https://hg.mozilla.org/integration/autoland/rev/182ff17fa508 Add set as default (private) search engine options to SearchTestUtils.installSearchExtension. r=mcheang https://hg.mozilla.org/integration/autoland/rev/4c5648a82120 Use setAsDefault* parameters where appropriate for consumers of SearchTestUtils.installSearchExtension. r=mcheang
Comment 7•7 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e20401f6948b
https://hg.mozilla.org/mozilla-central/rev/182ff17fa508
https://hg.mozilla.org/mozilla-central/rev/4c5648a82120
Description
•