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
Родитель 28cc482bb8
Коммит 37a87bf5c7
2 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

@ -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);