Bug 837271 - part 4 - add test for extended statistics not being recorded; r=taras
authorNathan Froyd <froydnj@mozilla.com>
Fri, 15 Feb 2013 10:22:25 -0500
changeset 122053 3b57d3871e59a9914bbcac7b9634f87db09c60bf
parent 122052 7d7f52a27a47c030a37aefd79cb5a6827183507c
child 122054 4dded6ecf88b2afbf67012a08cb8dd792f1cf69a
push id24317
push userryanvm@gmail.com
push dateSat, 16 Feb 2013 14:49:39 +0000
treeherdermozilla-central@484dbca61133 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras
bugs837271
milestone21.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 837271 - part 4 - add test for extended statistics not being recorded; r=taras
toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
--- a/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
+++ b/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
@@ -317,16 +317,31 @@ function test_privateMode() {
   Telemetry.canRecord = false;
   h.add(1);
   do_check_eq(uneval(orig), uneval(h.snapshot()));
   Telemetry.canRecord = true;
   h.add(1);
   do_check_neq(uneval(orig), uneval(h.snapshot()));
 }
 
+// Check that histograms that aren't flagged as needing extended stats
+// don't record extended stats.
+function test_extended_stats() {
+  var h = Telemetry.getHistogramById("GRADIENT_DURATION");
+  var s = h.snapshot();
+  do_check_eq(s.sum, 0);
+  do_check_eq(s.log_sum, 0);
+  do_check_eq(s.log_sum_squares, 0);
+  h.add(1);
+  s = h.snapshot();
+  do_check_eq(s.sum, 1);
+  do_check_eq(s.log_sum, 0);
+  do_check_eq(s.log_sum_squares, 0);
+}
+
 function generateUUID() {
   let str = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID().toString();
   // strip {}
   return str.substring(1, str.length - 1);
 }
 
 function run_test()
 {
@@ -346,9 +361,10 @@ function run_test()
   do_check_false("NEWTAB_PAGE_PINNED_SITES_COUNT" in Telemetry.histogramSnapshots);
 
   test_boolean_histogram();
   test_getHistogramById();
   test_histogramFrom();
   test_getSlowSQL();
   test_privateMode();
   test_addons();
+  test_extended_stats();
 }