Bug 1035606 - [NFC] Testcase cleanup. r=tzimmermann
authorDimi Lee <dlee@mozilla.com>
Thu, 10 Jul 2014 11:33:10 +0800
changeset 193461 97ed5d7ce52ffda21f996bc3bec265c2a77e57ff
parent 193460 c3cca6dfcaa746491d440e5508c60d7e65e5097d
child 193462 d86018462663722be206b201ab82ce5196d64156
push id27121
push userryanvm@gmail.com
push dateFri, 11 Jul 2014 19:59:41 +0000
treeherdermozilla-central@c11ea2f54a6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstzimmermann
bugs1035606
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1035606 - [NFC] Testcase cleanup. r=tzimmermann
dom/nfc/tests/marionette/head.js
dom/nfc/tests/marionette/test_nfc_checkP2PRegistration.js
dom/nfc/tests/marionette/test_nfc_error_messages.js
dom/nfc/tests/marionette/test_nfc_manager_tech_discovered.js
dom/nfc/tests/marionette/test_nfc_manager_tech_discovered_ndef.js
dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js
dom/nfc/tests/marionette/test_nfc_peer.js
dom/nfc/tests/marionette/test_nfc_peer_sendndef.js
dom/nfc/tests/marionette/test_nfc_read_tag.js
--- a/dom/nfc/tests/marionette/head.js
+++ b/dom/nfc/tests/marionette/head.js
@@ -28,98 +28,123 @@ let emulator = (function() {
     originalRunEmulatorCmd(cmd, function(result) {
       pendingCmdCount--;
       if (callback && typeof callback === "function") {
         callback(result);
       }
     });
   };
 
+  return {
+    run: run,
+    P2P_RE_INDEX_0 : 0,
+    P2P_RE_INDEX_1 : 1,
+    T1T_RE_INDEX   : 2,
+    T2T_RE_INDEX   : 3,
+    T3T_RE_INDEX   : 4,
+    T4T_RE_INDEX   : 5
+  };
+}());
+
+let NCI = (function() {
   function activateRE(re) {
     let deferred = Promise.defer();
     let cmd = 'nfc nci rf_intf_activated_ntf ' + re;
 
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), 'OK', 'check activation of RE' + re);
       deferred.resolve();
     });
 
     return deferred.promise;
   };
 
  function deactivate() {
     let deferred = Promise.defer();
     let cmd = 'nfc nci rf_intf_deactivate_ntf';
 
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), 'OK', 'check deactivate');
       deferred.resolve();
     });
 
     return deferred.promise;
   };
 
   function notifyDiscoverRE(re, type) {
     let deferred = Promise.defer();
     let cmd = 'nfc nci rf_discover_ntf ' + re + ' ' + type;
 
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), 'OK', 'check discovery of RE' + re);
       deferred.resolve();
     });
 
     return deferred.promise;
   };
 
-  function setTagData(re, flag, tnf, type, payload) {
+  return {
+    activateRE: activateRE,
+    deactivate: deactivate,
+    notifyDiscoverRE: notifyDiscoverRE,
+    LAST_NOTIFICATION: 0,
+    LIMIT_NOTIFICATION: 1,
+    MORE_NOTIFICATIONS: 2
+  };
+}());
+
+let TAG = (function() {
+  function setData(re, flag, tnf, type, payload) {
     let deferred = Promise.defer();
     let cmd = "nfc tag set " + re +
               " [" + flag + "," + tnf + "," + type + "," + payload + ",]";
 
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), "OK", "set NDEF data of tag" + re);
       deferred.resolve();
     });
 
     return deferred.promise;
   };
 
-  function clearTagData(re) {
+  function clearData(re) {
     let deferred = Promise.defer();
     let cmd = "nfc tag clear " + re;
 
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), "OK", "clear tag" + re);
       deferred.resolve();
     });
   }
 
