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•2 years ago
|
||
Try push (from before I restructured the patches slightly): https://treeherder.mozilla.org/jobs?repo=try&revision=2c4adb78cf88218d4850a51f9633a5407e107c05
Assignee | ||
Comment 2•2 years ago
|
||
Assignee | ||
Comment 3•2 years ago
|
||
and convert existing would-be-broken consumers to use the new format arguments
Depends on D161043
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D161044
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
Comment 7•2 years 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
•