Index: base/test/histogram_tester.cc |
diff --git a/base/test/histogram_tester.cc b/base/test/histogram_tester.cc |
index ea738b0557b6e864a7e68c7d840c079d5c5967d8..7529af1d057b64aada5ece31d03c4d5082738321 100644 |
--- a/base/test/histogram_tester.cc |
+++ b/base/test/histogram_tester.cc |
@@ -73,6 +73,20 @@ void HistogramTester::ExpectTotalCount(const std::string& name, |
} |
} |
+std::vector<std::pair<HistogramBase::Sample, HistogramBase::Count>> |
+HistogramTester::GetAllSamples(const std::string& name) { |
+ std::vector<std::pair<HistogramBase::Sample, HistogramBase::Count>> 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(std::make_pair(sample, count)); |
+ } |
+ return samples; |
+} |
+ |
scoped_ptr<HistogramSamples> HistogramTester::GetHistogramSamplesSinceCreation( |
const std::string& histogram_name) { |
HistogramBase* histogram = StatisticsRecorder::FindHistogram(histogram_name); |