Index: third_party/WebKit/Source/platform/testing/HistogramTester.cpp |
diff --git a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp |
index 043ca95221a76defaffd2f9a6ebca685ab7d872b..dd7f2a28e8afb2f3beb798d7efc67b9f22ed270d 100644 |
--- a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp |
+++ b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp |
@@ -23,4 +23,14 @@ void HistogramTester::expectTotalCount(const std::string& name, base::HistogramB |
m_histogramTester->ExpectTotalCount(name, count); |
} |
+base::HistogramBase::Count HistogramTester::histogramCount(const std::string& name, base::HistogramBase::Sample bucket) const |
+{ |
+ std::vector<base::Bucket> histograms = m_histogramTester->GetAllSamples(name); |
+ for (const auto& measuredBucket : histograms) { |
+ if (bucket == measuredBucket.min) |
+ return measuredBucket.count; |
+ } |
+ return 0; |
+} |
+ |
} // namespace blink |