From 048eaf951c974be75771df9fb0aa32086db7fa5b Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Fri, 29 Aug 2014 14:28:12 +0800 Subject: [PATCH] Bug 1007724 - Part 2: marionette tests. r=dimi From 84c328a6b61db42daa196f18e0f4113e1b74b2e8 Mon Sep 17 00:00:00 2001 --- dom/nfc/tests/marionette/test_ndef.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) --- dom/nfc/tests/marionette/test_ndef.js | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dom/nfc/tests/marionette/test_ndef.js b/dom/nfc/tests/marionette/test_ndef.js index 1ca59ca637ea..e813cf896226 100644 --- a/dom/nfc/tests/marionette/test_ndef.js +++ b/dom/nfc/tests/marionette/test_ndef.js @@ -18,6 +18,34 @@ function testConstructNDEF() { 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(); }