Closed Bug 987596 Opened 10 years ago Closed 10 years ago

B2G NFC: Marionette tests for onpeerready

Categories

(Firefox OS Graveyard :: NFC, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(tracking-b2g:backlog)

RESOLVED FIXED
2.0 S1 (9may)
tracking-b2g backlog

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

Details

(Whiteboard: [p=2])

Attachments

(1 file, 2 obsolete files)

We need a marionette test case for testing onpeerready.
blocking-b2g: --- → backlog
Attached patch Patch (obsolete) — Splinter Review
Attachment #8412527 - Flags: review?(dlee)
Comment on attachment 8412527 [details] [diff] [review]
Patch

Review of attachment 8412527 [details] [diff] [review]:
-----------------------------------------------------------------

Pass local marionette test case.

::: dom/nfc/tests/marionette/test_nfc_peer.js
@@ +5,5 @@
> +MARIONETTE_HEAD_JS = 'head.js';
> +
> +let MANIFEST_URL = "app://system.gaiamobile.org/manifest.webapp";
> +let Promise =
> +  SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise;

I think we could move Promise to head.js because more and more testcases will use it in the future.

@@ +12,5 @@
> +function testPeerReady(evt) {
> +  log("testPeerReady called");
> +  let peer = nfc.getNFCPeer(evt.detail);
> +  ok(peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
> +  runNextTest();

Should we call toggleNFC(false, runNextTest);  ?

@@ +29,5 @@
> +  }
> +
> +  request.onerror = function () {
> +    ok(false, "checkP2PRegistration failed.");
> +    runNextTest();

ditto.

@@ +38,5 @@
> +  let deferred = Promise.defer();
> +  let cmd = "nfc ntf rf_intf_activated " + re;
> +
> +  emulator.run(cmd, function(result) {
> +    is(result.pop(), "OK", "check activation of RE0");

We should use is(result.pop(), "OK", "check activation of RE" + re);
Please also help modify test_nfc_manager_tech_discovered.js, thanks

@@ +56,5 @@
> +  });
> +}
> +
> +let tests = [
> +  testActivateRE0

Naming of this testcase seems not match what we are going to test ?
Attachment #8412527 - Flags: review?(dlee)
Attached patch Patch v2. (obsolete) — Splinter Review
addressed Dimi's comments.
Attachment #8412527 - Attachment is obsolete: true
Comment on attachment 8413622 [details] [diff] [review]
Patch v2.

Review of attachment 8413622 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for code refine, could you also help remove import Promise in test_nfc_manager_tech_discovered.js.
r+ with nits fixed

::: dom/nfc/tests/marionette/test_nfc_manager_tech_discovered.js
@@ +23,5 @@
>    let deferred = Promise.defer();
>    let cmd = 'nfc ntf rf_intf_activated ' + re;
>  
>    emulator.run(cmd, function(result) {
> +    is(result.pop(), 'OK', 'check activation of RE0' + re);

Nits, Remove 0  from RE0

::: dom/nfc/tests/marionette/test_nfc_peer.js
@@ +39,5 @@
> +  let deferred = Promise.defer();
> +  let cmd = "nfc ntf rf_intf_activated " + re;
> +
> +  emulator.run(cmd, function(result) {
> +    is(result.pop(), "OK", "check activation of RE0" + re);

Nits. Remove 0 from RE0
Attachment #8413622 - Flags: review+
Attached patch Patch v3.Splinter Review
Attachment #8413622 - Attachment is obsolete: true
Comment on attachment 8413635 [details] [diff] [review]
Patch v3.

Review of attachment 8413635 [details] [diff] [review]:
-----------------------------------------------------------------

Addressed Comment 4.
Also move declaration of nfc into head.js. r? for this change.
Attachment #8413635 - Flags: review?(dlee)
Attachment #8413635 - Flags: review?(dlee) → review+
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.