Closed Bug 1023079 Opened 11 years ago Closed 10 years ago

[NFC] Emulator support for triggering tech-lost

Categories

(Firefox OS Graveyard :: NFC, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S5 (4july)

People

(Reporter: tauzen, Assigned: dimi)

References

Details

(Whiteboard: [p=2])

Attachments

(2 files, 3 obsolete files)

We need additional command in the emulator to trigger tech-lost notification [1],[2]. Currently we simulate this in marionette web-api tests by calling toggleNFC(false) which disables nfc. We should be able to trigger tech-lost while having nfc enabled to test real world scenarios. Once this will be solved a followup bug to fix the current tests will be required. [1] - https://github.com/mozilla/gecko-dev/blob/master/dom/system/gonk/nfc_consts.js#L45 [2] - https://github.com/mozilla/gecko-dev/blob/master/dom/system/gonk/nfc_worker.js#L390
Blocks: 986527, b2g-nfc
Assignee: nobody → dlee
Attachment #8449217 - Flags: review?(tzimmermann)
Attached patch Testcase v1 (obsolete) — Splinter Review
Attachment #8449219 - Flags: review?(tzimmermann)
Blocks: 1033218
Comment on attachment 8449217 [details] [diff] [review] Emulator support for triggering tech v1 Review of attachment 8449217 [details] [diff] [review]: ----------------------------------------------------------------- This looks very good, thank you. Just one trivial nit. ::: hw/nfc-nci.h @@ +465,5 @@ > NCI_RF_DEACT_IDLE_MODE = 0x00, > NCI_RF_DEACT_SLEEP_MODE = 0x01, > NCI_RF_DEACT_SLEEP_AF_MODE = 0x02, > + NCI_RF_DEACT_DISCOVERY = 0x03, > + NUMBER_OF_NCI_RF_DEACT_TYPE = 0x04 There shouldn't be an assignment here for NUMBER_OF_NCI_RF_DEACT_TYPE. These NUMBER_OF_ constants are not specified in the spec and should not have an assigned value. Let the compiler count. @@ +473,5 @@ > NCI_RF_DEACT_DH_REQUEST = 0x00, > NCI_RF_DEACT_ENDPOINT_REQUEST = 0x01, > NCI_RF_DEACT_RF_LINK_LOSS = 0x02, > + NCI_RF_DEACT_NFC_B_BAD_AFI = 0x03, > + NUMBER_OF_NCI_RF_DEACT_REASON = 0x04 Same as above.
Attachment #8449217 - Flags: review?(tzimmermann) → review+
Comment on attachment 8449219 [details] [diff] [review] Testcase v1 Review of attachment 8449219 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js @@ +15,5 @@ > + log('Received \'nfc-manager-tech-discovered\''); > + is(msg.type, 'techDiscovered', 'check for correct message type'); > + is(msg.techList[0], 'P2P', 'check for correct tech type'); > + > + emulator.deactivate(); This sounds like you're deactivating the emulator and we might want to find a general solution for this problem in another bug. The naming of all these helper functions is not pretty. Maybe we should move them into individual objects; one object per protocol (e.g., NCI.deactivate(), LLPC.connect(), SNEP.put(), etc.).
Attachment #8449219 - Flags: review?(tzimmermann) → review+
After I deactivated an RE, I could not activate it again in P2P mode, because there was no active RE, according to the error message. After deactivation, will the emulator be in IDLE state, or will nfcd switch it to DISCOVERY?
Status: NEW → ASSIGNED
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #5) > After I deactivated an RE, I could not activate it again in P2P mode, > because there was no active RE, according to the error message. After > deactivation, will the emulator be in IDLE state, or will nfcd switch it to > DISCOVERY? nfcd should reset it to discovery mode
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #4) > Comment on attachment 8449219 [details] [diff] [review] > Testcase v1 > > Review of attachment 8449219 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js > @@ +15,5 @@ > > + log('Received \'nfc-manager-tech-discovered\''); > > + is(msg.type, 'techDiscovered', 'check for correct message type'); > > + is(msg.techList[0], 'P2P', 'check for correct tech type'); > > + > > + emulator.deactivate(); > > This sounds like you're deactivating the emulator and we might want to find > a general solution for this problem in another bug. The naming of all these > helper functions is not pretty. Maybe we should move them into individual > objects; one object per protocol (e.g., NCI.deactivate(), LLPC.connect(), > SNEP.put(), etc.). Agree, I will create another bug and refine it.
Attachment #8449217 - Attachment is obsolete: true
Attachment #8450092 - Flags: review+
Attached patch Testcase v2Splinter Review
Attachment #8449219 - Attachment is obsolete: true
Attachment #8450718 - Flags: review+
Keywords: checkin-needed
Whiteboard: [p=2]
Target Milestone: --- → 2.0 S5 (4july)
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Comment on attachment 8450718 [details] [diff] [review] Testcase v2 Review of attachment 8450718 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js @@ +15,5 @@ > + log('Received \'nfc-manager-tech-discovered\''); > + is(msg.type, 'techDiscovered', 'check for correct message type'); > + is(msg.techList[0], 'P2P', 'check for correct tech type'); > + > + emulator.deactivate(); Dimi, I think you forgot to upload this function?
Attached patch Lost file for Testcase v2 (obsolete) — Splinter Review
Sorry after rebasing I forget add head.js to patch
Attachment #8451412 - Flags: review+
Keywords: checkin-needed
Comment on attachment 8451412 [details] [diff] [review] Lost file for Testcase v2 will do this in Bug 1035041
Attachment #8451412 - Attachment is obsolete: true
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: