Backed out changeset 59205b705c5c (bug 1501329) for failures in toolkit/components/telemetry/tests/unit/test_TelemetryClientID_reset.js CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Wed, 24 Oct 2018 01:53:07 +0300
changeset 491020 7508d586f2c875555b6f79ad8d92057a53013229
parent 491019 d20fd7486fde6997d38c4337a897fe65b43c4102
child 491021 3f5f46ca8ca0df1c34a9077fd4b479e291997a3f
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1501329
milestone65.0a1
backs out59205b705c5cbba29276d8a342179ff0caebf071
Backed out changeset 59205b705c5c (bug 1501329) for failures in toolkit/components/telemetry/tests/unit/test_TelemetryClientID_reset.js CLOSED TREE
toolkit/components/telemetry/app/TelemetryController.jsm
toolkit/components/telemetry/tests/unit/test_TelemetryClientID_reset.js
--- a/toolkit/components/telemetry/app/TelemetryController.jsm
+++ b/toolkit/components/telemetry/app/TelemetryController.jsm
@@ -657,31 +657,23 @@ var Impl = {
         // TODO: This should probably happen after all the delayed init here.
         this._initialized = true;
         TelemetryEnvironment.delayedInit();
 
         // Load the ClientID.
         this._clientID = await ClientID.getClientID();
 
         // Fix-up a canary client ID if detected.
-        if (IS_UNIFIED_TELEMETRY) {
-          // On desktop respect the upload preference.
-          const uploadEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, false);
-          if (uploadEnabled && this._clientID == Utils.knownClientID) {
-            this._log.trace("Upload enabled, but got canary client ID. Resetting.");
-            this._clientID = await ClientID.resetClientID();
-          } else if (!uploadEnabled && this._clientID != Utils.knownClientID) {
-            this._log.trace("Upload disabled, but got a valid client ID. Setting canary client ID.");
-            this._clientID = await ClientID.setClientID(TelemetryUtils.knownClientID);
-          }
-        } else if (this._clientID == Utils.knownClientID) {
-          // On Fennec (non-unified Telemetry) we might have set a canary client ID in the past by mistake.
-          // We now always reset to a valid random client ID if this is detected (Bug 1501329).
-          this._log.trace("Not unified, but got canary client ID. Resetting.");
+        const uploadEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, false);
+        if (uploadEnabled && this._clientID == Utils.knownClientID) {
+          this._log.trace("Upload enabled, but got canary client ID. Resetting.");
           this._clientID = await ClientID.resetClientID();
+        } else if (!uploadEnabled && this._clientID != Utils.knownClientID) {
+          this._log.trace("Upload disabled, but got a valid client ID. Setting canary client ID.");
+          this._clientID = await ClientID.setClientID(TelemetryUtils.knownClientID);
         }
 
         await TelemetrySend.setup(this._testMode);
 
         // Perform TelemetrySession delayed init.
         await TelemetrySession.delayedInit();
         await MemoryTelemetry.delayedInit();
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryClientID_reset.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryClientID_reset.js
@@ -147,85 +147,11 @@ add_task(async function test_clientid_ca
 
   // Start the instance
   await TelemetryController.testReset();
 
   let newClientId = await ClientID.getClientID();
   Assert.equal(TelemetryUtils.knownClientID, newClientId, "Client ID should be a canary when upload disabled");
 });
 
-/**
- * On Android Telemetry is not unified.
- * This tests that we reset the client ID if it was previously reset to a canary client ID by accident.
- */
-add_task(async function test_clientid_canary_reset_canary_on_nonunified() {
-  const isUnified = Preferences.get(TelemetryUtils.Preferences.Unified, false);
-  if (isUnified) {
-    // Skipping the test if unified telemetry is on.
-    return;
-  }
-
-  await sendPing();
-  let ping = await PingServer.promiseNextPing();
-  Assert.equal(ping.type, TEST_PING_TYPE, "The ping must be a test ping");
-  Assert.ok("clientId" in ping);
-
-  let firstClientId = ping.clientId;
-  Assert.notEqual(TelemetryUtils.knownClientID, firstClientId, "Client ID should be valid and random");
-
-  let clientId = await ClientID.resetClientID();
-  Assert.equal(TelemetryUtils.knownClientID, clientId);
-
-  // Now shutdown the instance
-  await TelemetryController.testShutdown();
-  await TelemetryStorage.testClearPendingPings();
-
-  // Start the instance
-  await TelemetryController.testReset();
-
-  let newClientId = await ClientID.getClientID();
-  Assert.notEqual(TelemetryUtils.knownClientID, newClientId, "Client ID should be valid and random");
-  Assert.notEqual(firstClientId, newClientId, "Client ID should be valid and random");
-});
-
-/**
- * On Android Telemetry is not unified.
- * This tests that we don't touch the client ID if the pref is toggled for some reason.
- */
-add_task(async function test_clientid_canary_nonunified_no_pref_trigger() {
-  const isUnified = Preferences.get(TelemetryUtils.Preferences.Unified, false);
-  if (isUnified) {
-    // Skipping the test if unified telemetry is on.
-    return;
-  }
-
-  await sendPing();
-  let ping = await PingServer.promiseNextPing();
-  Assert.equal(ping.type, TEST_PING_TYPE, "The ping must be a test ping");
-  Assert.ok("clientId" in ping);
-
-  let firstClientId = ping.clientId;
-  Assert.notEqual(TelemetryUtils.knownClientID, firstClientId, "Client ID should be valid and random");
-
-  // Flip the pref again
-  Preferences.set(TelemetryUtils.Preferences.FhrUploadEnabled, true);
-
-  // Restart the instance
-  await TelemetryController.testShutdown();
-  await TelemetryController.testReset();
-
-  let newClientId = await ClientID.getClientID();
-  Assert.equal(firstClientId, newClientId, "Client ID should be unmodified");
-
-  // Flip the pref again
-  Preferences.set(TelemetryUtils.Preferences.FhrUploadEnabled, false);
-
-  // Restart the instance
-  await TelemetryController.testShutdown();
-  await TelemetryController.testReset();
-
-  newClientId = await ClientID.getClientID();
-  Assert.equal(firstClientId, newClientId, "Client ID should be unmodified");
-});
-
 add_task(async function stopServer() {
   await PingServer.stop();
 });