-  function snepPutNdef(dsap, ssap, flags, tnf, type, payload, id) {
+  return {
+    setData: setData,
+    clearData: clearData
+  };
+}());
+
+let SNEP = (function() {
+  function put(dsap, ssap, flags, tnf, type, payload, id) {
     let deferred = Promise.defer();
     let cmd = "nfc snep put " + dsap + " " + ssap + " [" + flags + "," +
                                                            tnf + "," +
                                                            type + "," +
                                                            payload + "," +
                                                            id + "]";
-    this.run(cmd, function(result) {
+    emulator.run(cmd, function(result) {
       is(result.pop(), "OK", "send SNEP PUT");
       deferred.resolve();
     });
 
     return deferred.promise;
   };
 
   return {
-    run: run,
-    activateRE: activateRE,
-    deactivate: deactivate,
-    notifyDiscoverRE: notifyDiscoverRE,
-    setTagData: setTagData,
-    clearTagData: clearTagData,
-    snepPutNdef: snepPutNdef
+    put: put,
+    SAP_NDEF: 4
   };
 }());
 
 function toggleNFC(enabled) {
   let deferred = Promise.defer();
 
   let req;
   if (enabled) {
@@ -147,28 +172,16 @@ function clearPendingMessages(type) {
   }
 
   // setting a handler removes all messages from queue
   window.navigator.mozSetMessageHandler(type, function() {
     window.navigator.mozSetMessageHandler(type, null);
   });
 }
 
-function enableRE0() {
-  let deferred = Promise.defer();
-  let cmd = 'nfc nci rf_intf_activated_ntf 0';
-
-  emulator.run(cmd, function(result) {
-    is(result.pop(), 'OK', 'check activation of RE0');
-    deferred.resolve();
-  });
-
-  return deferred.promise;
-}
-
 function cleanUp() {
   log('Cleaning up');
   waitFor(function() {
             SpecialPowers.removePermission("nfc-manager", document);
             finish()
           },
           function() {
             return pendingEmulatorCmdCount === 0;
--- a/dom/nfc/tests/marionette/test_nfc_checkP2PRegistration.js
+++ b/dom/nfc/tests/marionette/test_nfc_checkP2PRegistration.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 'use strict';
 
 /* globals log, is, ok, runTests, toggleNFC, runNextTest,
-   SpecialPowers, nfc, enableRE0 */
+   SpecialPowers, nfc */
 
 const MARIONETTE_TIMEOUT = 30000;
 const MARIONETTE_HEAD_JS = 'head.js';
 
 const MANIFEST_URL = 'app://system.gaiamobile.org/manifest.webapp';
 const FAKE_MANIFEST_URL = 'app://fake.gaiamobile.org/manifest.webapp';
 
 /**
@@ -45,17 +45,17 @@ function testWithTargetNoSessionToken() 
 
 /**
  * Success scenario, nfc enabled, activated RE0 (p2p ndef is received,
  * creates session token) opeerreadyhandler registered.
  */
 function testWithSessionTokenWithTarget() {
   log('testWithSessionTokenWithTarget');
   toggleNFC(true)
-  .then(enableRE0)
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerOnpeerready)
   .then(() => fireCheckP2PReg(MANIFEST_URL))
   .then((result) => {
     is(result, true, 'should be true, onpeerready reg, sessionToken set');
     nfc.onpeerready = null;
     return toggleNFC(false);
   })
   .then(runNextTest)
@@ -64,17 +64,17 @@ function testWithSessionTokenWithTarget(
 
 /**
  * Failure scenario, nfc enabled, activated RE0 (p2p ndef is received,
  * creates session token) opeerready handler not registered.
  */
 function testWithSessionTokenNoTarget() {
   log('testWithSessionTokenNoTarget');
   toggleNFC(true)
-  .then(enableRE0)
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(() => fireCheckP2PReg(MANIFEST_URL))
   .then((result) => {
     is(result, false,
       'session token  avilable but onpeerready not registered');
     return toggleNFC(false);
   })
   .then(runNextTest)
   .catch(handleRejectedPromiseWithNfcOn);
@@ -82,17 +82,17 @@ function testWithSessionTokenNoTarget() 
 
 /**
  * Failure scenario, nfc enabled, re0 activated, onpeerready registered,
  * checking wrong manifest url.
  */
 function testWithSessionTokenWrongTarget() {
   log('testWithSessionTokenWrongTarget');
   toggleNFC(true)
-  .then(enableRE0)
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerOnpeerready)
   .then(() => fireCheckP2PReg(FAKE_MANIFEST_URL))
   .then((result) => {
     is(result, false, 'should be false, fake manifest, sessionToken set');
     nfc.onpeerready = null;
     return toggleNFC(false);
   })
   .then(runNextTest)
--- 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(0))
+  .then(() => emulator.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(0))
+  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
   .then(registerAndFireOnpeerready)
   .then(() => emulator.deactivate())
-  .then(() => emulator.activateRE(0))
+  .then(() => emulator.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(0))
+  .then(() => emulator.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(0))
+  .then(() => emulator.activateRE(emulator.P2P_RE_INDEX_0))
   .then(setTechDiscoveredHandler)
   .then(setAndFireTechLostHandler)
   .then(() => toggleNFC(false))
   .then(endTest)
   .catch(handleRejectedPromise);
 }
 
 function endTest() {
--- a/dom/nfc/tests/marionette/test_nfc_manager_tech_discovered.js
+++ b/dom/nfc/tests/marionette/test_nfc_manager_tech_discovered.js
@@ -1,45 +1,40 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 30000;
 MARIONETTE_HEAD_JS = 'head.js';
 
-// See nfc-nci.h.
-const NCI_LAST_NOTIFICATION  = 0;
-const NCI_LIMIT_NOTIFICATION = 1;
-const NCI_MORE_NOTIFICATIONS = 2;
-
 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');
   toggleNFC(false).then(runNextTest);
 }
 
 function testActivateRE0() {
   log('Running \'testActivateRE0\'');
   window.navigator.mozSetMessageHandler(
     'nfc-manager-tech-discovered', handleTechnologyDiscoveredRE0);
 
-  toggleNFC(true).then(() => emulator.activateRE(0));
+  toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 // Check NCI Spec 5.2, this will change NCI state from
 // DISCOVERY -> W4_ALL_DISCOVERIES -> W4_HOST_SELECT -> POLL_ACTIVE
 function testRfDiscover() {
   log('Running \'testRfDiscover\'');
   window.navigator.mozSetMessageHandler(
     'nfc-manager-tech-discovered', handleTechnologyDiscoveredRE0);
 
   toggleNFC(true)
-  .then(() => emulator.notifyDiscoverRE(0, NCI_MORE_NOTIFICATIONS))
-  .then(() => emulator.notifyDiscoverRE(1, NCI_LAST_NOTIFICATION))
-  .then(() => emulator.activateRE(0));
+  .then(() => NCI.notifyDiscoverRE(emulator.P2P_RE_INDEX_0, NCI.MORE_NOTIFICATIONS))
+  .then(() => NCI.notifyDiscoverRE(emulator.P2P_RE_INDEX_1, NCI.LAST_NOTIFICATION))
+  .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 let tests = [
   testActivateRE0,
   testRfDiscover
 ];
 
 SpecialPowers.pushPermissions(
--- a/dom/nfc/tests/marionette/test_nfc_manager_tech_discovered_ndef.js
+++ b/dom/nfc/tests/marionette/test_nfc_manager_tech_discovered_ndef.js
@@ -6,21 +6,16 @@ MARIONETTE_HEAD_JS = 'head.js';
 
 let tnf = NDEF.TNF_WELL_KNOWN;
 let type = "U";
 let payload = "https://www.example.com";
 let id = "";
 
 let ndef = null;
 
-// See nfc-nci.h.
-const NCI_LAST_NOTIFICATION = 0;
-const NCI_LIMIT_NOTIFICATION = 1;
-const NCI_MORE_NOTIFICATIONS = 2;
-
 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");
 
   if (msg.records) {
     isnot(msg.techList.indexOf("NDEF"), -1, "check for correct tech type");
     // validate received NDEF message against reference
@@ -33,19 +28,19 @@ function handleTechnologyDiscoveredRE0(m
   }
 }
 
 function testReceiveNDEF() {
   log("Running 'testReceiveNDEF'");
   window.navigator.mozSetMessageHandler(
     "nfc-manager-tech-discovered", handleTechnologyDiscoveredRE0);
   toggleNFC(true)
-    .then(() => emulator.activateRE(0))
-    .then(() => emulator.snepPutNdef(4, 4, 0, tnf, btoa(type),
-                                     btoa(payload), btoa(id)));
+    .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
+    .then(() => SNEP.put(SNEP.SAP_NDEF, SNEP.SAP_NDEF, 0, tnf, btoa(type),
+                         btoa(payload), btoa(id)));
 }
 
 let tests = [
   testReceiveNDEF
 ];
 
 SpecialPowers.pushPermissions(
   [{'type': 'nfc', 'allow': true,
--- a/dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js
+++ b/dom/nfc/tests/marionette/test_nfc_manager_tech_lost.js
@@ -11,27 +11,27 @@ function handleTechnologyLost(msg) {
   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');
 
-  emulator.deactivate();
+  NCI.deactivate();
 }
 
 function testTechLost() {
   log('Running \'testTechLost\'');
   window.navigator.mozSetMessageHandler(
     'nfc-manager-tech-discovered', handleTechnologyDiscoveredRE0);
   window.navigator.mozSetMessageHandler(
     'nfc-manager-tech-lost', handleTechnologyLost);
 
-  toggleNFC(true).then(() => emulator.activateRE(0));
+  toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 let tests = [
   testTechLost
 ];
 
 SpecialPowers.pushPermissions(
   [{'type': 'nfc-manager', 'allow': true, context: document}], runTests);
--- a/dom/nfc/tests/marionette/test_nfc_peer.js
+++ b/dom/nfc/tests/marionette/test_nfc_peer.js
@@ -9,17 +9,17 @@ let INCORRECT_MANIFEST_URL = "app://xyz.
 
 function peerReadyCb(evt) {
   log("peerReadyCb called");
   let peer = nfc.getNFCPeer(evt.detail);
   ok(peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
 
   // reset callback.
   nfc.onpeerready = null;
-  emulator.deactivate();
+  NCI.deactivate();
 }
 
 function peerLostCb() {
   log("peerLostCb called");
   ok(true);
   nfc.onpeerlost = null;
   toggleNFC(false).then(runNextTest);
 }
@@ -66,24 +66,24 @@ function handleTechnologyDiscoveredRE0Fo
     toggleNFC(false).then(runNextTest);
   }
 }
 
 function testPeerReady() {
   window.navigator.mozSetMessageHandler(
     "nfc-manager-tech-discovered", handleTechnologyDiscoveredRE0);
 
-  toggleNFC(true).then(() => emulator.activateRE(0));
+  toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 function testCheckP2PRegFailure() {
   window.navigator.mozSetMessageHandler(
     "nfc-manager-tech-discovered", handleTechnologyDiscoveredRE0ForP2PRegFailure);
 
-  toggleNFC(true).then(() => emulator.activateRE(0));
+  toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 function testCheckNfcPeerObjForInvalidToken() {
   try {
     // Use a'fakeSessionToken'
     let peer = nfc.getNFCPeer("fakeSessionToken");
     ok(false, "Should not get a NFCPeer object.");
   } catch (ex) {
--- a/dom/nfc/tests/marionette/test_nfc_peer_sendndef.js
+++ b/dom/nfc/tests/marionette/test_nfc_peer_sendndef.js
@@ -39,17 +39,17 @@ function handleTechnologyDiscoveredRE0(m
   isnot(index, -1, "check for \'P2P\' in tech list");
   sendNDEF(msg.techList[index], msg.sessionToken);
 }
 
 function testOnPeerReadyRE0() {
   log("Running \'testOnPeerReadyRE0\'");
   window.navigator.mozSetMessageHandler(
     "nfc-manager-tech-discovered", handleTechnologyDiscoveredRE0);
-  toggleNFC(true).then(enableRE0);
+  toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 let tests = [
   testOnPeerReadyRE0
 ];
 
 SpecialPowers.pushPermissions(
   [{"type": "nfc", "allow": true,
--- a/dom/nfc/tests/marionette/test_nfc_read_tag.js
+++ b/dom/nfc/tests/marionette/test_nfc_read_tag.js
@@ -1,21 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 30000;
 MARIONETTE_HEAD_JS = "head.js";
 
 let url = "http://www.mozilla.org";
 
-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\'");
   // TODO : Make flag value readable.
   let flag = 0xd0;
   let tnf = NDEF.TNF_WELL_KNOWN;
   let type = "U";
   let payload = url;
 
@@ -31,18 +26,18 @@ function testUrlTagDiscover(re) {
     is(tnf, records[0].tnf, "check for TNF field in NDEF");
     is(type, NfcUtils.toUTF8(records[0].type), "check for type field in NDEF");
     is(payload, NfcUtils.toUTF8(records[0].payload), "check for payload field in NDEF");
 
     toggleNFC(false).then(runNextTest);
   });
 
   toggleNFC(true)
-  .then(() => emulator.setTagData(re, flag, tnf, btoa(type), btoa(payload)))
-  .then(() => emulator.activateRE(re));
+  .then(() => TAG.setData(re, flag, tnf, btoa(type), btoa(payload)))
+  .then(() => NCI.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");
@@ -51,50 +46,50 @@ function testEmptyTagDiscover(re) {
 
     let records = msg.records;
     ok(records == null);
 
     toggleNFC(false).then(runNextTest);
   });
 
   toggleNFC(true)
-  .then(() => emulator.clearTagData(re))
-  .then(() => emulator.activateRE(re));
+  .then(() => TAG.clearData(re))
+  .then(() => NCI.activateRE(re));
 }
 
 function testUrlT1TDiscover() {
-  testUrlTagDiscover(T1T_RE_INDEX);
+  testUrlTagDiscover(emulator.T1T_RE_INDEX);
 }
 
 function testUrlT2TDiscover() {
-  testUrlTagDiscover(T2T_RE_INDEX);
+  testUrlTagDiscover(emulator.T2T_RE_INDEX);
 }
 
 function testUrlT3TDiscover() {
-  testUrlTagDiscover(T3T_RE_INDEX);
+  testUrlTagDiscover(emulator.T3T_RE_INDEX);
 }
 
 function testUrlT4TDiscover() {
-  testUrlTagDiscover(T4T_RE_INDEX);
+  testUrlTagDiscover(emulator.T4T_RE_INDEX);
 }
 
 function testEmptyT1TDiscover() {
-  testEmptyTagDiscover(T1T_RE_INDEX);
+  testEmptyTagDiscover(emulator.T1T_RE_INDEX);
 }
 
 function testEmptyT2TDiscover() {
-  testEmptyTagDiscover(T2T_RE_INDEX);
+  testEmptyTagDiscover(emulator.T2T_RE_INDEX);
 }
 
 function testEmptyT3TDiscover() {
-  testEmptyTagDiscover(T3T_RE_INDEX);
+  testEmptyTagDiscover(emulator.T3T_RE_INDEX);
 }
 
 function testEmptyT4TDiscover() {
-  testEmptyTagDiscover(T4T_RE_INDEX);
+  testEmptyTagDiscover(emulator.T4T_RE_INDEX);
 }
 
 let tests = [
     testUrlT1TDiscover,
     testUrlT2TDiscover,
     testUrlT3TDiscover,
     testUrlT4TDiscover,
     testEmptyT1TDiscover,