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

Unified Diff: base/metrics/persistent_sample_map_unittest.cc

Issue 1909673002: Support negative sample values in PersistentHistogramMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use separate flag to indicate 'import all' 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
« no previous file with comments | « base/metrics/persistent_sample_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_sample_map_unittest.cc
diff --git a/base/metrics/persistent_sample_map_unittest.cc b/base/metrics/persistent_sample_map_unittest.cc
index 48e9900c0987f1780da96c216f3d2d602858b466..ed06337db5d520988241087f8d69c469a179bc9c 100644
--- a/base/metrics/persistent_sample_map_unittest.cc
+++ b/base/metrics/persistent_sample_map_unittest.cc
@@ -93,10 +93,12 @@ TEST(PersistentSampleMapTest, PersistenceTest) {
samples1.Accumulate(1, 100);
samples1.Accumulate(2, 200);
samples1.Accumulate(1, -200);
+ samples1.Accumulate(-1, 1);
EXPECT_EQ(-100, samples1.GetCount(1));
EXPECT_EQ(200, samples1.GetCount(2));
- EXPECT_EQ(300, samples1.sum());
- EXPECT_EQ(100, samples1.TotalCount());
+ EXPECT_EQ(1, samples1.GetCount(-1));
+ EXPECT_EQ(299, samples1.sum());
+ EXPECT_EQ(101, samples1.TotalCount());
EXPECT_EQ(samples1.redundant_count(), samples1.TotalCount());
PersistentSparseHistogramDataManager manager2(&allocator);
@@ -107,10 +109,12 @@ TEST(PersistentSampleMapTest, PersistenceTest) {
EXPECT_EQ(samples1.TotalCount(), samples2.TotalCount());
EXPECT_EQ(-100, samples2.GetCount(1));
EXPECT_EQ(200, samples2.GetCount(2));
- EXPECT_EQ(300, samples2.sum());
- EXPECT_EQ(100, samples2.TotalCount());
+ EXPECT_EQ(1, samples2.GetCount(-1));
+ EXPECT_EQ(299, samples2.sum());
+ EXPECT_EQ(101, samples2.TotalCount());
EXPECT_EQ(samples2.redundant_count(), samples2.TotalCount());
+ samples1.Accumulate(-1, -1);
EXPECT_EQ(0, samples2.GetCount(3));
EXPECT_EQ(0, samples1.GetCount(3));
samples2.Accumulate(3, 300);
« no previous file with comments | « base/metrics/persistent_sample_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698