Bug 960510 - Part 2: marionette test for MozNDEFRecord. r=dimi, kyle

This commit is contained in:
"allstars.chh" 2014-02-17 11:10:26 +08:00
parent 79d040c848
commit 5e729db875
2 changed files with 38 additions and 0 deletions

View File

@ -3,5 +3,6 @@ b2g=true
browser=false
qemu=true
[test_ndef.js]
[test_nfc_enabled.js]
[test_nfc_manager_tech_discovered.js]

View File

@ -0,0 +1,37 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
MARIONETTE_HEAD_JS = 'head.js';
function testConstructNDEF() {
try {
// omit type, id and payload.
let r = new MozNDEFRecord(0x0);
is(r.type, null, "r.type should be null")
is(r.id, null, "r.id should be null")
is(r.payload, null, "r.payload should be null")
// omit id and payload.
r = new MozNDEFRecord(0x0, new Uint8Array());
is(r.id, null, "r.id should be null")
is(r.payload, null, "r.payload should be null")
// omit payload.
r = new MozNDEFRecord(0x0, new Uint8Array(), new Uint8Array());
is(r.payload, null, "r.payload should be null")
ok(true);
} catch (e) {
ok(false, 'type, id or payload should be optional. error:' + e);
}
runNextTest();
}
let tests = [
testConstructNDEF
];
SpecialPowers.pushPermissions(
[{'type': 'settings', 'allow': true, 'context': document}], runTests);