Improve extension testing framework for GeckoView to not require useAddonManager in ExtensionTestUtils.loadExtension
Categories
(WebExtensions :: Android, enhancement, P2)
Tracking
(firefox94 fixed)
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
ExtensionTestUtils.loadExtension
is used to load extensions in tests. Many extension tests on desktop (and Fennec) did not depend on the addon manager, so to reduce the overhead in tests, the utility generates an add-on without addon manager by default. useAddonManager
is only used in tests where the addon manager is significant.
In GeckoView, various UI-related APIs (tabs, browserAction, pageAction) only work when the extension has been registered via the Addon Manager. Unfortunately, this results in lots of boilerplate in extension tests, where every test that uses UI on Android includes useAddonManager: "permanent"
plus an extension ID, see e.g. bug 1615329 and bug 1599580.
We should improve ExtensionTestUtils.loadExtension
(the mochitest one, not the one for xpcshell tests) to not require useAddonManager
for it to work.
There are several ways to do that. It could be done by adding useAddonManager
to every loadExtension
call on Android/GeckoView, by providing a minimal mock of the AddonWrapper from the addon manager internals, or maybe even modifying GeckoView internals to account for this.
Comment 1•4 years ago
|
||
I don't think there's much we can do on the GV side to circumvent that, I don't think a mock AddonManager
is worth either, unless we have a very compelling reason to do that.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
This patch introduces the androidBrowserTest option to offer an
alternative to adding a boilerplate useAddonManager + extension ID in
mochitests that use certain extension APIs.
Assignee | ||
Comment 3•3 years ago
|
||
The androidBrowserTest option of ExtensionTestUtils.loadExtension exists
to allow Android tests to correctly register with the AddonManager
without unnecessarily forcing this registration on desktop.
This patch replaces all unnecessary uses of useAddonManager with the
androidBrowserTest option, which is essentially the same but only
enables the "useAddonManager" option on Android. This is to make it more
obvious when a test really depends on the AddonManager (on desktop),
opposed to only depending on it indirectly as part of the GeckoView
implementation.
In some tests, useAddonManager was not used before because the test is
marked as skipped, but I've added the option regardless for the future.
Assignee | ||
Comment 4•3 years ago
|
||
In the past, add_task was generator-based, and tests were automatically
rewritten to use Promises. Some tests have weird constructs such as the
use of Promise.all+await or still using generators. These have been
fixed.
Some tests request the tabs permission without actually needing it.
This patch does not affect the behavior of the tests.
Assignee | ||
Comment 5•3 years ago
|
||
test_ext_tab_runtimeConnect.html can be re-enabled since bug 1534640 got fixed.
test_ext_tabs_reload.html had a race condition.
test_ext_tabs_reload_bypass_cache.html fix similar to bug 1335180.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/90d683f96928
https://hg.mozilla.org/mozilla-central/rev/ba58b88f06ff
https://hg.mozilla.org/mozilla-central/rev/2dc275e3cc0f
https://hg.mozilla.org/mozilla-central/rev/f5d6ae6aea44
Assignee | ||
Updated•2 years ago
|
Description
•