dom/nfc/tests/marionette/test_ndef.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/nfc/tests/marionette/test_ndef.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +MARIONETTE_TIMEOUT = 30000;
     1.8 +MARIONETTE_HEAD_JS = 'head.js';
     1.9 +
    1.10 +function testConstructNDEF() {
    1.11 +  try {
    1.12 +    // omit type, id and payload.
    1.13 +    let r = new MozNDEFRecord(0x0);
    1.14 +    is(r.type, null, "r.type should be null")
    1.15 +    is(r.id, null, "r.id should be null")
    1.16 +    is(r.payload, null, "r.payload should be null")
    1.17 +
    1.18 +    // omit id and payload.
    1.19 +    r = new MozNDEFRecord(0x0, new Uint8Array());
    1.20 +    is(r.id, null, "r.id should be null")
    1.21 +    is(r.payload, null, "r.payload should be null")
    1.22 +
    1.23 +    // omit payload.
    1.24 +    r = new MozNDEFRecord(0x0, new Uint8Array(), new Uint8Array());
    1.25 +    is(r.payload, null, "r.payload should be null")
    1.26 +
    1.27 +    ok(true);
    1.28 +  } catch (e) {
    1.29 +    ok(false, 'type, id or payload should be optional. error:' + e);
    1.30 +  }
    1.31 +
    1.32 +  runNextTest();
    1.33 +}
    1.34 +
    1.35 +let tests = [
    1.36 +  testConstructNDEF
    1.37 +];
    1.38 +
    1.39 +runTests();

mercurial