mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1033218 - [NFC] use emulator command triggering tech-lost. r=allstars.chh
This commit is contained in:
parent
ec986afc0f
commit
7124970438
@ -4,7 +4,7 @@
|
||||
'use strict';
|
||||
|
||||
/* globals log, is, ok, runTests, toggleNFC, runNextTest,
|
||||
SpecialPowers, nfc, enableRE0, MozNDEFRecord */
|
||||
SpecialPowers, nfc, MozNDEFRecord, emulator */
|
||||
|
||||
const MARIONETTE_TIMEOUT = 60000;
|
||||
const MARIONETTE_HEAD_JS = 'head.js';
|
||||
@ -27,7 +27,7 @@ let sessionTokens = [];
|
||||
function testNfcNotEnabledError() {
|
||||
log('testNfcNotEnabledError');
|
||||
toggleNFC(true)
|
||||
.then(enableRE0)
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(registerAndFireOnpeerready)
|
||||
.then(() => toggleNFC(false))
|
||||
.then(() => sendNDEFExpectError(nfcPeers[0], 'NfcNotEnabledError'))
|
||||
@ -45,11 +45,10 @@ function testNfcNotEnabledError() {
|
||||
function testNfcBadSessionIdError() {
|
||||
log('testNfcBadSessionIdError');
|
||||
toggleNFC(true)
|
||||
.then(enableRE0)
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(registerAndFireOnpeerready)
|
||||
.then(() => toggleNFC(false))
|
||||
.then(() => toggleNFC(true))
|
||||
.then(enableRE0)
|
||||
.then(() => emulator.deactivate())
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(registerAndFireOnpeerready)
|
||||
// we have 2 peers in nfcPeers array, peer0 has old/invalid session token
|
||||
.then(() => sendNDEFExpectError(nfcPeers[0], 'NfcBadSessionIdError'))
|
||||
@ -66,7 +65,7 @@ function testNfcBadSessionIdError() {
|
||||
function testNfcConnectError() {
|
||||
log('testNfcConnectError');
|
||||
toggleNFC(true)
|
||||
.then(enableRE0)
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(registerAndFireOnpeerready)
|
||||
.then(() => connectToNFCTagExpectError(sessionTokens[0],
|
||||
'NDEF',
|
||||
@ -84,9 +83,10 @@ function testNfcConnectError() {
|
||||
function testNoErrorInTechMsg() {
|
||||
log('testNoErrorInTechMsg');
|
||||
toggleNFC(true)
|
||||
.then(enableRE0)
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(setTechDiscoveredHandler)
|
||||
.then(setAndFireTechLostHandler)
|
||||
.then(() => toggleNFC(false))
|
||||
.then(endTest)
|
||||
.catch(handleRejectedPromise);
|
||||
}
|
||||
@ -201,8 +201,9 @@ function setAndFireTechLostHandler() {
|
||||
|
||||
window.navigator.mozSetMessageHandler('nfc-manager-tech-lost',
|
||||
techLostHandler);
|
||||
// TODO should be refactored once Bug 1023079 lands
|
||||
toggleNFC(false);
|
||||
|
||||
// triggers tech-lost
|
||||
emulator.deactivate();
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user