Closed
Bug 1190325
Opened 9 years ago
Closed 9 years ago
Test coverage for runtime extension API
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(firefox48 fixed)
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: gkrizsanits, Assigned: bsilverberg)
References
Details
(Whiteboard: [berlin][good first bug])
Attachments
(1 file)
Comment 1•9 years ago
|
||
This is still missing coverage for:
* The |onStartup| event.
* The 2-4 arg forms of the |sendMessage| API method.
* The |sendMessage| and |connect| API methods with an explicit |extensionId| property.
* The |getManifest| method.
https://people.mozilla.org/~kmaglione/webextension-test-coverage/toolkit/components/extensions/ext-runtime.js.html
Updated•9 years ago
|
Component: Extension Compatibility → WebExtensions
Product: Firefox → Toolkit
Updated•9 years ago
|
Flags: blocking-webextensions-
Updated•9 years ago
|
Flags: blocking-webextensions- → blocking-webextensions+
Updated•9 years ago
|
Whiteboard: [berlin]
Updated•9 years ago
|
Whiteboard: [berlin] → [berlin][good first bug]
Updated•9 years ago
|
Assignee: nobody → bob.silverberg
Assignee | ||
Updated•9 years ago
|
Iteration: --- → 48.3 - Apr 18
Assignee | ||
Comment 2•9 years ago
|
||
Looking at the most recent coverage report at [1], it looks like now we are only missing coverage for:
* The |onStartup| event.
* The |openOptionsPage| method when |options_ui| is missing from the manifest.
I will start working on those.
[1] https://people.mozilla.org/~kmaglione/webextension-test-coverage/toolkit/components/extensions/ext-runtime.js.html
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•9 years ago
|
||
Oh, also:
* The |openOptionsPage| method when there is no browser window. (from [2], assuming that is also meant to be covered by this bug)
[2] https://people.mozilla.org/~kmaglione/webextension-test-coverage/browser/components/extensions/ext-desktop-runtime.js.html
Assignee | ||
Comment 4•9 years ago
|
||
Add coverage for:
* The |openOptionsPage| method when |options_ui| is missing from the manifest.
* The |openOptionsPage| method when there is no browser window.
* The |onStartup| event.
Review commit: https://reviewboard.mozilla.org/r/44579/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/44579/
Attachment #8738557 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 5•9 years ago
|
||
https://reviewboard.mozilla.org/r/44579/#review41301
::: browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js:261
(Diff revision 1)
> +
> + yield extension.awaitFinish("options-no-manifest");
> + yield extension.unload();
> +});
> +
> +add_task(function* test_options_no_window() {
Note: This test "works" in that all the assertions pass, but it causes a problem for the test runner at the end of the test when the window is closed. Do you have any suggestions for testing this error condition and also not breaking the test runner?
::: toolkit/components/extensions/schemas/runtime.json
(Diff revision 1)
> }
> ],
> "events": [
> {
> "name": "onStartup",
> - "unsupported": true,
I discovered that `onStartup` is currently labelled `unsupported` and our docs concur with this. I assume, as the code exists and it's listed as needing coverage, that that is an error and this really should be listed as supported, which is why I made this change.
::: toolkit/components/extensions/test/mochitest/test_ext_runtime_onstartup.html:20
(Diff revision 1)
> +
> +add_task(function* test_onstartup() {
> + function background() {
> + browser.runtime.onStartup.addListener(function listener() {
> + browser.runtime.onStartup.removeListener(listener);
> + browser.test.notifyPass("runtime.onstartup");
This doesn't work. The listener never gets called, which doesn't surprise me as the docs suggest that this will get called when a profile is loaded which already includes the extension. I am submitting this as what I've done thus far, so comments can be added. Is there a way to create a profile that contains the test extension and then load that into a running instance of Firefox in order to test this functionality?
Comment 6•9 years ago
|
||
https://reviewboard.mozilla.org/r/44579/#review41301
> Note: This test "works" in that all the assertions pass, but it causes a problem for the test runner at the end of the test when the window is closed. Do you have any suggestions for testing this error condition and also not breaking the test runner?
I'd say skip it for now. The only sensible way I can think of doing this is to use an xpcshell test, but they're not allowed to actually open windows.
> I discovered that `onStartup` is currently labelled `unsupported` and our docs concur with this. I assume, as the code exists and it's listed as needing coverage, that that is an error and this really should be listed as supported, which is why I made this change.
There's some skeleton code, but it's not really supported.
> This doesn't work. The listener never gets called, which doesn't surprise me as the docs suggest that this will get called when a profile is loaded which already includes the extension. I am submitting this as what I've done thus far, so comments can be added. Is there a way to create a profile that contains the test extension and then load that into a running instance of Firefox in order to test this functionality?
No profile is necessary. The problem is that the event currently doesn't work.
Updated•9 years ago
|
Attachment #8738557 -
Flags: review?(kmaglione+bmo)
Comment 7•9 years ago
|
||
Comment on attachment 8738557 [details]
MozReview Request: Bug 1190325 - Test coverage for runtime extension API, r?kmag
https://reviewboard.mozilla.org/r/44579/#review41411
The no manifest test looks good, but I think we're going to have to live without the other two for now.
::: browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js:299
(Diff revision 1)
> +
> + let {WindowManager} = Cu.import("resource://gre/modules/Extension.jsm", {});
> +
> + let window = WindowManager.topWindow;
> + yield extension.awaitMessage("ready");
> + yield BrowserTestUtils.closeWindow(window);
We can't close the initial browser window in browser chrome tests.
::: toolkit/components/extensions/test/mochitest/mochitest.ini:52
(Diff revision 1)
> skip-if = (os == 'android' || buildapp == 'b2g') # port.sender.tab is undefined on b2g. Bug 1258975 on android.
> [test_ext_runtime_connect2.html]
> skip-if = (os == 'android' || buildapp == 'b2g') # port.sender.tab is undefined on b2g. Bug 1258975 on android.
> [test_ext_runtime_disconnect.html]
> [test_ext_runtime_getPlatformInfo.html]
> +[test_ext_runtime_onstartup.html]
`onStartup` is not currently implemented.
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8738557 [details]
MozReview Request: Bug 1190325 - Test coverage for runtime extension API, r?kmag
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44579/diff/1-2/
Attachment #8738557 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 9•9 years ago
|
||
Assignee | ||
Comment 10•9 years ago
|
||
Kris, in your comments it sounds like you've signed off on this (with only the one test included), but it's still awaiting an official r+. Once that's done it's ready for check in.
Flags: needinfo?(kmaglione+bmo)
Comment 11•9 years ago
|
||
Comment on attachment 8738557 [details]
MozReview Request: Bug 1190325 - Test coverage for runtime extension API, r?kmag
https://reviewboard.mozilla.org/r/44579/#review41583
Attachment #8738557 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 12•9 years ago
|
||
Keywords: checkin-needed
Comment 13•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Updated•9 years ago
|
Flags: needinfo?(kmaglione+bmo)
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•