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

Unified Diff: base/test/histogram_tester.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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/test/histogram_tester.h ('k') | base/test/histogram_tester_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/histogram_tester.cc
diff --git a/base/test/histogram_tester.cc b/base/test/histogram_tester.cc
index ea738b0557b6e864a7e68c7d840c079d5c5967d8..0eba3a9a27938e6ef7ecd7872f466159284a5717 100644
--- a/base/test/histogram_tester.cc
+++ b/base/test/histogram_tester.cc
@@ -73,6 +73,19 @@ void HistogramTester::ExpectTotalCount(const std::string& name,
}
}
+std::vector<Bucket> HistogramTester::GetAllSamples(const std::string& name) {
+ std::vector<Bucket> samples;
+ scoped_ptr<HistogramSamples> snapshot =
+ GetHistogramSamplesSinceCreation(name);
+ for (auto it = snapshot->Iterator(); !it->Done(); it->Next()) {
+ HistogramBase::Sample sample;
+ HistogramBase::Count count;
+ it->Get(&sample, nullptr, &count);
+ samples.push_back(Bucket(sample, count));
+ }
+ return samples;
+}
+
scoped_ptr<HistogramSamples> HistogramTester::GetHistogramSamplesSinceCreation(
const std::string& histogram_name) {
HistogramBase* histogram = StatisticsRecorder::FindHistogram(histogram_name);
@@ -120,4 +133,12 @@ void HistogramTester::CheckTotalCount(
<< expected_count << "). It has (" << actual_count << ").";
}
+bool Bucket::operator==(const Bucket& other) const {
+ return min == other.min && count == other.count;
+}
+
+void PrintTo(const Bucket& bucket, std::ostream* os) {
+ *os << "Bucket " << bucket.min << ": " << bucket.count;
+}
+
} // namespace base
« no previous file with comments | « base/test/histogram_tester.h ('k') | base/test/histogram_tester_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698