mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 997576 - [NFC] Testcase for reading empty NFC tag. r=tzimmermann
This commit is contained in:
parent
3af6525a4e
commit
b1c674417f
@ -82,6 +82,16 @@ let emulator = (function() {
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
function clearTagData(re) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc tag clear " + re;
|
||||
|
||||
this.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "clear tag" + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function snepPutNdef(dsap, ssap, flags, tnf, type, payload, id) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc snep put " + dsap + " " + ssap + " [" + flags + "," +
|
||||
@ -103,6 +113,7 @@ let emulator = (function() {
|
||||
deactivate: deactivate,
|
||||
notifyDiscoverRE: notifyDiscoverRE,
|
||||
setTagData: setTagData,
|
||||
clearTagData: clearTagData,
|
||||
snepPutNdef: snepPutNdef
|
||||
};
|
||||
}());
|
||||
|
@ -10,6 +10,6 @@ qemu=true
|
||||
[test_nfc_manager_tech_lost.js]
|
||||
[test_nfc_peer.js]
|
||||
[test_nfc_peer_sendndef.js]
|
||||
[test_nfc_tag.js]
|
||||
[test_nfc_read_tag.js]
|
||||
[test_nfc_checkP2PRegistration.js]
|
||||
[test_nfc_error_messages.js]
|
||||
|
@ -6,11 +6,10 @@ MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
let url = "http://www.mozilla.org";
|
||||
|
||||
// TODO : Get this from emulator console command.
|
||||
const T1T_RE_INDEX = 2;
|
||||
const T2T_RE_INDEX = 3;
|
||||
const T3T_RE_INDEX = 4;
|
||||
const T4T_RE_INDEX = 5;
|
||||
const T1T_RE_INDEX = 2;
|
||||
const T2T_RE_INDEX = 3;
|
||||
const T3T_RE_INDEX = 4;
|
||||
const T4T_RE_INDEX = 5;
|
||||
|
||||
function testUrlTagDiscover(re) {
|
||||
log("Running \'testUrlTagDiscover\'");
|
||||
@ -41,6 +40,26 @@ function testUrlTagDiscover(re) {
|
||||
.then(() => emulator.activateRE(re));
|
||||
}
|
||||
|
||||
function testEmptyTagDiscover(re) {
|
||||
log("Running \'testEmptyTagDiscover\'");
|
||||
|
||||
window.navigator.mozSetMessageHandler("nfc-manager-tech-discovered", function(msg) {
|
||||
log("Received \'nfc-manager-tech-ndiscovered\'");
|
||||
is(msg.type, "techDiscovered", "check for correct message type");
|
||||
let index = msg.techList.indexOf("NDEF");
|
||||
isnot(index, -1, "check for \'NDEF\' in tech list");
|
||||
|
||||
let records = msg.records;
|
||||
ok(records == null);
|
||||
|
||||
toggleNFC(false).then(runNextTest);
|
||||
});
|
||||
|
||||
toggleNFC(true)
|
||||
.then(() => emulator.clearTagData(re))
|
||||
.then(() => emulator.activateRE(re));
|
||||
}
|
||||
|
||||
function testUrlT1TDiscover() {
|
||||
testUrlTagDiscover(T1T_RE_INDEX);
|
||||
}
|
||||
@ -57,11 +76,31 @@ function testUrlT4TDiscover() {
|
||||
testUrlTagDiscover(T4T_RE_INDEX);
|
||||
}
|
||||
|
||||
function testEmptyT1TDiscover() {
|
||||
testEmptyTagDiscover(T1T_RE_INDEX);
|
||||
}
|
||||
|
||||
function testEmptyT2TDiscover() {
|
||||
testEmptyTagDiscover(T2T_RE_INDEX);
|
||||
}
|
||||
|
||||
function testEmptyT3TDiscover() {
|
||||
testEmptyTagDiscover(T3T_RE_INDEX);
|
||||
}
|
||||
|
||||
function testEmptyT4TDiscover() {
|
||||
testEmptyTagDiscover(T4T_RE_INDEX);
|
||||
}
|
||||
|
||||
let tests = [
|
||||
testUrlT1TDiscover,
|
||||
testUrlT2TDiscover,
|
||||
testUrlT3TDiscover,
|
||||
testUrlT4TDiscover
|
||||
testUrlT1TDiscover,
|
||||
testUrlT2TDiscover,
|
||||
testUrlT3TDiscover,
|
||||
testUrlT4TDiscover,
|
||||
testEmptyT1TDiscover,
|
||||
testEmptyT2TDiscover,
|
||||
testEmptyT3TDiscover,
|
||||
testEmptyT4TDiscover
|
||||
];
|
||||
|
||||
SpecialPowers.pushPermissions(
|
Loading…
Reference in New Issue
Block a user