Bug 837271 - part 4 - add test for extended statistics not being recorded; r=taras; a=lsblakk
authorNathan Froyd <froydnj@mozilla.com>
Fri, 15 Feb 2013 10:22:25 -0500
changeset 127532 f75a527a8c4a16eb43e11e895c623b8548fb192b
parent 127531 a5c8f85afbd594df2bba228aec4dc9761675f370
child 127533 a581fbd356de0437d7a431b1f85752e985a677c2
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras, lsblakk
bugs837271
milestone20.0a2
Bug 837271 - part 4 - add test for extended statistics not being recorded; r=taras; a=lsblakk
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();
 }