bug 1427765 - Add gtest coverage for accumulating using strings r=chutten draft
authorKiran <kirankhade7777@gmail.com>
Thu, 28 Jun 2018 15:10:37 -0400
changeset 812189 e806cb96fb120492ee674bbc3e6f6ac47cd80a61
parent 811977 6041c030780420b6205cf2d6640513606609884c
push id114483
push userbmo:chutten@mozilla.com
push dateThu, 28 Jun 2018 19:11:26 +0000
reviewerschutten
bugs1427765
milestone63.0a1
bug 1427765 - Add gtest coverage for accumulating using strings r=chutten MozReview-Commit-ID: CSXigsG8TI0
toolkit/components/telemetry/tests/gtest/TestHistograms.cpp
--- a/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp
+++ b/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp
@@ -10,27 +10,28 @@
 #include "TelemetryFixture.h"
 #include "TelemetryTestHelpers.h"
 
 using namespace mozilla;
 using namespace TelemetryTestHelpers;
 
 TEST_F(TelemetryTestFixture, AccumulateCountHistogram)
 {
-  const uint32_t kExpectedValue = 100;
+  const uint32_t kExpectedValue = 200;
   AutoJSContextWithGlobal cx(mCleanGlobal);
 
   const char* telemetryTestCountName = Telemetry::GetHistogramName(Telemetry::TELEMETRY_TEST_COUNT);
   ASSERT_STREQ(telemetryTestCountName, "TELEMETRY_TEST_COUNT") << "The histogram name is wrong";
 
   GetAndClearHistogram(cx.GetJSContext(), mTelemetry, NS_LITERAL_CSTRING("TELEMETRY_TEST_COUNT"),
                        false);
 
   // Accumulate in the histogram
-  Telemetry::Accumulate(Telemetry::TELEMETRY_TEST_COUNT, kExpectedValue);
+  Telemetry::Accumulate(Telemetry::TELEMETRY_TEST_COUNT, kExpectedValue/2);
+  Telemetry::Accumulate("TELEMETRY_TEST_COUNT", kExpectedValue/2);
 
   // Get a snapshot for all the histograms
   JS::RootedValue snapshot(cx.GetJSContext());
   GetSnapshots(cx.GetJSContext(), mTelemetry, telemetryTestCountName, &snapshot, false);
 
   // Get the histogram from the snapshot
   JS::RootedValue histogram(cx.GetJSContext());
   GetProperty(cx.GetJSContext(), telemetryTestCountName, snapshot, &histogram);