bug 1406391 - Remove toolkit.telemetry.enabled manipulation from tests r?Dexter draft
authorChris H-C <chutten@mozilla.com>
Wed, 18 Oct 2017 10:40:08 -0400
changeset 686234 006d3be0ee2b186dfc60782c05da5d16ff62978e
parent 686233 56b45802e3e6dcd827b509c8aac13f003472f40b
child 686235 ec12cb8db635ef0ab935d8db17e0a657286f6c3d
push id86134
push userbmo:chutten@mozilla.com
push dateWed, 25 Oct 2017 16:14:43 +0000
reviewersDexter
bugs1406391
milestone58.0a1
bug 1406391 - Remove toolkit.telemetry.enabled manipulation from tests r?Dexter Minor notes: test_telemetry_disabled is removed as it no longer makes sense. reftests should've turned off uploadEnabled in the first place.
browser/components/search/test/browser_contextSearchTabPosition.js
browser/components/search/test/browser_healthreport.js
browser/components/translation/test/browser_translation_telemetry.js
browser/experiments/test/xpcshell/head.js
browser/experiments/test/xpcshell/test_telemetry_disabled.js
browser/modules/test/browser/browser_UsageTelemetry_content.js
browser/modules/test/browser/browser_UsageTelemetry_content_aboutHome.js
browser/modules/test/browser/browser_UsageTelemetry_searchbar.js
browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
dom/ipc/tests/browser_memory_distribution_telemetry.js
dom/ipc/tests/browser_remote_navigation_delay_telemetry.js
dom/security/test/hsts/head.js
js/src/tests/user.js
layout/tools/reftest/reftest-preferences.js
testing/mozbase/mozprofile/mozprofile/profile.py
toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_telemetry.html
toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
toolkit/mozapps/extensions/test/browser/browser_experiments.js
toolkit/mozapps/update/tests/data/shared.js
toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
--- a/browser/components/search/test/browser_contextSearchTabPosition.js
+++ b/browser/components/search/test/browser_contextSearchTabPosition.js
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(async function test() {
-  await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
   let engine = await promiseNewEngine("testEngine.xml");
   let histogramKey = "other-" + engine.name + ".contextmenu";
   let numSearchesBefore = 0;
 
   try {
     let hs = Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").snapshot();
     if (histogramKey in hs) {
       numSearchesBefore = hs[histogramKey].sum;
--- a/browser/components/search/test/browser_healthreport.js
+++ b/browser/components/search/test/browser_healthreport.js
@@ -71,17 +71,16 @@ function test() {
         Services.obs.removeObserver(observer, "browser-search-engine-modified");
         finish();
         break;
     }
   }
 
   Services.obs.addObserver(observer, "browser-search-engine-modified");
   SpecialPowers.pushPrefEnv({set: [
-    ["toolkit.telemetry.enabled", true],
     ["browser.search.widget.inNavBar", true],
   ]}).then(function() {
     Services.search.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml",
                               null, "data:image/x-icon,%00", false);
   });
 }
 
 function resetPreferences() {
--- a/browser/components/translation/test/browser_translation_telemetry.js
+++ b/browser/components/translation/test/browser_translation_telemetry.js
@@ -148,17 +148,16 @@ add_task(async function setup() {
 
   const restorePrefs = (prefs, backup) => {
     for (let p of prefs) {
       Services.prefs.setBoolPref(p, backup[p]);
     }
   };
 
   const prefs = [
-    "toolkit.telemetry.enabled",
     "browser.translation.detectLanguage",
     "browser.translation.ui.show"
   ];
 
   let prefsBackup = setupPrefs(prefs);
 
   let oldCanRecord = Telemetry.canRecordExtended;
   Telemetry.canRecordExtended = true;
--- a/browser/experiments/test/xpcshell/head.js
+++ b/browser/experiments/test/xpcshell/head.js
@@ -21,17 +21,16 @@ Cu.import("resource://testing-common/Add
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.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";
 
 function getExperimentPath(base) {
   let p = do_get_cwd();
   p.append(base);
   return p.path;
 }
 
 function sha1File(path) {
@@ -188,11 +187,9 @@ function replaceExperiments(experiment, 
   Object.defineProperty(experiment, "getExperiments", {
     writable: true,
     value: () => {
       return Promise.resolve(list);
     },
   });
 }
 
-// Experiments require Telemetry to be enabled, and that's not true for debug
-// builds. Let's just enable it here instead of going through each test.
-Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
+Services.telemetry.canRecordExtended = true;
--- a/browser/experiments/test/xpcshell/test_telemetry_disabled.js
+++ b/browser/experiments/test/xpcshell/test_telemetry_disabled.js
@@ -5,24 +5,16 @@
 
 Cu.import("resource:///modules/experiments/Experiments.jsm");
 
 add_test(function test_experiments_activation() {
   do_get_profile();
   loadAddonManager();
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
-  Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false);
+  Services.telemetry.canRecordExtended = false;
 
   let experiments = Experiments.instance();
 
   Assert.ok(!experiments.enabled, "Experiments must be disabled if Telemetry is disabled.");
 
-  // Patch updateManifest to not do anything when the pref is switched back to true,
-  // otherwise it attempts to connect to the server.
-  experiments.updateManifest = () => Promise.resolve();
-
-  Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
-
-  Assert.ok(experiments.enabled, "Experiments must be re-enabled if Telemetry is re-enabled");
-
   run_next_test();
 });
--- a/browser/modules/test/browser/browser_UsageTelemetry_content.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_content.js
@@ -20,17 +20,16 @@ add_task(async function setup() {
   Services.search.currentEngine = engineDefault;
 
   // Move the second engine at the beginning of the one-off list.
   let engineOneOff = Services.search.getEngineByName("MozSearch2");
   Services.search.moveEngine(engineOneOff, 0);
 
   await SpecialPowers.pushPrefEnv({"set": [
     ["dom.select_events.enabled", true], // We want select events to be fired.
-    ["toolkit.telemetry.enabled", true]  // And Extended Telemetry to be enabled.
   ]});
 
   // Enable event recording for the events tested here.
   Services.telemetry.setEventRecordingEnabled("navigation", true);
 
   // Make sure to restore the engine once we're done.
   registerCleanupFunction(async function() {
     Services.search.currentEngine = originalEngine;
--- a/browser/modules/test/browser/browser_UsageTelemetry_content_aboutHome.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_content_aboutHome.js
@@ -22,19 +22,16 @@ add_task(async function setup() {
   let engineDefault = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engineDefault;
 
   // Move the second engine at the beginning of the one-off list.
   let engineOneOff = Services.search.getEngineByName("MozSearch2");
   Services.search.moveEngine(engineOneOff, 0);
 
-  // Enable Extended Telemetry.
-  await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
-
   // Enable event recording for the events tested here.
   Services.telemetry.setEventRecordingEnabled("navigation", true);
 
   // Make sure to restore the engine once we're done.
   registerCleanupFunction(async function() {
     Services.search.currentEngine = originalEngine;
     Services.search.removeEngine(engineDefault);
     Services.search.removeEngine(engineOneOff);
--- a/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js
@@ -85,19 +85,16 @@ add_task(async function setup() {
   // Move the second engine at the beginning of the one-off list.
   let engineOneOff = Services.search.getEngineByName("MozSearch2");
   Services.search.moveEngine(engineOneOff, 0);
 
   // Enable local telemetry recording for the duration of the tests.
   let oldCanRecord = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
 
-  // Enable Extended Telemetry.
-  await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
-
   // Enable event recording for the events tested here.
   Services.telemetry.setEventRecordingEnabled("navigation", true);
 
   // Make sure to restore the engine once we're done.
   registerCleanupFunction(function() {
     Services.telemetry.canRecordExtended = oldCanRecord;
     Services.search.currentEngine = originalEngine;
     Services.search.removeEngine(engineDefault);
--- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
@@ -84,19 +84,16 @@ add_task(async function setup() {
 
   // Enable search suggestions in the urlbar.
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
 
   // Enable the urlbar one-off buttons.
   Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
 
-  // Enable Extended Telemetry.
-  await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
-
   // Enable local telemetry recording for the duration of the tests.
   let oldCanRecord = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
 
   // Enable event recording for the events tested here.
   Services.telemetry.setEventRecordingEnabled("navigation", true);
 
   // Clear history so that history added by previous tests doesn't mess up this
--- a/dom/ipc/tests/browser_memory_distribution_telemetry.js
+++ b/dom/ipc/tests/browser_memory_distribution_telemetry.js
@@ -21,17 +21,16 @@ add_task(async function test_memory_dist
   waitForExplicitFinish();
 
   if (SpecialPowers.getIntPref("dom.ipc.processCount", 1) < 2) {
     ok(true, "Skip this test if e10s-multi is disabled.");
     finish();
     return;
   }
 
-  await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
   Services.telemetry.canRecordExtended = true;
 
   let histogram = Services.telemetry.getKeyedHistogramById("MEMORY_DISTRIBUTION_AMONG_CONTENT");
   histogram.clear();
 
   let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, DUMMY_PAGE_DATA_URI);
   let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, DUMMY_PAGE_DATA_URI);
   let tab3 = await BrowserTestUtils.openNewForegroundTab(gBrowser, DUMMY_PAGE_DATA_URI);
--- a/dom/ipc/tests/browser_remote_navigation_delay_telemetry.js
+++ b/dom/ipc/tests/browser_remote_navigation_delay_telemetry.js
@@ -3,17 +3,16 @@
 var session = Cu.import("resource://gre/modules/TelemetrySession.jsm", {});
 
 add_task(async function test_memory_distribution() {
   if (Services.prefs.getIntPref("dom.ipc.processCount", 1) < 2) {
     ok(true, "Skip this test if e10s-multi is disabled.");
     return;
   }
 
-  await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
   let canRecordExtended = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
   registerCleanupFunction(() => Services.telemetry.canRecordExtended = canRecordExtended);
 
   Services.telemetry.snapshotKeyedHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
                                              true /* subsession */,
                                              true /* clear */);
 
--- a/dom/security/test/hsts/head.js
+++ b/dom/security/test/hsts/head.js
@@ -403,17 +403,16 @@ function SetupPrefTestEnvironment(which,
   var prefs = [["security.mixed_content.block_active_content",
                 settings.block_active],
                ["security.mixed_content.block_display_content",
                 settings.block_display],
                ["security.mixed_content.use_hsts",
                 settings.use_hsts],
                ["security.mixed_content.send_hsts_priming",
                 settings.send_hsts_priming],
-               ["toolkit.telemetry.enabled", true],
   ];
 
   if (additional_prefs) {
     for (let idx in additional_prefs) {
       prefs.push(additional_prefs[idx]);
     }
   }
 
--- a/js/src/tests/user.js
+++ b/js/src/tests/user.js
@@ -17,17 +17,17 @@ user_pref("browser.warnOnQuit", false);
 user_pref("browser.cache.check_doc_frequency", 1);
 user_pref("extensions.checkCompatibility", false);
 user_pref("extensions.checkUpdateSecurity", false);
 user_pref("browser.EULA.override", true);
 user_pref("javascript.options.strict", false);
 user_pref("javascript.options.werror", false);
 user_pref("toolkit.startup.max_resumed_crashes", -1);
 user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true);
-user_pref("toolkit.telemetry.enabled", false);
+user_pref("datareporting.healthreport.uploadEnabled", false);
 user_pref("browser.safebrowsing.phishing.enabled", false);
 user_pref("browser.safebrowsing.malware.enabled", false);
 user_pref("browser.safebrowsing.blockedURIs.enabled", false);
 user_pref("browser.safebrowsing.passwords.enabled", false);
 user_pref("plugins.flashBlock.enabled", false);
 user_pref("privacy.trackingprotection.annotate_channels", false);
 user_pref("privacy.trackingprotection.enabled", false);
 user_pref("privacy.trackingprotection.pbmode.enabled", false);
--- a/layout/tools/reftest/reftest-preferences.js
+++ b/layout/tools/reftest/reftest-preferences.js
@@ -82,16 +82,17 @@ user_pref("security.view-source.reachabl
 
 // Skip data reporting policy notifications.
 user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
 
 // Ensure that telemetry is disabled, so we don't connect to the telemetry
 // server in the middle of the tests.
 user_pref("toolkit.telemetry.enabled", false);
 user_pref("toolkit.telemetry.unified", false);
+user_pref("datareporting.healthreport.uploadEnabled", false);
 // Likewise for safebrowsing.
 user_pref("browser.safebrowsing.phishing.enabled", false);
 user_pref("browser.safebrowsing.malware.enabled", false);
 user_pref("browser.safebrowsing.blockedURIs.enabled", false);
 user_pref("browser.safebrowsing.passwords.enabled", false);
 user_pref("browser.safebrowsing.downloads.remote.url", "http://127.0.0.1/safebrowsing-dummy/gethash");
 user_pref("browser.safebrowsing.provider.google.gethashURL", "http://127.0.0.1/safebrowsing-dummy/gethash");
 user_pref("browser.safebrowsing.provider.google.updateURL", "http://127.0.0.1/safebrowsing-dummy/update");
--- a/testing/mozbase/mozprofile/mozprofile/profile.py
+++ b/testing/mozbase/mozprofile/mozprofile/profile.py
@@ -396,18 +396,16 @@ class FirefoxProfile(Profile):
         # Enable test mode to run multiple tests in parallel
         'focusmanager.testmode': True,
         # Enable test mode to not raise an OS level dialog for location sharing
         'geo.provider.testing': True,
         # Suppress delay for main action in popup notifications
         'security.notification_enable_delay': 0,
         # Suppress automatic safe mode after crashes
         'toolkit.startup.max_resumed_crashes': -1,
-        # Don't report telemetry information
-        'toolkit.telemetry.enabled': False,
         # Don't send Telemetry reports to the production server. This is
         # needed as Telemetry sends pings also if FHR upload is enabled.
         'toolkit.telemetry.server': 'http://%(server)s/telemetry-dummy/',
     }
 
 
 class ThunderbirdProfile(Profile):
     """Specialized Profile subclass for Thunderbird"""
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_telemetry.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_telemetry.html
@@ -12,22 +12,16 @@
 
 <script>
 "use strict";
 
 const HISTOGRAM = "WEBEXT_CONTENT_SCRIPT_INJECTION_MS";
 
 add_task(async function test_contentscript_telemetry() {
   // Turn on telemetry and reset it to the previous state once the test is completed.
-  // NOTE: This is only needed on Android (which does not properly support unified telemetry,
-  // while we're always recording opt-out telemetry on desktop).
-  // Switching the "toolkit.telemetry.enabled" preference
-  // (e.g. using SpecialPowers.pushPrefEnv) is unfortunately not enough,
-  // because the TelemetryController has been already initialized when this
-  // code is going to be executed.
   const telemetryCanRecordBase = SpecialPowers.Services.telemetry.canRecordBase;
   SpecialPowers.Services.telemetry.canRecordBase = true;
   SimpleTest.registerCleanupFunction(() => {
     SpecialPowers.Services.telemetry.canRecordBase = telemetryCanRecordBase;
   });
 
   function background() {
     browser.test.onMessage.addListener(() => {
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
@@ -48,17 +48,16 @@ function fakeSendSubmissionTimeout(timeO
   telemetryHealthPing.Policy.pingSubmissionTimeout = () => timeOut;
 }
 
 add_task(async function 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("toolkit.telemetry.enabled", true);
   Preferences.set(TelemetryUtils.Preferences.HealthPingEnabled, true);
 
   await TelemetryController.testSetup();
   PingServer.start();
   TelemetrySend.setServer("http://localhost:" + PingServer.port);
   Preferences.set(TelemetryUtils.Preferences.Server, "http://localhost:" + PingServer.port);
 });
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -551,20 +551,24 @@ add_task(async function test_pref_observ
   // This test requires the presence of the crash reporter component.
   let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
   if (!registrar.isContractIDRegistered("@mozilla.org/toolkit/crash-reporter;1")) {
     return;
   }
 
   await TelemetrySend.setup(true);
 
+  const IS_UNIFIED_TELEMETRY = Services.prefs.getBoolPref(TelemetryUtils.Preferences.Unified, false);
+
   let origTelemetryEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.TelemetryEnabled);
   let origFhrUploadEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled);
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  if (!IS_UNIFIED_TELEMETRY) {
+    Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
+  }
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
 
   function waitAnnotateCrashReport(expectedValue, trigger) {
     return new Promise(function(resolve, reject) {
       let keys = new Set(["TelemetryClientId", "TelemetryServerURL"]);
 
       let crs = {
         QueryInterface: XPCOMUtils.generateQI([Ci.nsICrashReporter]),
@@ -597,25 +601,21 @@ add_task(async function test_pref_observ
       do_register_cleanup(function() {
         MockRegistrar.unregister(gMockCrs);
       });
 
       trigger();
     });
   }
 
-  const IS_UNIFIED_TELEMETRY = Services.prefs.getBoolPref(TelemetryUtils.Preferences.Unified, false);
-
-  await waitAnnotateCrashReport(IS_UNIFIED_TELEMETRY, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, false));
-
-  await waitAnnotateCrashReport(true, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true));
-
   await waitAnnotateCrashReport(!IS_UNIFIED_TELEMETRY, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, false));
 
   await waitAnnotateCrashReport(true, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true));
 
-  Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, origTelemetryEnabled);
+  if (!IS_UNIFIED_TELEMETRY) {
+    Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, origTelemetryEnabled);
+  }
   Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, origFhrUploadEnabled);
 });
 
 add_task(async function cleanup() {
   await PingServer.stop();
 });
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
@@ -77,17 +77,16 @@ function clickUndoButton(addonElement) {
 }
 
 add_task(async function initializeState() {
   gManagerWindow = await open_manager();
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   registerCleanupFunction(() => {
     Services.prefs.clearUserPref("experiments.enabled");
-    Services.prefs.clearUserPref("toolkit.telemetry.enabled");
     if (gHttpServer) {
       gHttpServer.stop(() => {});
       if (gSavedManifestURI !== undefined) {
         Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
       }
     }
     if (gExperiments) {
       let tmp = {};
@@ -261,17 +260,16 @@ add_task(async function testActivateExpe
   });
 
   gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
   Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
 
   // We need to remove the cache file to help ensure consistent state.
   await OS.File.remove(gExperiments._cacheFilePath);
 
-  Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
   Services.prefs.setBoolPref("experiments.enabled", true);
 
   info("Initializing experiments service.");
   await gExperiments.init();
   info("Experiments service finished first run.");
 
   // Check conditions, just to be sure.
   let experiments = await gExperiments.getExperiments();
@@ -603,18 +601,16 @@ add_task(async function testCleanup() {
   if (gExperiments) {
     Services.prefs.clearUserPref("experiments.enabled");
     Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
 
     // We perform the uninit/init cycle to purge any leftover state.
     await OS.File.remove(gExperiments._cacheFilePath);
     await gExperiments.uninit();
     await gExperiments.init();
-
-    Services.prefs.clearUserPref("toolkit.telemetry.enabled");
   }
 
   // Check post-conditions.
   let addons = await getExperimentAddons();
   Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
 
   await close_manager(gManagerWindow);
 });
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -28,17 +28,16 @@ const PREF_APP_UPDATE_SOCKET_MAXERRORS  
 const PREF_APP_UPDATE_STAGING_ENABLED            = "app.update.staging.enabled";
 const PREF_APP_UPDATE_URL                        = "app.update.url";
 const PREF_APP_UPDATE_URL_DETAILS                = "app.update.url.details";
 const PREF_APP_UPDATE_URL_MANUAL                 = "app.update.url.manual";
 
 const PREFBRANCH_APP_PARTNER         = "app.partner.";
 const PREF_DISTRIBUTION_ID           = "distribution.id";
 const PREF_DISTRIBUTION_VERSION      = "distribution.version";
-const PREF_TOOLKIT_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
 
 const NS_APP_PROFILE_DIR_STARTUP   = "ProfDS";
 const NS_APP_USER_PROFILE_50_DIR   = "ProfD";
 const NS_GRE_DIR                   = "GreD";
 const NS_GRE_BIN_DIR               = "GreBinD";
 const NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD";
 const XRE_EXECUTABLE_FILE          = "XREExeF";
 const XRE_UPDATE_ROOT_DIR          = "UpdRootD";
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -1032,18 +1032,16 @@ function setDefaultPrefs() {
   Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
   if (DEBUG_AUS_TEST) {
     // Enable Update logging
     Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true);
   } else {
     // Some apps set this preference to true by default
     Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, false);
   }
-  // In case telemetry is enabled for xpcshell tests.
-  Services.prefs.setBoolPref(PREF_TOOLKIT_TELEMETRY_ENABLED, false);
 }
 
 /**
  * Helper function for updater binary tests that sets the appropriate values
  * to check for update failures.
  */
 function setTestFilesAndDirsForFailure() {
   gTestFiles.forEach(function STFADFF_Files(aTestFile) {