mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
2be5b63f29
From 84c328a6b61db42daa196f18e0f4113e1b74b2e8 Mon Sep 17 00:00:00 2001 --- dom/nfc/tests/marionette/test_ndef.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
/* 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();
|
|
is(r.tnf, "empty", "r.tnf should be 'empty'");
|
|
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");
|
|
|
|
ok(true);
|
|
} catch (e) {
|
|
ok(false, 'type, id or payload should be optional. error:' + e);
|
|
}
|
|
|
|
try {
|
|
new MozNDEFRecord({type: new Uint8Array(1)});
|
|
ok(false, "new MozNDEFRecord should fail, type should be null for empty tnf");
|
|
} catch (e){
|
|
ok(true);
|
|
}
|
|
|
|
try {
|
|
new MozNDEFRecord({tnf: "unknown", type: new Uint8Array(1)});
|
|
ok(false, "new MozNDEFRecord should fail, type should be null for unknown tnf");
|
|
} catch (e){
|
|
ok(true);
|
|
}
|
|
|
|
try {
|
|
new MozNDEFRecord({tnf: "unchanged", type: new Uint8Array(1)});
|
|
ok(false, "new MozNDEFRecord should fail, type should be null for unchanged tnf");
|
|
} catch (e){
|
|
ok(true);
|
|
}
|
|
|
|
try {
|
|
new MozNDEFRecord({tnf: "illegal", type: new Uint8Array(1)});
|
|
ok(false, "new MozNDEFRecord should fail, invalid tnf");
|
|
} catch (e){
|
|
ok(true);
|
|
}
|
|
|
|
runNextTest();
|
|
}
|
|
|
|
let tests = [
|
|
testConstructNDEF
|
|
];
|
|
|
|
runTests();
|