Bug 1151086 - Fix experiment filter functions to use the new telemetry environment, r=gfritzsche
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 23 Jun 2015 14:56:11 -0400
changeset 250670 7a19600cbcf953852f6950f0933c7ea28e25584a
parent 250669 fd6075b203c9a73bea9bf95b4d538ed4ce5ac5ad
child 250671 13be016459e15164126600ab59a34368bbf9016e
push idunknown
push userunknown
push dateunknown
reviewersgfritzsche
bugs1151086
milestone42.0a1
Bug 1151086 - Fix experiment filter functions to use the new telemetry environment, r=gfritzsche
browser/experiments/Experiments.jsm
browser/experiments/test/xpcshell/head.js
browser/experiments/test/xpcshell/test_activate.js
browser/experiments/test/xpcshell/test_api.js
browser/experiments/test/xpcshell/test_cache.js
browser/experiments/test/xpcshell/test_cacherace.js
browser/experiments/test/xpcshell/test_conditions.js
browser/experiments/test/xpcshell/test_disableExperiments.js
browser/experiments/test/xpcshell/test_healthreport.js
browser/experiments/test/xpcshell/test_telemetry.js
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -21,18 +21,18 @@ Cu.import("resource://gre/modules/Prefer
 Cu.import("resource://gre/modules/AsyncShutdown.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",
                                   "resource://gre/modules/UpdateChannel.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate",
                                   "resource://gre/modules/AddonManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySession",
-                                  "resource://gre/modules/TelemetrySession.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
+                                  "resource://gre/modules/TelemetryEnvironment.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog",
                                   "resource://gre/modules/TelemetryLog.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
                                   "resource://services-common/utils.js");
 XPCOMUtils.defineLazyModuleGetter(this, "Metrics",
                                   "resource://gre/modules/Metrics.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
@@ -51,18 +51,16 @@ const PREF_BRANCH               = "exper
 const PREF_ENABLED              = "enabled"; // experiments.enabled
 const PREF_ACTIVE_EXPERIMENT    = "activeExperiment"; // whether we have an active experiment
 const PREF_LOGGING              = "logging";
 const PREF_LOGGING_LEVEL        = PREF_LOGGING + ".level"; // experiments.logging.level
 const PREF_LOGGING_DUMP         = PREF_LOGGING + ".dump"; // experiments.logging.dump
 const PREF_MANIFEST_URI         = "manifest.uri"; // experiments.logging.manifest.uri
 const PREF_FORCE_SAMPLE         = "force-sample-value"; // experiments.force-sample-value
 
-const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
-
 const PREF_BRANCH_TELEMETRY     = "toolkit.telemetry.";
 const PREF_TELEMETRY_ENABLED    = "enabled";
 
 const URI_EXTENSION_STRINGS     = "chrome://mozapps/locale/extensions/extensions.properties";
 const STRING_TYPE_NAME          = "type.%ID%.name";
 
 const CACHE_WRITE_RETRY_DELAY_SEC = 60 * 3;
 const MANIFEST_FETCH_TIMEOUT_MSEC = 60 * 3 * 1000; // 3 minutes
@@ -280,35 +278,16 @@ Experiments.Policy.prototype = {
     return UpdateChannel.get();
   },
 
   locale: function () {
     let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
     return chrome.getSelectedLocale("global");
   },
 
-  /*
-   * @return Promise<> Resolved with the payload data.
-   */
-  healthReportPayload: function () {
-    return Task.spawn(function*() {
-      let reporter = Cc["@mozilla.org/datareporting/service;1"]
-            .getService(Ci.nsISupports)
-            .wrappedJSObject
-            .healthReporter;
-      yield reporter.onInit();
-      let payload = yield reporter.collectAndObtainJSONPayload();
-      return payload;
-    });
-  },
-
-  telemetryPayload: function () {
-    return TelemetrySession.getPayload();
-  },
-
   /**
    * For testing a race condition, one of the tests delays the callback of
    * writing the cache by replacing this policy function.
    */
   delayCacheWrite: function(promise) {
     return promise;
   },
 };
@@ -1701,60 +1680,57 @@ Experiments.ExperimentEntry.prototype = 
 
     return Promise.resolve(true);
   },
 
   /*
    * Run the jsfilter function from the manifest in a sandbox and return the
    * result (forced to boolean).
    */
