bug 1442667 - Refactor internal_JSKeyedHistogram_Add r=chutten
authorAditya Bharti <adibhar97@gmail.com>
Sun, 29 Apr 2018 12:54:42 +0530
changeset 416502 aaaf24c64666f1257db8fef1e741ed2c444a4e74
parent 416501 6876bbcd3c3fb1cb294e5ca45e6a9ecc692f400d
child 416503 e0f400b5e60c5c0a25df98a9727e1e21ef253cfb
push id33931
push usercsabou@mozilla.com
push dateWed, 02 May 2018 15:00:50 +0000
treeherdermozilla-central@f877359308b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1442667
milestone61.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 1442667 - Refactor internal_JSKeyedHistogram_Add r=chutten Corrected a few mistakes in the test cases
toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
@@ -1129,32 +1129,30 @@ add_task(async function test_linear_mult
 
 add_task(async function test_keyed_no_arguments() {
   // Test for no accumulation when add is called with no arguments
   let h = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_LINEAR");
   h.clear();
 
   h.add();
 
-  let s = h.snapshot();
-  // Snapshot property sum is undefined until the first accumulation.
-  Assert.equal(s.sum, undefined);
+  // No keys should be added due to no accumulation.
+  Assert.equal(h.keys().length, 0);
 });
 
 add_task(async function test_keyed_categorical_invalid_string() {
   // Test for no accumulation when add is called on a
   // keyed categorical histogram with an invalid string label.
   let h = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_CATEGORICAL");
   h.clear();
 
-  h.add("someKey", "#notALablel");
+  h.add("someKey", "#notALabel");
 
-  let s = h.snapshot();
-  // Snapshot property sum is undefined until the first accumulation.
-  Assert.equal(s.sum, undefined);
+  // No keys should be added due to no accumulation.
+  Assert.equal(h.keys().length, 0);
 });
 
 add_task(async function test_keyed_count_multiple_samples() {
   let valid = [1, 1, 3, 0];
   let invalid = ["1", "0", "", "random"];
   let key = "somekeystring";
 
   let h = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT");