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

Unified Diff: base/test/histogram_tester.h

Issue 2796283005: Adding UseCounter specific for extensions (Closed)
Patch Set: Codereview: added tester ExpectTotalCountExcept to simplify UseCounter unit tests Created 3 years, 7 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 | « no previous file | base/test/histogram_tester.cc » ('j') | base/test/histogram_tester.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/histogram_tester.h
diff --git a/base/test/histogram_tester.h b/base/test/histogram_tester.h
index ecf33f831f0d1844531821a5face3c01ff30b198..682e8f6b9bf8735b8e2883f02e4e9d0617f4501f 100644
--- a/base/test/histogram_tester.h
+++ b/base/test/histogram_tester.h
@@ -54,6 +54,12 @@ class HistogramTester {
void ExpectTotalCount(const std::string& name,
HistogramBase::Count count) const;
+ // This tests total count of a given histogram, excluding one bucket, given
+ // the sample id.
+ void ExpectTotalCountExcept(const std::string& name,
+ HistogramBase::Sample sample,
Nico 2017/05/09 19:36:46 s/sample/except/
lunalu1 2017/05/10 19:39:38 Done.
+ HistogramBase::Count count) const;
+
// We know exact number of samples for buckets corresponding to a time
// interval. Other intervals may have samples too.
void ExpectTimeBucketCount(const std::string& name,
@@ -119,6 +125,16 @@ class HistogramTester {
Histogram::Count expected_count,
const HistogramSamples& samples) const;
+ // Verifies that the total number of values recorded for the histogram |name|,
+ // excluding the value in the |sample| bucket, matches the |expected_count|.
+ // The histogram's current total counts and its bucket's current value is
+ // determined from |samples| and is modified based on the snapshot restored
+ // for histogram |name|.
Alexei Svitkine (slow) 2017/05/10 15:17:30 I wonder if it wouldn't be better to just have fun
lunalu1 2017/05/10 19:39:38 That was my initial thought. But after seeing that
Alexei Svitkine (slow) 2017/05/10 19:45:19 I agree that it would be different with how the cl
+ void CheckTotalCountExcept(const std::string& name,
+ HistogramBase::Sample sample,
Nico 2017/05/09 19:36:46 I'd s/sample/except/ here too
lunalu1 2017/05/10 19:39:38 Done.
+ Histogram::Count expected_count,
+ const HistogramSamples& samples) const;
+
// Used to determine the histogram changes made during this instance's
// lifecycle.
std::map<std::string, std::unique_ptr<HistogramSamples>> histograms_snapshot_;
« no previous file with comments | « no previous file | base/test/histogram_tester.cc » ('j') | base/test/histogram_tester.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698