Index: chrome/test/base/uma_histogram_helper.cc |
diff --git a/chrome/test/base/uma_histogram_helper.cc b/chrome/test/base/uma_histogram_helper.cc |
index e65bf0582667717e5f04f32d39d5d885f740c983..9b5122974bb6cc4ede50a82bc235d7b83f0a3c45 100644 |
--- a/chrome/test/base/uma_histogram_helper.cc |
+++ b/chrome/test/base/uma_histogram_helper.cc |
@@ -44,6 +44,21 @@ void UMAHistogramHelper::ExpectUniqueSample( |
} |
} |
+void UMAHistogramHelper::ExpectBucketCount( |
+ const std::string& name, |
+ base::HistogramBase::Sample sample, |
+ base::HistogramBase::Count expected_count) { |
+ base::HistogramBase* histogram = |
+ base::StatisticsRecorder::FindHistogram(name); |
+ EXPECT_NE(static_cast<base::HistogramBase*>(NULL), histogram) |
+ << "Histogram \"" << name << "\" does not exist."; |
+ |
+ if (histogram) { |
+ scoped_ptr<base::HistogramSamples> samples(histogram->SnapshotSamples()); |
+ CheckBucketCount(name, sample, expected_count, *samples); |
+ } |
+} |
+ |
void UMAHistogramHelper::ExpectTotalCount( |
const std::string& name, |
base::HistogramBase::Count count) { |