Bug 1406392 - Make nsITelemetry.canRecordExtended true on pre release channels. r?chutten draft
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Mon, 16 Oct 2017 12:28:38 +0200
changeset 683904 f20cbcddc4dc65d27e871447fb72af0631fdf740
parent 683249 31af3ee0436093bfd3300e9002f1118df0420309
child 683905 c27e578396a4ce42cbf44e7537ff7ca968e962aa
push id85500
push useralessio.placitelli@gmail.com
push dateFri, 20 Oct 2017 14:27:56 +0000
reviewerschutten
bugs1406392
milestone58.0a1
Bug 1406392 - Make nsITelemetry.canRecordExtended true on pre release channels. r?chutten MozReview-Commit-ID: 2FR5dekXbeV
toolkit/components/backgroundhangmonitor/tests/test_BHRObserver.js
toolkit/components/telemetry/TelemetryController.jsm
toolkit/components/telemetry/TelemetryUtils.jsm
toolkit/components/telemetry/docs/internals/preferences.rst
toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
toolkit/components/telemetry/tests/unit/test_ChildEvents.js
toolkit/components/telemetry/tests/unit/test_ChildHistograms.js
toolkit/components/telemetry/tests/unit/test_ChildScalars.js
toolkit/components/telemetry/tests/unit/test_PingAPI.js
toolkit/components/telemetry/tests/unit/test_PingSender.js
toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js
toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
toolkit/components/telemetry/tests/unit/test_TelemetryController.js
toolkit/components/telemetry/tests/unit/test_TelemetryControllerBuildID.js
toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
toolkit/components/telemetry/tests/unit/test_TelemetryController_idle.js
toolkit/components/telemetry/tests/unit/test_TelemetryLog.js
toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
toolkit/components/telemetry/tests/unit/test_TelemetrySession_activeTicks.js
--- a/toolkit/components/backgroundhangmonitor/tests/test_BHRObserver.js
+++ b/toolkit/components/backgroundhangmonitor/tests/test_BHRObserver.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 let { classes: Cc, utils: Cu, interfaces: Ci, results: Cr } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
+const { TelemetryUtils } = Cu.import("resource://gre/modules/TelemetryUtils.jsm", {});
 
 function ensureProfilerInitialized() {
   // Starting and stopping the profiler with the "stackwalk" flag will cause the
   // profiler's stackwalking features to be synchronously initialized. This
   // should prevent us from not initializing BHR quickly enough.
   if (!Services.profiler.CanProfile()) {
     return false;
   }
@@ -68,16 +69,17 @@ add_task(async function test_BHRObserver
     while ((Date.now() - startTime) < 10000);
   });
 
   do_execute_soon(() => {
     let startTime = Date.now();
     while ((Date.now() - startTime) < 1000);
   });
 
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   let childDone = run_test_in_child("child_cause_hang.js");
 
   // Now we wait for the hangs to have their bhr-thread-hang message fired for
   // them, collect them, and analyize the response.
   let hangs = await hangsPromise;
   equal(hangs.length, 3);
   hangs.forEach(hang => {
     ok(hang.duration > 0);
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -618,19 +618,29 @@ var Impl = {
       Telemetry.canRecordBase = false;
       Telemetry.canRecordExtended = false;
       return false;
     }
 
     // Configure base Telemetry recording.
     // Unified Telemetry makes it opt-out. If extended Telemetry is enabled, base recording
     // is always on as well.
-    const enabled = Utils.isTelemetryEnabled;
-    Telemetry.canRecordBase = enabled || IS_UNIFIED_TELEMETRY;
-    Telemetry.canRecordExtended = enabled;
+    if (IS_UNIFIED_TELEMETRY) {
+      // Enable extended Telemetry on pre-release channels and disable it
+      // on Release/ESR.
+      const isPrereleaseChannel =
+        ["nightly", "aurora", "beta"].includes(AppConstants.MOZ_UPDATE_CHANNEL);
+      Telemetry.canRecordBase = true;
+      Telemetry.canRecordExtended = isPrereleaseChannel ||
+        Services.prefs.getBoolPref(TelemetryUtils.Preferences.OverridePreRelease, false);
+    } else {
+      // We're not on unified Telemetry, stick to the old behaviour for
+      // supporting Fennec.
+      Telemetry.canRecordBase = Telemetry.canRecordExtended = Utils.isTelemetryEnabled;
+    }
 
     this._log.config("enableTelemetryRecording - canRecordBase:" + Telemetry.canRecordBase +
                      ", canRecordExtended: " + Telemetry.canRecordExtended);
 
     return Telemetry.canRecordBase;
   },
 
   /**
--- a/toolkit/components/telemetry/TelemetryUtils.jsm
+++ b/toolkit/components/telemetry/TelemetryUtils.jsm
@@ -27,16 +27,17 @@ this.TelemetryUtils = {
   Preferences: Object.freeze({
     // General Preferences
     ArchiveEnabled: "toolkit.telemetry.archive.enabled",
     CachedClientId: "toolkit.telemetry.cachedClientID",
     FirstRun: "toolkit.telemetry.reportingpolicy.firstRun",
     FirstShutdownPingEnabled: "toolkit.telemetry.firstShutdownPing.enabled",
     HealthPingEnabled: "toolkit.telemetry.healthping.enabled",
     OverrideOfficialCheck: "toolkit.telemetry.send.overrideOfficialCheck",
+    OverridePreRelease: "toolkit.telemetry.testing.overridePreRelease",
     Server: "toolkit.telemetry.server",
     ShutdownPingSender: "toolkit.telemetry.shutdownPingSender.enabled",
     ShutdownPingSenderFirstSession: "toolkit.telemetry.shutdownPingSender.enabledFirstSession",
     TelemetryEnabled: "toolkit.telemetry.enabled",
     Unified: "toolkit.telemetry.unified",
     UpdatePing: "toolkit.telemetry.updatePing.enabled",
     NewProfilePingEnabled: "toolkit.telemetry.newProfilePing.enabled",
     NewProfilePingDelay: "toolkit.telemetry.newProfilePing.delay",
--- a/toolkit/components/telemetry/docs/internals/preferences.rst
+++ b/toolkit/components/telemetry/docs/internals/preferences.rst
@@ -145,11 +145,15 @@ The following prefs are for testing purp
 ``toolkit.telemetry.modulesPing.interval``
 
   Interval between "modules" ping transmissions.
 
 ``toolkit.telemetry.send.overrideOfficialCheck``
 
   If true, allows sending pings on unofficial builds. Requires a restart.
 
+``toolkit.telemetry.testing.overridePreRelease``
+
+  If true, allows recording opt-in Telemetry on the Release channel. Requires a restart.
+
 ``toolkit.telemetry.healthping.enabled``
 
   If false, sending health pings is disabled. Defaults to true.
--- a/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
+++ b/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
@@ -1,30 +1,33 @@
 "use strict";
 
 const { ContentTaskUtils } = Cu.import("resource://testing-common/ContentTaskUtils.jsm", {});
 const { TelemetryController } = Cu.import("resource://gre/modules/TelemetryController.jsm", {});
+const { TelemetryUtils } = Cu.import("resource://gre/modules/TelemetryUtils.jsm", {});
 
 const CONTENT_CREATED = "ipc:content-created";
 
 async function waitForProcessesScalars(aProcesses, aKeyed,
                                        aAdditionalCondition = (data) => true) {
   await ContentTaskUtils.waitForCondition(() => {
     const scalars = aKeyed ?
       Services.telemetry.snapshotKeyedScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN) :
       Services.telemetry.snapshotScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN);
     return aProcesses.every(p => Object.keys(scalars).includes(p))
            && aAdditionalCondition(scalars);
   });
 }
 
 add_task(async function test_setup() {
+  // Make sure the newly spawned content processes will have extended Telemetry enabled.
   await SpecialPowers.pushPrefEnv({
-    set: [["toolkit.telemetry.enabled", true]]
+    set: [[TelemetryUtils.Preferences.OverridePreRelease, true]]
   });
+  // And take care of the already initialized one as well.
   let canRecordExtended = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
   registerCleanupFunction(() => Services.telemetry.canRecordExtended = canRecordExtended);
 });
 
 add_task(async function test_recording() {
   let currentPid = gBrowser.selectedBrowser.frameLoader.tabParent.osPid;
 
--- a/toolkit/components/telemetry/tests/unit/test_ChildEvents.js
+++ b/toolkit/components/telemetry/tests/unit/test_ChildEvents.js
@@ -70,17 +70,17 @@ add_task(async function() {
     do_send_remote_message(MESSAGE_CHILD_TEST_DONE);
     return;
   }
 
   // Setup.
   do_get_profile(true);
   loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
   finishAddonManagerStartup();
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   await TelemetryController.testSetup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
   // Enable recording for the test event category.
   Telemetry.setEventRecordingEnabled("telemetry.test", true);
 
   // Register dynamic test events.
   Telemetry.registerEvents("telemetry.test.dynamic", {
--- a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js
+++ b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js
@@ -86,17 +86,17 @@ add_task(async function() {
     dump("... done with child test\n");
     do_send_remote_message(MESSAGE_CHILD_TEST_DONE);
     return;
   }
 
   // Setup.
   do_get_profile(true);
   loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   finishAddonManagerStartup();
   await TelemetryController.testSetup();
   if (runningInParent) {
     // Make sure we don't generate unexpected pings due to pref changes.
     await setEmptyPrefWatchlist();
   }
 
   // Run test in child, don't wait for it to finish.
--- a/toolkit/components/telemetry/tests/unit/test_ChildScalars.js
+++ b/toolkit/components/telemetry/tests/unit/test_ChildScalars.js
@@ -135,17 +135,17 @@ add_task(async function() {
     run_child_test();
     do_send_remote_message(MESSAGE_CHILD_TEST_DONE);
     return;
   }
 
   // Setup.
   do_get_profile(true);
   loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   finishAddonManagerStartup();
   await TelemetryController.testSetup();
   if (runningInParent) {
     setParentScalars();
     // Make sure we don't generate unexpected pings due to pref changes.
     await setEmptyPrefWatchlist();
   }
 
--- a/toolkit/components/telemetry/tests/unit/test_PingAPI.js
+++ b/toolkit/components/telemetry/tests/unit/test_PingAPI.js
@@ -63,17 +63,17 @@ var getArchivedPingsInfo = async functio
   archivedPings.sort((a, b) => b.timestamp - a.timestamp);
   return archivedPings;
 };
 
 add_task(async function test_setup() {
   do_get_profile(true);
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
 });
 
 add_task(async function test_archivedPings() {
   // TelemetryController should not be fully initialized at this point.
   // Submitting pings should still work fine.
 
   const PINGS = [
     {
--- a/toolkit/components/telemetry/tests/unit/test_PingSender.js
+++ b/toolkit/components/telemetry/tests/unit/test_PingSender.js
@@ -35,17 +35,17 @@ function waitForPingDeletion(pingId) {
 
   return new Promise((resolve, reject) => checkFn(resolve, reject));
 }
 
 add_task(async function setup() {
   // Init the profile.
   do_get_profile(true);
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 
   // Start the ping server and let Telemetry know about it.
   PingServer.start();
 });
 
 add_task(async function test_pingSender() {
   // Generate a new ping and save it among the pending pings.
--- a/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js
+++ b/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js
@@ -86,17 +86,17 @@ add_task(async function test_setup() {
 
   // Addon manager needs a profile directory
   do_get_profile();
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Preferences.set(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Preferences.set(TelemetryUtils.Preferences.OverridePreRelease, true);
 });
 
 add_task(async function test_subsessionsChaining() {
   if (gIsAndroid) {
     // We don't support subsessions yet on Android, so skip the next checks.
     return;
   }
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
@@ -178,11 +178,11 @@ add_task({
     let stacks = captureStacks(badKey);
     let captureData = stacks.captures.find(capture => capture[0] === badKey);
     Assert.ok(!captureData, `"${badKey}" should not be allowed as a key`);
   }
 });
 
 function run_test() {
   do_get_profile(true);
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   run_next_test();
 }
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
@@ -91,17 +91,17 @@ function checkPingFormat(aPing, aType, a
 add_task(async function test_setup() {
   // Addon manager needs a profile directory
   do_get_profile();
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 
   await new Promise(resolve =>
     Telemetry.asyncFetchTelemetryData(wrapWithExceptionHandler(resolve)));
 });
 
 add_task(async function asyncSetup() {
   await TelemetryController.testSetup();
@@ -417,17 +417,18 @@ add_task(async function test_changePingA
   const pingId = await pingPromise;
 
   // Make sure our changes didn't affect the submitted payload.
   let archivedCopy = await TelemetryArchive.promiseArchivedPingById(pingId);
   Assert.equal(archivedCopy.payload.canary, "test",
                "The payload must not be changed after being submitted.");
 });
 
-add_task(async function test_telemetryEnabledUnexpectedValue() {
+add_task({ skip_if: () => Services.prefs.getBoolPref(TelemetryUtils.Preferences.Unified, false)},
+         async function test_telemetryEnabledUnexpectedValue() {
   // Remove the default value for toolkit.telemetry.enabled from the default prefs.
   // Otherwise, we wouldn't be able to set the pref to a string.
   let defaultPrefBranch = Services.prefs.getDefaultBranch(null);
   defaultPrefBranch.deleteBranch(TelemetryUtils.Preferences.TelemetryEnabled);
 
   // Set the preferences controlling the Telemetry status to a string.
   Preferences.set(TelemetryUtils.Preferences.TelemetryEnabled, "false");
   // Check that Telemetry is not enabled.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerBuildID.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerBuildID.js
@@ -15,19 +15,16 @@
 
 "use strict";
 
 Cu.import("resource://gre/modules/Services.jsm", this);
 Cu.import("resource://gre/modules/TelemetryController.jsm", this);
 Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-// Force the Telemetry enabled preference so that TelemetrySession.testReset() doesn't exit early.
-Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
-
 // Set up our dummy AppInfo object so we can control the appBuildID.
 Cu.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo();
 
 // Check that when run with no previous build ID stored, we update the pref but do not
 // put anything into the metadata.
 add_task(async function test_firstRun() {
   await TelemetryController.testReset();
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
@@ -25,17 +25,17 @@ function contentHandler(metadata, respon
 add_task(async function test_setup() {
   // Addon manager needs a profile directory
   do_get_profile();
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 });
 
 /**
  * Ensures that TelemetryController does not hang processing shutdown
  * phases. Assumes that Telemetry shutdown routines do not take longer than
  * CRASH_TIMEOUT_MS to complete.
  */
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController_idle.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController_idle.js
@@ -14,17 +14,17 @@ Cu.import("resource://gre/modules/Teleme
 var gHttpServer = null;
 
 add_task(async function test_setup() {
   do_get_profile();
 
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 
   // Start the webserver to check if the pending ping correctly arrives.
   gHttpServer = new HttpServer();
   gHttpServer.start(-1);
 });
 
 add_task(async function testSendPendingOnIdleDaily() {
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryLog.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryLog.js
@@ -22,17 +22,17 @@ function check_event(event, id, data) {
       do_check_eq(typeof(event[i + 2]), "string");
       do_check_eq(event[i + 2], data[i]);
     }
   }
 }
 
 add_task(async function() {
   do_get_profile();
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   await TelemetryController.testSetup();
 
   TelemetryLog.log(TEST_PREFIX + "1", ["val", 123, undefined]);
   TelemetryLog.log(TEST_PREFIX + "2", []);
   TelemetryLog.log(TEST_PREFIX + "3");
 
   var log = TelemetrySession.getPayload().log.filter(function(e) {
     // Only want events that were generated by the test.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
@@ -52,17 +52,17 @@ add_task(async function test_setup() {
   // Addon manager needs a profile directory
   do_get_profile(true);
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
 
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   // Don't bypass the notifications in this test, we'll fake it.
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.BypassNotification, false);
 
   TelemetryReportingPolicy.setup();
 });
 
 add_task(async function test_firstRun() {
   const FIRST_RUN_TIMEOUT_MSEC = 60 * 1000; // 60s
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -79,17 +79,17 @@ function histogramValueCount(h) {
   return h.counts.reduce((a, b) => a + b);
 }
 
 add_task(async function test_setup() {
   // Trigger a proper telemetry init.
   do_get_profile(true);
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.HealthPingEnabled, true);
   TelemetryStopwatch.setTestModeEnabled(true);
 });
 
 // Test the ping sending logic.
 add_task(async function test_sendPendingPings() {
   const TYPE_PREFIX = "test-sendPendingPings-";
   const TEST_TYPE_A = TYPE_PREFIX + "A";
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
@@ -143,17 +143,17 @@ add_task(async function test_setup() {
   PingServer.start();
   PingServer.registerPingHandler(pingHandler);
   do_get_profile();
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setCharPref(TelemetryUtils.Preferences.Server,
                               "http://localhost:" + PingServer.port);
 });
 
 /**
  * Setup the tests by making sure the ping storage directory is available, otherwise
  * |TelemetryController.testSaveDirectoryToFile| could fail.
  */
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -473,17 +473,17 @@ function write_fake_failedprofilelocks_f
 add_task(async function test_setup() {
   // Addon manager needs a profile directory
   do_get_profile();
   loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 
   // Make it look like we've previously failed to lock a profile a couple times.
   write_fake_failedprofilelocks_file();
 
   // Make it look like we've shutdown before.
   write_fake_shutdown_file();
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession_activeTicks.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession_activeTicks.js
@@ -9,17 +9,17 @@ Cu.import("resource://gre/modules/Teleme
 add_task(async function test_setup() {
   // Addon manager needs a profile directory
   do_get_profile();
   loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   finishAddonManagerStartup();
   // Make sure we don't generate unexpected pings due to pref changes.
   await setEmptyPrefWatchlist();
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  Services.prefs.setBoolPref(TelemetryUtils.Preferences.OverridePreRelease, true);
 });
 
 add_task(async function test_record_activeTicks() {
   await TelemetryController.testSetup();
 
   let checkActiveTicks = (expected) => {
     // Scalars are only present in subsession payloads.
     let payload = TelemetrySession.getPayload("main");