2014-07-03 19:21:18 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
MARIONETTE_TIMEOUT = 30000;
|
|
|
|
MARIONETTE_HEAD_JS = 'head.js';
|
|
|
|
|
|
|
|
function handleTechnologyLost(msg) {
|
|
|
|
log('Received \'nfc-manager-tech-lost\'');
|
|
|
|
is(msg.type, 'techLost', 'check for correct message type');
|
|
|
|
|
|
|
|
toggleNFC(false).then(runNextTest)
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleTechnologyDiscoveredRE0(msg) {
|
|
|
|
log('Received \'nfc-manager-tech-discovered\'');
|
|
|
|
is(msg.type, 'techDiscovered', 'check for correct message type');
|
|
|
|
is(msg.techList[0], 'P2P', 'check for correct tech type');
|
|
|
|
|
2014-07-09 20:33:10 -07:00
|
|
|
NCI.deactivate();
|
2014-07-03 19:21:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function testTechLost() {
|
|
|
|
log('Running \'testTechLost\'');
|
2014-08-11 00:45:35 -07:00
|
|
|
sysMsgHelper.waitForTechDiscovered(handleTechnologyDiscoveredRE0);
|
|
|
|
sysMsgHelper.waitForTechLost(handleTechnologyLost);
|
2014-07-03 19:21:18 -07:00
|
|
|
|
2014-07-09 20:33:10 -07:00
|
|
|
toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
|
2014-07-03 19:21:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
let tests = [
|
|
|
|
testTechLost
|
|
|
|
];
|
|
|
|
|
|
|
|
SpecialPowers.pushPermissions(
|
|
|
|
[{'type': 'nfc-manager', 'allow': true, context: document}], runTests);
|