Replace addEngineWithDetails in xpcshell-tests
Categories
(Firefox :: Search, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox88 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
Details
(Whiteboard: [lang=js])
Attachments
(4 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
Bug 1687932 - Remove use of nsISearchEngine.addEngineWithDetails from other xpcshell-tests. r?harry!
(deleted),
text/x-phabricator-request
|
Details |
I'm willing to mentor this bug, but if it is your first time here then I suggest you do a good-first-bug first - find them via Codetribute.
We're working on removing addEngineWithDetails
(bug 1649186). As part of that, we want to replace the calls in tests with a newer test specific function.
For this bug, we'll concentrate on the instances in toolkit/components/search/tests/xpcshell/
Note: the tests beginning with test_addEngineWith
can be ignored since they are testing the actual function, and hence will be removed later.
Here's an example of the new code that uses SearchTestUtils.installSearchExtension
: https://searchfox.org/mozilla-central/rev/1ebc9745be02eebf7a694f5c527a44a045b8c97a/toolkit/components/search/tests/xpcshell/test_notifications.js#103-106,112
SearchTestUtils.installSearchExtension
has various options that are described here: https://searchfox.org/mozilla-central/rev/1ebc9745be02eebf7a694f5c527a44a045b8c97a/toolkit/components/search/tests/SearchTestUtils.jsm#223-247
The extension must be unloaded at the end of the test. If the test covers several add_task
functions, then it can be unloaded in a separate add_task
at the end, e.g.
add_task(async function cleanup() {
extension.unload();
});
Comment 1•4 years ago
|
||
Hi Mark,
I want to solve this bug.
Thanks
Abhishek
Assignee | ||
Comment 2•4 years ago
|
||
HI Abhishek, sure please go ahead.
Comment 3•4 years ago
|
||
Thanks Mark
Comment 4•4 years ago
|
||
Hi mark,
Can you explain it. I open both the files.
Assignee | ||
Comment 5•4 years ago
|
||
For this bug, we'll concentrate on the instances in toolkit/components/search/tests/xpcshell/
The instances listed here in test_*
files are the ones you need to fix. You can skip the test_addEngineWith*
files as they'll be removed later.
You need to replace the calls to addEngineWithDetails with similar calls to those which I highlighted in the test_notifications.js file, i.e. SearchTestUtils.installSearchExtension
, await extension.awaitStartup();
and await extension.unload();
at the end of the test. For the unload you need to take into account this:
The extension must be unloaded at the end of the test. If the test covers several
add_task
functions, then it can be unloaded in a separateadd_task
at the end, e.g.add_task(async function cleanup() { extension.unload(); });
I forgot to say, once built, you can run the tests with:
./mach xpcshell-test path/to/test
You shouldn't need to re-build when changing the test files.
Also check ./mach eslint toolkit/components/search
passes before you submit patches.
Assignee | ||
Comment 6•4 years ago
|
||
Please also skip the toolkit/components/search/tests/xpcshell/test_migrateWebExtensionEngine.js
test. I've just noticed that test needs a different mechanism as it is not currently testing the right thing. Since I'm handling that in another bug, there's no point in you changing it here as well.
Comment 7•4 years ago
|
||
ok
Abhishek
Assignee | ||
Comment 8•4 years ago
|
||
Hi Abhishek, are you still working on this?
Comment 9•4 years ago
|
||
Yes I am active on this bug. Today I submit my patch.
Abhishek
Assignee | ||
Comment 10•4 years ago
|
||
Hi Abhishek, thank you for confirming. Just to let you know I'm probably going to need this bug fixed sometime in the next 2 to 4 weeks. We've some changes coming and it'd be easier to have this landed to be able to make those. I don't want to put pressure on you though, we can find alternate bugs if you need.
Assignee | ||
Comment 11•4 years ago
|
||
Unfortunately I've not heard back from Abhishek, and I need to progress this bug, so I'm going to take it on.
Abhishek: if you want more bugs like this in future let me know and I'll be quite happy to find you something.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 12•4 years ago
|
||
Depends on D108458
Assignee | ||
Comment 13•4 years ago
|
||
Also remove addEngineWithDetails from test_TelemetryEnvironment_search.js to help resolve issues following the cleaning up SearchTestUtils.jsm.
Depends on D108459
Assignee | ||
Comment 14•4 years ago
|
||
Depends on D108460
Assignee | ||
Comment 15•4 years ago
|
||
Depends on D108461
Assignee | ||
Comment 16•4 years ago
|
||
Assignee | ||
Comment 17•4 years ago
|
||
Updated try push: https://treeherder.mozilla.org/jobs?repo=try&revision=1466a913f87d8014792ce323a2ae4a7d8aac1c15
Comment 18•4 years ago
|
||
Comment 19•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/33a8c6623c60
https://hg.mozilla.org/mozilla-central/rev/cfa47554d8c5
https://hg.mozilla.org/mozilla-central/rev/8f5707df7bad
https://hg.mozilla.org/mozilla-central/rev/838ed2321e07
Description
•