Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: base/metrics/histogram_unittest.cc

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove DCHECK_IS_ON from .h files because it's not always defined and don't want to add the include Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/metrics/histogram_unittest.cc
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
index 58b72480018591f72679a6e1ff036727f25ada2c..e839cbcff3cd7c7c1b522bb9b6a76b856acb21f1 100644
--- a/base/metrics/histogram_unittest.cc
+++ b/base/metrics/histogram_unittest.cc
@@ -147,7 +147,7 @@ TEST_P(HistogramTest, NameMatchTest) {
EXPECT_EQ(2, samples->GetCount(10));
}
-// Check that delta calculations work correct.
+// Check that delta calculations work correctly.
TEST_P(HistogramTest, DeltaTest) {
HistogramBase* histogram =
Histogram::FactoryGet("DeltaHistogram", 1, 64, 8,
@@ -176,6 +176,23 @@ TEST_P(HistogramTest, DeltaTest) {
EXPECT_EQ(0, samples->TotalCount());
}
+// Check that final-delta calculations work correctly.
+TEST_P(HistogramTest, FinalDeltaTest) {
+ HistogramBase* histogram =
+ Histogram::FactoryGet("FinalDeltaHistogram", 1, 64, 8,
+ HistogramBase::kNoFlags);
+ histogram->Add(1);
+ histogram->Add(10);
+ histogram->Add(50);
+
+ std::unique_ptr<HistogramSamples> samples = histogram->SnapshotFinalDelta();
Ilya Sherman 2016/05/04 06:48:07 Please include an additional test where the code f
bcwhite 2016/05/04 14:12:50 Done.
+ EXPECT_EQ(3, samples->TotalCount());
+ EXPECT_EQ(1, samples->GetCount(1));
+ EXPECT_EQ(1, samples->GetCount(10));
+ EXPECT_EQ(1, samples->GetCount(50));
+ EXPECT_EQ(samples->TotalCount(), samples->redundant_count());
+}
+
TEST_P(HistogramTest, ExponentialRangesTest) {
// Check that we got a nice exponential when there was enough room.
BucketRanges ranges(9);

Powered by Google App Engine
This is Rietveld 408576698