Bug 1040619 - [NFC] javascript error "emulator.activateRE is not a function" when run NFC testcase. r=allstars.chh
authorDimi Lee <dlee@mozilla.com>
Fri, 18 Jul 2014 15:22:46 +0800
changeset 194778 c411c567b8c6b9e912a643be02eac0604ff5bfea
parent 194777 68423e2194d4615bfff19db377b8e03f98199b85
child 194779 7cc5b9006236766eacea6e8c366a5f3e74b99461
push id9018
push useryhuang@mozilla.com
push dateFri, 18 Jul 2014 08:04:48 +0000
treeherderb2g-inbound@c411c567b8c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersallstars.chh
bugs1040619
milestone33.0a1
Bug 1040619 - [NFC] javascript error "emulator.activateRE is not a function" when run NFC testcase. r=allstars.chh
dom/nfc/tests/marionette/test_nfc_error_messages.js
--- a/dom/nfc/tests/marionette/test_nfc_error_messages.js
+++ b/dom/nfc/tests/marionette/test_nfc_error_messages.js
@@ -22,17 +22,17 @@ let sessionTokens = [];
  * Enables nfc and RE0 then registers onpeerready callback and once
  * it's fired it creates mozNFCPeer and stores it for later.
  * After disabling nfc tries to do mozNFCPeer.sendNDEF which should
  * fail with NfcNotEnabledError.
  */
 function testNfcNotEnabledError() {
   log('testNfcNotEnabledError');
   toggleNFC(true)
-  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerAndFireOnpeerready)
   .then(() => toggleNFC(false))
   .then(() => sendNDEFExpectError(nfcPeers[0], 'NfcNotEnabledError'))
   .then(endTest)
   .catch(handleRejectedPromise);
 }
 
 /**
@@ -40,37 +40,37 @@ function testNfcNotEnabledError() {
  * it creates and stores mozNFCPeer. Disables nfc, enables nfc and
  * once again registers and fires new onpeerready callback and stores
  * mozNfcPeer. Than fires sendNDEF on the first stored peer which
  * should have invalid session token and we should get NfcBadSessionIdError
  */
 function testNfcBadSessionIdError() {
   log('testNfcBadSessionIdError');
   toggleNFC(true)
-  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerAndFireOnpeerready)
-  .then(() => emulator.deactivate())
-  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
+  .then(() => NCI.deactivate())
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerAndFireOnpeerready)
   // we have 2 peers in nfcPeers array, peer0 has old/invalid session token
   .then(() => sendNDEFExpectError(nfcPeers[0], 'NfcBadSessionIdError'))
   .then(() => toggleNFC(false))
   .then(endTest)
   .catch(handleRejectedPromise);
 }
 
 /**
  * Eables nfc and RE0, register onpeerready callback, once it's fired
  * it stores sessionToken. Using sessionToken cretes mozNFCTag and fires
  * mozNFCTag.connect('NDEF') which should result in NfcConnectError.
  */
 function testNfcConnectError() {
   log('testNfcConnectError');
   toggleNFC(true)
-  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerAndFireOnpeerready)
   .then(() => connectToNFCTagExpectError(sessionTokens[0],
                                          'NDEF',
                                          'NfcConnectError'))
   .then(() => toggleNFC(false))
   .then(endTest)
   .catch(handleRejectedPromise);
 }
@@ -78,17 +78,17 @@ function testNfcConnectError() {
 /**
  * Enables nfc and RE0, registers tech-discovered msg handler, once it's
  * fired set tech-lost handler and disables nfc. In both handlers checks
  * if error message is not present.
  */
 function testNoErrorInTechMsg() {
   log('testNoErrorInTechMsg');
   toggleNFC(true)
-  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(setTechDiscoveredHandler)
   .then(setAndFireTechLostHandler)
   .then(() => toggleNFC(false))
   .then(endTest)
   .catch(handleRejectedPromise);
 }
 
 function endTest() {
@@ -198,17 +198,17 @@ function setAndFireTechLostHandler() {
     window.navigator.mozSetMessageHandler('nfc-manager-tech-lost', null);
     deferred.resolve();
   };
 
   window.navigator.mozSetMessageHandler('nfc-manager-tech-lost',
                                         techLostHandler);
 
   // triggers tech-lost
-  emulator.deactivate();
+  NCI.deactivate();
   return deferred.promise;
 }
 
 let tests = [
   testNfcNotEnabledError,
   testNfcBadSessionIdError,
   testNfcConnectError,
   testNoErrorInTechMsg