Backed out changeset 4446ecfee3d7 (bug 1385417) for Win8 permaorange in test_TelemetryHealthPing.js
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 31 Jul 2017 22:19:35 -0700
changeset 420873 6e7e4865a47763f853d672567b08d3fcf443ac15
parent 420872 5588a5f33bbca0700cdf552518f5deb2853e6401
child 420874 6add1a4978edf718046d4b4ec8c28c09848b57ee
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1385417
milestone56.0a1
backs out4446ecfee3d7530ae423be58cd0c34f054564d8a
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
Backed out changeset 4446ecfee3d7 (bug 1385417) for Win8 permaorange in test_TelemetryHealthPing.js MozReview-Commit-ID: 9icHWi2MI0M
toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryHealthPing.js
@@ -6,17 +6,16 @@
 
 "use strict";
 
 Cu.import("resource://gre/modules/TelemetryController.jsm", this);
 Cu.import("resource://gre/modules/TelemetryStorage.jsm", this);
 Cu.import("resource://gre/modules/TelemetryUtils.jsm", this);
 Cu.import("resource://gre/modules/Preferences.jsm", this);
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
-Cu.import("resource://testing-common/TelemetryArchiveTesting.jsm", this);
 
 XPCOMUtils.defineLazyModuleGetter(this, "TelemetryHealthPing",
                                   "resource://gre/modules/TelemetryHealthPing.jsm");
 
 function checkHealthPingStructure(ping, expectedFailuresDict) {
   let payload = ping.payload;
   Assert.equal(ping.type, TelemetryHealthPing.HEALTH_PING_TYPE, "Should have recorded a health ping.");
 
@@ -26,28 +25,16 @@ function checkHealthPingStructure(ping, 
 }
 
 function fakeHealthSchedulerTimer(set, clear) {
   let telemetryHealthPing = Cu.import("resource://gre/modules/TelemetryHealthPing.jsm", {});
   telemetryHealthPing.Policy.setSchedulerTickTimeout = set;
   telemetryHealthPing.Policy.clearSchedulerTickTimeout = clear;
 }
 
-async function waitForConditionWithPromise(promiseFn, timeoutMsg, tryCount = 30) {
-  const SINGLE_TRY_TIMEOUT = 100;
-  let tries = 0;
-  do {
-    try {
-      return await promiseFn();
-    } catch (ex) {}
-    await new Promise(resolve => do_timeout(SINGLE_TRY_TIMEOUT, resolve));
-  } while (++tries <= tryCount);
-  throw new Error(timeoutMsg);
-}
-
 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);
 
@@ -124,33 +111,23 @@ add_task(async function test_sendOverSiz
 add_task(async function test_sendOnTimeout() {
   TelemetryHealthPing.testReset();
   PingServer.clearRequests();
   let PING_TYPE = "ping-on-timeout";
 
   // Set up small ping submission timeout to always have timeout error.
   TelemetrySend.testSetTimeoutForPingSubmit(2);
 
+  // Reset the timeout after receiving the first ping to be able to send health ping.
   PingServer.registerPingHandler((request, result) => {
     PingServer.resetPingHandler();
+    TelemetrySend.testResetTimeOutToDefault();
   });
 
-  // Submit a ping which should time out.
   await TelemetryController.submitExternalPing(PING_TYPE, {});
-
-  let ac = new TelemetryArchiveTesting.Checker();
-  await ac.promiseInit();
-  await waitForConditionWithPromise(() => {
-    ac.promiseFindPing("health", []);
-  }, "Failed to find health ping");
-
-  TelemetrySend.testResetTimeOutToDefault();
-  PingServer.resetPingHandler();
-  TelemetryController.submitExternalPing(PING_TYPE, {});
-
   let ping = await PingServer.promiseNextPing();
   checkHealthPingStructure(ping, {
     [TelemetryHealthPing.FailureType.SEND_FAILURE]: {
       "timeout": 1
     },
     "os": TelemetryHealthPing.OsInfo,
     "reason": TelemetryHealthPing.Reason.IMMEDIATE
   });