Closed
Bug 1002643
Opened 11 years ago
Closed 10 years ago
NfcHandoverManager unit tests.
Categories
(Firefox OS Graveyard :: NFC, defect)
Firefox OS Graveyard
NFC
Tracking
(tracking-b2g:backlog)
People
(Reporter: kamituel, Assigned: kamituel)
References
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36 Expected results: NfcHandoverManager lacks unit tests. Tests should assess that: - actions are queued properly while Bluetooth is disabled. - actions are executed after Bluetooth is turned on. - BT pairing and connection is performed when handleHandoverSelect() is called. - a couple more probably (ideas?) Draft for first two test cases is here: https://github.com/kamituel/gaia/commit/b23f8b20ac74f38e35c3f321b990328191afbe22
Assignee | ||
Updated•11 years ago
|
Summary: NfcHandoverManager queuing tests. → NfcHandoverManager unit tests.
Blocks: NFC-Gaia
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(alive)
Comment 1•11 years ago
|
||
To me the principle for writing tests for a module: function by function, figure out any combination of inputs and outputs for the function to be tested. * Have a clear function scope. * What's the possible input for this function? Test it. * What's the possible result after inputs? Test it.
Flags: needinfo?(alive)
Assignee | ||
Comment 2•11 years ago
|
||
@Alive, could you please assign me to this bug? (I can't do that myself, I don't have necessary Bugzilla permission yet)
Updated•11 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 5•11 years ago
|
||
In attachment, please find test cases for NfcHandoverManager. Test cases cover: - handover request/select - test whether, in positive scenario, NfcHandoverManager reacts correctly. This means it'll respond with handover select for incoming handover request, and it'll attempt to pair with peer device upon handover select. - when Bluetooth is on, whether actions are queued correctly and executed immediately after Bluetooth is turned on. - file transfer - test whether "nfc-manager-send-file" causes NfcHandoverManager to send handover request to peer device; similar for handover select. In addition to test cases existing already (by Arno), it should provide most important test cases for NfcHandoverManager (covering it's public API). While writing tests, I've also done some small refactoring, most notably I added CPS_* constants in nfc_utils.js / NDEF.
Attachment #8421854 -
Flags: review?(alive)
Comment 6•11 years ago
|
||
Comment on attachment 8421854 [details] Test cases for NfcHandoverManager. Please use https://github.com/mozilla-b2g/gaia/blob/master/shared/test/unit/mocks/mock_dom_request.js to implement all your dom request mocks before going further review.
Attachment #8421854 -
Flags: review?(alive)
Assignee | ||
Comment 7•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
I mark this for review, even though Travis build failed - I'm pretty confident failure wasn't caused by my commit. In fact, I've no idea what the error is, the only relevant message is:
"Error: The name org.freedesktop.UPower was not provided by any .service files"
Far, far from nfc ;)
Attachment #8421854 -
Flags: review?(alive)
Updated•10 years ago
|
blocking-b2g: --- → backlog
Comment 8•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
Needs some finetune
Attachment #8421854 -
Flags: review?(alive)
Assignee | ||
Comment 9•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
Fixed your remarks, @Alive. Thanks for the review :)
Oh, and Travis failed, here with message: "Waiting for server on port 8080 failed.". I think it's getting worse - is there some issue with Travis recently?
Attachment #8421854 -
Flags: review?(alive)
Comment 10•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
Please rebase and ask review again. Thanks and sorry being late.
Attachment #8421854 -
Flags: review?(alive)
Assignee | ||
Comment 11•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
Fixed your remarks and rebased.
Attachment #8421854 -
Flags: review?(alive)
Comment 12•10 years ago
|
||
Comment on attachment 8421854 [details]
Test cases for NfcHandoverManager.
r+ with one question on github. Please leave comments here.
Attachment #8421854 -
Flags: review?(alive) → review+
Assignee | ||
Updated•10 years ago
|
Whiteboard: checkin-needed
Assignee | ||
Comment 13•10 years ago
|
||
Alive, I've made MockBluetoothTransfer call NfcHandoverManager.transferComplete(true); to be able to test whether the whole process works, i.e. to see whether file transfer, when completed, will fire success on fileTransfer object.
Comment 14•10 years ago
|
||
master: https://github.com/mozilla-b2g/gaia/commit/832154d8dccb59ed575e4825bb3283fd1fed13f1
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: checkin-needed
Target Milestone: --- → 2.0 S3 (6june)
Updated•10 years ago
|
blocking-b2g: backlog → ---
tracking-b2g:
--- → backlog
You need to log in
before you can comment on or make changes to this bug.
Description
•