-  _runFilterFunction: function (jsfilter) {
+  _runFilterFunction: Task.async(function* (jsfilter) {
     this._log.trace("runFilterFunction() - filter: " + jsfilter);
 
-    return Task.spawn(function ExperimentEntry_runFilterFunction_task() {
-      const nullprincipal = Cc["@mozilla.org/nullprincipal;1"].createInstance(Ci.nsIPrincipal);
-      let options = {
-        sandboxName: "telemetry experiments jsfilter sandbox",
-        wantComponents: false,
-      };
+    const nullprincipal = Cc["@mozilla.org/nullprincipal;1"].createInstance(Ci.nsIPrincipal);
+    let options = {
+      sandboxName: "telemetry experiments jsfilter sandbox",
+      wantComponents: false,
+    };
 
-      let sandbox = Cu.Sandbox(nullprincipal, options);
-      try {
-        Cu.evalInSandbox(jsfilter, sandbox);
-      } catch (e) {
-        this._log.error("runFilterFunction() - failed to eval jsfilter: " + e.message);
-        throw ["jsfilter-evalfailed"];
-      }
+    let sandbox = Cu.Sandbox(nullprincipal, options);
+    try {
+      Cu.evalInSandbox(jsfilter, sandbox);
+    } catch (e) {
+      this._log.error("runFilterFunction() - failed to eval jsfilter: " + e.message);
+      throw ["jsfilter-evalfailed"];
+    }
 
-      // You can't insert arbitrarily complex objects into a sandbox, so
-      // we serialize everything through JSON.
-      sandbox._hr = yield this._policy.healthReportPayload();
-      Object.defineProperty(sandbox, "_t",
-        { get: () => JSON.stringify(this._policy.telemetryPayload()) });
+    let currentEnvironment = yield TelemetryEnvironment.onInitialized();
+
+    Object.defineProperty(sandbox, "_e",
+      { get: () => Cu.cloneInto(currentEnvironment, sandbox) });
 
-      let result = false;
-      try {
-        result = !!Cu.evalInSandbox("filter({healthReportPayload: JSON.parse(_hr), telemetryPayload: JSON.parse(_t)})", sandbox);
-      }
-      catch (e) {
-        this._log.debug("runFilterFunction() - filter function failed: "
+    let result = false;
+    try {
+      result = !!Cu.evalInSandbox("filter({get telemetryEnvironment() { return _e; } })", sandbox);
+    }
+    catch (e) {
+      this._log.debug("runFilterFunction() - filter function failed: "
                       + e.message + ", " + e.stack);
-        throw ["jsfilter-threw", e.message];
-      }
-      finally {
-        Cu.nukeSandbox(sandbox);
-      }
+      throw ["jsfilter-threw", e.message];
+    }
+    finally {
+      Cu.nukeSandbox(sandbox);
+    }
 
-      if (!result) {
-        throw ["jsfilter-false"];
-      }
+    if (!result) {
+      throw ["jsfilter-false"];
+    }
 
-      throw new Task.Result(true);
-    }.bind(this));
-  },
+    return true;
+  }),
 
   /*
    * Start running the experiment.
    *
    * @return Promise<> Resolved when the operation is complete.
    */
   start: Task.async(function* () {
     this._log.trace("start() for " + this.id);
--- a/browser/experiments/test/xpcshell/head.js
+++ b/browser/experiments/test/xpcshell/head.js
@@ -3,28 +3,24 @@
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://services-sync/healthreport.jsm", this);
-Cu.import("resource://testing-common/services/healthreport/utils.jsm", this);
-Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
 Cu.import("resource://testing-common/AddonManagerTesting.jsm");
 
 const PREF_EXPERIMENTS_ENABLED  = "experiments.enabled";
 const PREF_LOGGING_LEVEL        = "experiments.logging.level";
 const PREF_LOGGING_DUMP         = "experiments.logging.dump";
 const PREF_MANIFEST_URI         = "experiments.manifest.uri";
 const PREF_FETCHINTERVAL        = "experiments.manifest.fetchIntervalSeconds";
 const PREF_TELEMETRY_ENABLED    = "toolkit.telemetry.enabled";
-const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
 
 function getExperimentPath(base) {
   let p = do_get_cwd();
   p.append(base);
   return p.path;
 }
 
 function sha1File(path) {
@@ -98,28 +94,16 @@ const FAKE_EXPERIMENTS_2 = [
     endDate: new Date(2014, 2, 10, 0, 0, 0, 0).getTime(),
     detailURL: "https://dummy/experiment1",
     branch: null,
   },
 ];
 
 let gAppInfo = null;
 
-function getReporter(name, uri, inspected) {
-  return Task.spawn(function init() {
-    let reporter = getHealthReporter(name, uri, inspected);
-    yield reporter.init();
-
-    yield reporter._providerManager.registerProviderFromType(
-      HealthReportProvider);
-
-    throw new Task.Result(reporter);
-  });
-}
-
 function removeCacheFile() {
   let path = OS.Path.join(OS.Constants.Path.profileDir, "experiments.json");
   return OS.File.remove(path);
 }
 
 function patchPolicy(policy, data) {
   for (let key of Object.keys(data)) {
     Object.defineProperty(policy, key, {
--- a/browser/experiments/test/xpcshell/test_activate.js
+++ b/browser/experiments/test/xpcshell/test_activate.js
@@ -8,17 +8,16 @@ Cu.import("resource:///modules/experimen
 
 const FILE_MANIFEST            = "experiments.manifest";
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir = null;
 let gHttpServer = null;
 let gHttpRoot   = null;
-let gReporter   = null;
 let gPolicy     = null;
 
 function ManifestEntry(data) {
   this.id        = data.id        || EXPERIMENT1_ID;
   this.xpiURL    = data.xpiURL    || gHttpRoot + EXPERIMENT1_XPI_NAME;
   this.xpiHash   = data.xpiHash   || EXPERIMENT1_XPI_SHA1;
   this.appName   = data.appName   || ["XPCShell"];
   this.channel   = data.appName   || ["nightly"];
@@ -38,24 +37,18 @@ add_task(function* test_setup() {
 
   gHttpServer = new HttpServer();
   gHttpServer.start(-1);
   let port = gHttpServer.identity.primaryPort;
   gHttpRoot = "http://localhost:" + port + "/";
   gHttpServer.registerDirectory("/", do_get_cwd());
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(false);
-  do_register_cleanup(() => gReporter._shutdown());
-
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => Promise.resolve(payload),
   });
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
 
   let experiments = new Experiments.Experiments();
 });
--- a/browser/experiments/test/xpcshell/test_api.js
+++ b/browser/experiments/test/xpcshell/test_api.js
@@ -14,17 +14,16 @@ const MANIFEST_HANDLER         = "manife
 
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir          = null;
 let gHttpServer          = null;
 let gHttpRoot            = null;
 let gDataRoot            = null;
-let gReporter            = null;
 let gPolicy              = null;
 let gManifestObject      = null;
 let gManifestHandlerURI  = null;
 let gTimerScheduleOffset = -1;
 
 function uninstallExperimentAddons() {
   return Task.spawn(function* () {
     let addons = yield getExperimentAddons();
@@ -66,25 +65,19 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(false);
-  do_register_cleanup(() => gReporter._shutdown());
-
   gPolicy = new Experiments.Policy();
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => Promise.resolve(payload),
     oneshotTimer: (callback, timeout, thisObj, name) => gTimerScheduleOffset = timeout,
   });
 });
 
 add_task(function* test_contract() {
   Cc["@mozilla.org/browser/experiments-service;1"].getService();
 });
 
--- a/browser/experiments/test/xpcshell/test_cache.js
+++ b/browser/experiments/test/xpcshell/test_cache.js
@@ -11,17 +11,16 @@ const MANIFEST_HANDLER         = "manife
 
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir          = null;
 let gHttpServer          = null;
 let gHttpRoot            = null;
 let gDataRoot            = null;
-let gReporter            = null;
 let gPolicy              = null;
 let gManifestObject      = null;
 let gManifestHandlerURI  = null;
 let gTimerScheduleOffset = -1;
 
 function run_test() {
   run_next_test();
 }
@@ -47,25 +46,19 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(true);
-  do_register_cleanup(() => gReporter._shutdown());
-
   gPolicy = new Experiments.Policy();
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => "{}",
     oneshotTimer: (callback, timeout, thisObj, name) => gTimerScheduleOffset = timeout,
   });
 });
 
 function checkExperimentListsEqual(list, list2) {
   Assert.equal(list.length, list2.length, "Lists should have the same length.")
 
   for (let i=0; i<list.length; ++i) {
--- a/browser/experiments/test/xpcshell/test_cacherace.js
+++ b/browser/experiments/test/xpcshell/test_cacherace.js
@@ -10,17 +10,16 @@ const MANIFEST_HANDLER         = "manife
 
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir          = null;
 let gHttpServer          = null;
 let gHttpRoot            = null;
 let gDataRoot            = null;
-let gReporter            = null;
 let gPolicy              = null;
 let gManifestObject      = null;
 let gManifestHandlerURI  = null;
 
 function run_test() {
   run_next_test();
 }
 
@@ -45,28 +44,22 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(true);
-  do_register_cleanup(() => gReporter._shutdown());
-
   let ExperimentsScope = Cu.import("resource:///modules/experiments/Experiments.jsm");
   let Experiments = ExperimentsScope.Experiments;
 
   gPolicy = new Experiments.Policy();
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => "{}",
     delayCacheWrite: (promise) => {
       return new Promise((resolve, reject) => {
         promise.then(
           (result) => { setTimeout(() => resolve(result), 500); },
           (err) => { reject(err); }
         );
       });
     },
--- a/browser/experiments/test/xpcshell/test_conditions.js
+++ b/browser/experiments/test/xpcshell/test_conditions.js
@@ -15,17 +15,16 @@ XPCOMUtils.defineLazyGetter(this, "gData
 
 const FILE_MANIFEST            = "experiments.manifest";
 const SEC_IN_ONE_DAY = 24 * 60 * 60;
 const MS_IN_ONE_DAY  = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir = null;
 let gHttpServer = null;
 let gHttpRoot   = null;
-let gReporter   = null;
 let gPolicy     = null;
 
 
 function ManifestEntry(data) {
   this.id = EXPERIMENT1_ID;
   this.xpiURL = "http://localhost:1/dummy.xpi";
   this.xpiHash = EXPERIMENT1_XPI_SHA1;
   this.startTime = new Date(2010, 0, 1, 12).getTime() / 1000;
@@ -68,25 +67,19 @@ function run_test() {
 
 add_task(function* test_setup() {
   createAppInfo();
   gProfileDir = do_get_profile();
   startAddonManagerOnly();
   yield initialiseTelemetry();
   gPolicy = new Experiments.Policy();
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(false);
-  do_register_cleanup(() => gReporter._shutdown());
-
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
     locale: () => "en-US",
-    healthReportPayload: () => Promise.resolve(payload),
     random: () => 0.5,
   });
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
 });
 
@@ -101,27 +94,21 @@ function arraysEqual(a, b) {
     }
   }
 
   return true;
 }
 
 // This function exists solely to be .toSource()d
 const sanityFilter = function filter(c) {
-  if (c.telemetryPayload === undefined) {
-    throw Error("No .telemetryPayload");
-  }
-  if (c.telemetryPayload.simpleMeasurements === undefined) {
-    throw Error("No .simpleMeasurements");
+  if (c.telemetryEnvironment === undefined) {
+    throw Error("No .telemetryEnvironment");
   }
-  if (c.healthReportPayload === undefined) {
-    throw Error("No .healthReportPayload");
-  }
-  if (c.healthReportPayload.geckoAppInfo == undefined) {
-    throw Error("No .geckoAppInfo");
+  if (c.telemetryEnvironment.build == undefined) {
+    throw Error("No .telemetryEnvironment.build");
   }
   return true;
 }
 
 add_task(function* test_simpleFields() {
   let testData = [
     // "expected applicable?", failure reason or null, manifest data
 
--- a/browser/experiments/test/xpcshell/test_disableExperiments.js
+++ b/browser/experiments/test/xpcshell/test_disableExperiments.js
@@ -14,17 +14,16 @@ const MANIFEST_HANDLER         = "manife
 
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 let gProfileDir          = null;
 let gHttpServer          = null;
 let gHttpRoot            = null;
 let gDataRoot            = null;
-let gReporter            = null;
 let gPolicy              = null;
 let gManifestObject      = null;
 let gManifestHandlerURI  = null;
 
 function run_test() {
   run_next_test();
 }
 
@@ -48,25 +47,19 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(false);
-  do_register_cleanup(() => gReporter._shutdown());
-
   gPolicy = new Experiments.Policy();
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => Promise.resolve(payload),
     oneshotTimer: (callback, timeout, thisObj, name) => {},
   });
 });
 
 // Test disabling the feature stops current and future experiments.
 
 add_task(function* test_disableExperiments() {
   const OBSERVER_TOPIC = "experiments-changed";
--- a/browser/experiments/test/xpcshell/test_healthreport.js
+++ b/browser/experiments/test/xpcshell/test_healthreport.js
@@ -5,16 +5,18 @@
 
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource:///modules/experiments/Experiments.jsm");
 Cu.import("resource://testing-common/AddonManagerTesting.jsm");
 Cu.import("resource://testing-common/services/healthreport/utils.jsm");
 Cu.import("resource://testing-common/services/common/logging.js");
 
+const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
+
 const kMeasurementVersion = 2;
 
 function getStorageAndProvider(name) {
   return Task.spawn(function* get() {
     let storage = yield Metrics.Storage(name);
     let provider = new ExperimentsProvider();
     yield provider.init(storage);
 
--- a/browser/experiments/test/xpcshell/test_telemetry.js
+++ b/browser/experiments/test/xpcshell/test_telemetry.js
@@ -14,17 +14,16 @@ const MANIFEST_HANDLER         = "manife
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 
 let gProfileDir          = null;
 let gHttpServer          = null;
 let gHttpRoot            = null;
 let gDataRoot            = null;
-let gReporter            = null;
 let gPolicy              = null;
 let gManifestObject      = null;
 let gManifestHandlerURI  = null;
 
 const TLOG = bsp.TELEMETRY_LOG;
 
 let gGlobalScope = this;
 function loadAddonManager() {
@@ -79,26 +78,20 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  gReporter = yield getReporter("json_payload_simple");
-  yield gReporter.collectMeasurements();
-  let payload = yield gReporter.getJSONPayload(false);
-  do_register_cleanup(() => gReporter._shutdown());
-
   gPolicy = new Experiments.Policy();
   let dummyTimer = { cancel: () => {}, clear: () => {} };
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
-    healthReportPayload: () => Promise.resolve(payload),
     oneshotTimer: (callback, timeout, thisObj, name) => dummyTimer,
   });
 
   yield removeCacheFile();
 });
 
 // Test basic starting and stopping of experiments.