Bug 701863 - add test for cloned histograms in telemetry pings; r=taras
☠☠ backed out by 4f9c27745913 ☠ ☠
authorNathan Froyd <froydnj@mozilla.com>
Fri, 18 Nov 2011 15:28:05 -0500
changeset 81229 75e72a52a0cbd781606de11f38d57d41d3746afd
parent 81228 1120ae801dac73434f6f01677442885d1a6dca55
child 81230 5058cbe2e897dff5f82f9555a3619002f3f684b1
push id21564
push usermak77@bonardo.net
push dateSat, 03 Dec 2011 11:10:17 +0000
treeherdermozilla-central@a68c96c1d8e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras
bugs701863
milestone11.0a1
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
Bug 701863 - add test for cloned histograms in telemetry pings; r=taras
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -10,46 +10,53 @@
 
 do_load_httpd_js();
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
 
 const PATH = "/submit/telemetry/test-ping";
 const SERVER = "http://localhost:4444";
 const IGNORE_HISTOGRAM = "test::ignore_me";
+const HISTOGRAM_FOR_STARTUP = "PAGE_FAULTS_HARD"
+const CLONED_STARTUP_HISTOGRAM = "STARTUP_PAGE_FAULTS_HARD"
+const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED"
+const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also"
 
 const BinaryInputStream = Components.Constructor(
   "@mozilla.org/binaryinputstream;1",
   "nsIBinaryInputStream",
   "setInputStream");
+const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
 
 var httpserver = new nsHttpServer();
 var gFinished = false;
 
 function telemetry_ping () {
   const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
   TelemetryPing.observe(null, "test-ping", SERVER);
+  TelemetryPing.observe(null, "sessionstore-windows-restored", null);
 }
 
 function nonexistentServerObserver(aSubject, aTopic, aData) {
   Services.obs.removeObserver(nonexistentServerObserver, aTopic);
 
   httpserver.start(4444);
 
   // Provide a dummy function so it returns 200 instead of 404 to telemetry.
   httpserver.registerPathHandler(PATH, function () {});
   Services.obs.addObserver(telemetryObserver, "telemetry-test-xhr-complete", false);
   telemetry_ping();
 }
 
 function telemetryObserver(aSubject, aTopic, aData) {
   Services.obs.removeObserver(telemetryObserver, aTopic);
   httpserver.registerPathHandler(PATH, checkHistograms);
-  const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
   Telemetry.newHistogram(IGNORE_HISTOGRAM, 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN);
+  Telemetry.histogramFrom(CLONED_STARTUP_HISTOGRAM, HISTOGRAM_FOR_STARTUP);
+  Telemetry.histogramFrom(IGNORE_CLONED_HISTOGRAM, IGNORE_HISTOGRAM_TO_CLONE);
   Services.startup.interrupted = true;
   telemetry_ping();
 }
 
 function checkHistograms(request, response) {
   // do not need the http server anymore
   httpserver.stop(do_test_finished);
   let s = request.bodyInputStream;
@@ -72,17 +79,25 @@ function checkHistograms(request, respon
 
   for (let f in expected_info) {
     do_check_eq(payload.info[f], expected_info[f]);
   }
 
   const TELEMETRY_PING = "TELEMETRY_PING";
   const TELEMETRY_SUCCESS = "TELEMETRY_SUCCESS";
   do_check_true(TELEMETRY_PING in payload.histograms);
+  do_check_true(CLONED_STARTUP_HISTOGRAM in payload.histograms);
+  let rh = Telemetry.registeredHistograms;
+  for (let name in rh) {
+    if (/SQLITE/.test(name) && name in payload.histograms) {
+      do_check_true(("STARTUP_" + name) in payload.histograms); 
+    }
+  }
   do_check_false(IGNORE_HISTOGRAM in payload.histograms);
+  do_check_false(IGNORE_CLONED_HISTOGRAM in payload.histograms);
 
   // There should be one successful report from the previous telemetry ping.
   const expected_tc = {
     range: [1, 2],
     bucket_count: 3,
     histogram_type: 2,
     values: {0:1, 1:1, 2:0},
     sum: 1