Closed
Bug 915884
Opened 11 years ago
Closed 11 years ago
Add tests for Inter-App Communication API
Categories
(Core :: DOM: Device Interfaces, defect, P1)
Core
DOM: Device Interfaces
Tracking
()
RESOLVED
FIXED
mozilla31
People
(Reporter: airpingu, Assigned: airpingu)
References
()
Details
Attachments
(5 files, 15 obsolete files)
(deleted),
text/html
|
squib
:
review+
ferjm
:
review+
|
Details |
(deleted),
image/png
|
Details | |
(deleted),
patch
|
ferjm
:
review+
airpingu
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
airpingu
:
review+
airpingu
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
airpingu
:
review+
airpingu
:
checkin+
|
Details | Diff | Splinter Review |
We need to add tests for Inter-App Communication API. This is definitely the first priority.
Flags: in-testsuite+
This needs fixing fast. And I though in-testsuite+ was set after we actually had tests. Correct?
Assignee | ||
Comment 2•11 years ago
|
||
Thanks for bringing this to my attention. I've been kept interrupted by other V1.3 features in the past month. Mark this as V1.3 to push myself to finish this...
blocking-b2g: --- → 1.3?
Comment 3•11 years ago
|
||
(In reply to Gene Lian [:gene] (needinfo? encouraged) from comment #2)
> Thanks for bringing this to my attention. I've been kept interrupted by
> other V1.3 features in the past month. Mark this as V1.3 to push myself to
> finish this...
Tests don't ever block the release. However, please definitely look into this at a high priority. We definitely need to have basic mochitests for every new WebAPI introduced.
Clearing in-testsuite+ as that's only set after a patch lands with tests.
blocking-b2g: 1.3? → ---
Flags: in-testsuite+
Assignee | ||
Comment 4•11 years ago
|
||
Assignee | ||
Comment 5•11 years ago
|
||
Assignee | ||
Comment 6•11 years ago
|
||
Will work out marionette test to test API level as well.
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #8340923 -
Attachment is obsolete: true
Assignee | ||
Comment 8•11 years ago
|
||
Attachment #8342960 -
Attachment is obsolete: true
Assignee | ||
Comment 9•11 years ago
|
||
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8345823 -
Attachment is obsolete: true
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #8345827 -
Attachment is obsolete: true
Assignee | ||
Comment 12•11 years ago
|
||
Add tests for getConnections() and cancel().
Attachment #8345837 -
Attachment is obsolete: true
Assignee | ||
Comment 13•11 years ago
|
||
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8340922 -
Attachment is obsolete: true
Attachment #8397073 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 15•11 years ago
|
||
Attachment #8343638 -
Attachment is obsolete: true
Attachment #8397074 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 16•11 years ago
|
||
Attachment #8346341 -
Attachment is obsolete: true
Attachment #8397075 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 17•11 years ago
|
||
Attachment #8346340 -
Attachment is obsolete: true
Attachment #8397078 -
Flags: review?(squibblyflabbetydoo)
Attachment #8397078 -
Flags: feedback?(nsm.nikhil)
Assignee | ||
Comment 18•11 years ago
|
||
Hi Nikhil,
Part 1-3 patches are aimed to test the the main functions in InterAppCommService. To do so, I extract the InterAppCommService.jsm which can be applied on the xpcshell tests. This test can cover most of the main logic in receiveMessage() to ensure no one will mess up any existing internal logic in IAC.
To test the complete API usage, IPC flow and apps' manifest registration, I make the part 4 patch based on the Gaia UI Marionette API tests which can be tested on the try server as well.
Assignee | ||
Comment 19•11 years ago
|
||
Hi Jim,
I make the part 4 patch based on the Gaia UI Marionette tests which can verify the correctness of IAC APIs, including connect(), getConnections() and cancel(). This test will run on a real UI which cannot only be automatically tested by Marionette but can also be tested manually.
Please refer to the screen shot. The users can type some messages in the field and send it from the publisher app. Then it will wake up another subscriber app (via system message) which will directly echo the same message back to the publisher. The python test will check if the returned message matches the original one we just sent.
Could you please take the review or pass it to someone who is suitable to review this? Thanks!
I don't think I'm the right person to review these tests. I don't have any IAC experience as an implementor or developer. Maybe :ferjm or someone on Gaia actually using it?
Assignee | ||
Comment 21•11 years ago
|
||
Sure. Thanks Nikhil and sorry for delaying this for a long time.
Assignee | ||
Comment 22•11 years ago
|
||
Comment on attachment 8397073 [details] [diff] [review]
Part 1, create InterAppCommService.jsm
Please see comment #18.
Attachment #8397073 -
Flags: review?(nsm.nikhil) → review?(ferjmoreno)
Assignee | ||
Comment 23•11 years ago
|
||
Comment on attachment 8397074 [details] [diff] [review]
Part 2, xpcshell tests for InterAppCommService.jsm
Please see comment #18.
Attachment #8397074 -
Flags: review?(nsm.nikhil) → review?(ferjmoreno)
Assignee | ||
Comment 24•11 years ago
|
||
Comment on attachment 8397075 [details] [diff] [review]
Part 3, clean up the alignment
Please see comment #18.
Attachment #8397075 -
Flags: review?(nsm.nikhil) → review?(ferjmoreno)
Assignee | ||
Comment 25•11 years ago
|
||
Comment on attachment 8397078 [details]
Part 4, Gaia UI Marionette tests for APIs
Please see comment #19.
Attachment #8397078 -
Flags: feedback?(nsm.nikhil) → review?(ferjmoreno)
Comment 26•11 years ago
|
||
Sorry for the delay here, I've been traveling the whole week. I'll get to this on Monday.
Comment 27•11 years ago
|
||
Comment on attachment 8397073 [details] [diff] [review]
Part 1, create InterAppCommService.jsm
Review of attachment 8397073 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks Gene!
I was wondering if we could clean this up a little more and get rid of nsIInterAppCommService and InterAppCommService.js. I can't see the reason for it to be an XPCOM component. We can just use InterAppCommService.jsm and lazy get it from Webapps.jsm. It seems that we are only using it there.
::: dom/apps/src/InterAppCommService.js
@@ +3,5 @@
> * You can obtain one at http://mozilla.org/MPL/2.0/. */
>
> "use strict";
>
> const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
'Cc' and 'Cr' are not used anymore.
::: dom/apps/src/InterAppCommService.jsm
@@ +42,5 @@
> "child-process-shutdown"];
>
> +this.InterAppCommService = {
> +
> +// For the convenience of review, will align init() by a follow-up patch.
Thanks :)
Attachment #8397073 -
Flags: review?(ferjmoreno)
Updated•11 years ago
|
Attachment #8397075 -
Flags: review?(ferjmoreno) → review+
Comment 28•11 years ago
|
||
Comment on attachment 8397074 [details] [diff] [review]
Part 2, xpcshell tests for InterAppCommService.jsm
Review of attachment 8397074 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/apps/tests/unit/test_inter_app_comm_service.js
@@ +1,4 @@
> +/* Any copyright is dedicated to the Public Domain.
> + http://creativecommons.org/publicdomain/zero/1.0/ */
> +
> +const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
'Cr' is never used.
@@ +3,5 @@
> +
> +const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
> +
> +Cu.import("resource://gre/modules/InterAppCommService.jsm");
> +Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Do we need to import 'XPCOMUtils'?
@@ +195,5 @@
> + create_message_port_pair(MESSAGE_PORT_ID,
> + KEYWORD,
> + PUB_APP_MANIFEST_URL,
> + SUB_APP_MANIFEST_URL);
> +
nit: white space
@@ +204,5 @@
> + do_check_eq(PUB_APP_PAGE_URL, messagePortPair.publisher.pageURL);
> + do_check_eq(SUB_APP_PAGE_URL, messagePortPair.subscriber.pageURL);
> +
> + do_check_true(targets.pubTarget === messagePortPair.publisher.target);
> + do_check_true(targets.subTarget === messagePortPair.subscriber.target);
I think you can use do_check_eq also here.
@@ +225,5 @@
> + === undefined);
> +
> + clear_message_port_pairs();
> + run_next_test();
> +});
Can we also test registering/unregistering a message port with wrong ID/manifestURL?
Attachment #8397074 -
Flags: review?(ferjmoreno) → review+
Comment 29•11 years ago
|
||
Comment on attachment 8397078 [details]
Part 4, Gaia UI Marionette tests for APIs
Thanks Gene!
The test looks good.
It would be great if we could play a little bit with the connection 'rules' in both publisher and subscriber. We can probably add different types of apps (probably with 'role': 'system' for the ones that don't require UI) and check that the connection success/fails depending on the connection rules. Right now we are only testing the successful connection path.
Attachment #8397078 -
Flags: review?(ferjmoreno) → feedback+
Assignee | ||
Comment 30•11 years ago
|
||
Attachment #8397073 -
Attachment is obsolete: true
Attachment #8406777 -
Flags: review?(ferjmoreno)
Assignee | ||
Comment 31•11 years ago
|
||
(In reply to Fernando Jiménez Moreno [:ferjm] from comment #28)
> > + do_check_true(targets.pubTarget === messagePortPair.publisher.target);
> > + do_check_true(targets.subTarget === messagePortPair.subscriber.target);
>
> I think you can use do_check_eq also here.
do_check_eq(a, b) is using "==" to compare. I hope to have a stricter comparison. ;)
Assignee | ||
Comment 32•11 years ago
|
||
Fixed comment #28 and add two more tests:
test_failToRegisterMessagePort
test_failToUnregisterMessagePort
Carry on r=ferjm. Thank you for the review!
Attachment #8397074 -
Attachment is obsolete: true
Attachment #8406793 -
Flags: review+
Assignee | ||
Comment 33•11 years ago
|
||
Carry on r=ferjm. Thanks for the review!
Attachment #8397075 -
Attachment is obsolete: true
Attachment #8406794 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Blocks: inter-app-comm-api
No longer depends on: inter-app-comm-api
Comment 34•11 years ago
|
||
Comment on attachment 8406777 [details] [diff] [review]
Part 1, create InterAppCommService.jsm, V2
Review of attachment 8406777 [details] [diff] [review]:
-----------------------------------------------------------------
Yay! No XPCOM :) Thanks Gene!
Attachment #8406777 -
Flags: review?(ferjmoreno) → review+
Comment 35•11 years ago
|
||
Comment on attachment 8397078 [details]
Part 4, Gaia UI Marionette tests for APIs
This seems good to me. However, you should probably remove the unnecessary permissions for the test apps. r=me with that change.
Attachment #8397078 -
Flags: review?(squibblyflabbetydoo) → review+
Assignee | ||
Comment 36•11 years ago
|
||
Hi Fernando, please the e-mail for why I add the IDL back. ;)
Attachment #8406777 -
Attachment is obsolete: true
Attachment #8408826 -
Flags: review?(ferjmoreno)
Assignee | ||
Comment 37•11 years ago
|
||
Rebased.
Attachment #8406793 -
Attachment is obsolete: true
Attachment #8408827 -
Flags: review+
Assignee | ||
Comment 38•11 years ago
|
||
Rebased.
Attachment #8406794 -
Attachment is obsolete: true
Attachment #8408828 -
Flags: review+
Updated•11 years ago
|
Attachment #8408826 -
Flags: review?(ferjmoreno) → review+
Assignee | ||
Comment 39•11 years ago
|
||
I'd like land the Gecko tests first. Gaia UI Test needs to be polished according comment #29.
https://hg.mozilla.org/integration/b2g-inbound/rev/223ae5cffe53
https://hg.mozilla.org/integration/b2g-inbound/rev/991793077944
https://hg.mozilla.org/integration/b2g-inbound/rev/1b88876e6eaf
Please leave this bug open.
Keywords: leave-open
Assignee | ||
Updated•11 years ago
|
Flags: in-testsuite+
Comment 40•11 years ago
|
||
Assignee | ||
Comment 41•11 years ago
|
||
Comment on attachment 8397078 [details]
Part 4, Gaia UI Marionette tests for APIs
Add more tests for the error path of doing IAC connection.
Attachment #8397078 -
Flags: feedback+ → review?(ferjmoreno)
Comment 42•11 years ago
|
||
Comment on attachment 8397078 [details]
Part 4, Gaia UI Marionette tests for APIs
Thanks Gene!
Attachment #8397078 -
Flags: review?(ferjmoreno) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #8408826 -
Flags: checkin+
Assignee | ||
Updated•11 years ago
|
Attachment #8408827 -
Flags: checkin+
Assignee | ||
Updated•11 years ago
|
Attachment #8408828 -
Flags: checkin+
Assignee | ||
Updated•11 years ago
|
Keywords: leave-open → checkin-needed
Whiteboard: Only need to land part-4 patch from Gaia's PR
Comment 43•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
status-b2g-v2.0:
--- → fixed
status-firefox31:
--- → fixed
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: Only need to land part-4 patch from Gaia's PR
Target Milestone: --- → mozilla31
You need to log in
before you can comment on or make changes to this bug.
Description
•