зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1055560 - Part 3: Update tests. r=dimi
From 29bd27dc7ebcbc0ec4cce0681fa956eed7fad6ea Mon Sep 17 00:00:00 2001 --- dom/nfc/tests/marionette/head.js | 21 +++++++++++++++++---- dom/nfc/tests/marionette/test_ndef.js | 2 +- dom/nfc/tests/marionette/test_nfc_error_messages.js | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-)
This commit is contained in:
Родитель
76d367acf0
Коммит
4108000231
|
@ -126,8 +126,9 @@ let NCI = (function() {
|
|||
let TAG = (function() {
|
||||
function setData(re, flag, tnf, type, payload) {
|
||||
let deferred = Promise.defer();
|
||||
let tnfNum = NDEF.getTNFNum(tnf);
|
||||
let cmd = "nfc tag set " + re +
|
||||
" [" + flag + "," + tnf + "," + type + ",," + payload + "]";
|
||||
" [" + flag + "," + tnfNum + "," + type + ",," + payload + "]";
|
||||
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "set NDEF data of tag" + re);
|
||||
|
@ -156,8 +157,9 @@ let TAG = (function() {
|
|||
let SNEP = (function() {
|
||||
function put(dsap, ssap, flags, tnf, type, id, payload) {
|
||||
let deferred = Promise.defer();
|
||||
let tnfNum = NDEF.getTNFNum(tnf);
|
||||
let cmd = "nfc snep put " + dsap + " " + ssap + " [" + flags + "," +
|
||||
tnf + "," +
|
||||
tnfNum + "," +
|
||||
type + "," +
|
||||
id + "," +
|
||||
payload + "]";
|
||||
|
@ -245,7 +247,18 @@ function runTests() {
|
|||
}
|
||||
|
||||
const NDEF = {
|
||||
TNF_WELL_KNOWN: 1,
|
||||
TNF_WELL_KNOWN: "well-known",
|
||||
|
||||
tnfValues: ["empty", "well-known", "media-type", "absolute-uri", "external",
|
||||
"unknown", "unchanged", "reserved"],
|
||||
|
||||
getTNFNum: function (tnfString) {
|
||||
return this.tnfValues.indexOf(tnfString);
|
||||
},
|
||||
|
||||
getTNFString: function(tnfNum) {
|
||||
return this.tnfValues[tnfNum];
|
||||
},
|
||||
|
||||
// compares two NDEF messages
|
||||
compare: function(ndef1, ndef2) {
|
||||
|
@ -290,7 +303,7 @@ const NDEF = {
|
|||
let type = NfcUtils.fromUTF8(this.atob(value.type));
|
||||
let id = NfcUtils.fromUTF8(this.atob(value.id));
|
||||
let payload = NfcUtils.fromUTF8(this.atob(value.payload));
|
||||
return new MozNDEFRecord({tnf: value.tnf, type: type, id: id, payload: payload});
|
||||
return new MozNDEFRecord({tnf: NDEF.getTNFString(value.tnf), type: type, id: id, payload: payload});
|
||||
}, window);
|
||||
return ndef;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function testConstructNDEF() {
|
|||
try {
|
||||
// omit type, id and payload.
|
||||
let r = new MozNDEFRecord();
|
||||
is(r.tnf, 0, "r.tnf should be 0");
|
||||
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");
|
||||
|
|
|
@ -10,7 +10,7 @@ const MARIONETTE_TIMEOUT = 60000;
|
|||
const MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
const MANIFEST_URL = 'app://system.gaiamobile.org/manifest.webapp';
|
||||
const NDEF_MESSAGE = [new MozNDEFRecord({tnf: 0x01,
|
||||
const NDEF_MESSAGE = [new MozNDEFRecord({tnf: "well-known",
|
||||
type: new Uint8Array(0x84),
|
||||
payload: new Uint8Array(0x20)})];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче