Chromium Code Reviews| Index: chrome/browser/extensions/api/metrics_private/metrics_apitest.cc |
| diff --git a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc |
| index 86eb577a59196b81c93154eaf89706accf07d150..f6ae17112256cded895f22d2b5a50df9b5b33a04 100644 |
| --- a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc |
| +++ b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc |
| @@ -33,16 +33,19 @@ struct RecordedHistogram { |
| int min; |
| int max; |
| size_t buckets; |
| + int count; |
| } g_histograms[] = { |
| - {"test.h.1", base::HISTOGRAM, 1, 100, 50}, // custom |
| - {"test.h.2", base::LINEAR_HISTOGRAM, 1, 200, 50}, // custom |
| - {"test.h.3", base::LINEAR_HISTOGRAM, 1, 101, 102}, // percentage |
| - {"test.time", base::HISTOGRAM, 1, 10000, 50}, |
| - {"test.medium.time", base::HISTOGRAM, 1, 180000, 50}, |
| - {"test.long.time", base::HISTOGRAM, 1, 3600000, 50}, |
| - {"test.count", base::HISTOGRAM, 1, 1000000, 50}, |
| - {"test.medium.count", base::HISTOGRAM, 1, 10000, 50}, |
| - {"test.small.count", base::HISTOGRAM, 1, 100, 50}, |
| + {"test.h.1", base::HISTOGRAM, 1, 100, 50, 1}, // custom |
| + {"test.h.2", base::LINEAR_HISTOGRAM, 1, 200, 50, 1}, // custom |
| + {"test.h.3", base::LINEAR_HISTOGRAM, 1, 101, 102, 2}, // percentage |
| + {"test.time", base::HISTOGRAM, 1, 10000, 50, 1}, |
| + {"test.medium.time", base::HISTOGRAM, 1, 180000, 50, 1}, |
| + {"test.long.time", base::HISTOGRAM, 1, 3600000, 50, 1}, |
| + {"test.count", base::HISTOGRAM, 1, 1000000, 50, 1}, |
| + {"test.medium.count", base::HISTOGRAM, 1, 10000, 50, 1}, |
| + {"test.small.count", base::HISTOGRAM, 1, 100, 50, 1}, |
| + {"test.bucketchange.linear", base::LINEAR_HISTOGRAM, 1, 100, 10, 2}, |
|
Alexei Svitkine (slow)
2014/01/17 15:40:13
Can you also add tests for this to histogram_unitt
elijahtaylor1
2014/01/17 20:04:16
Done.
|
| + {"test.bucketchange.log", base::HISTOGRAM, 1, 100, 10, 2}, |
| }; |
| // This class observes and collects user action notifications that are sent |
| @@ -116,6 +119,10 @@ void ValidateHistograms(const RecordedHistogram* recorded, |
| EXPECT_EQ(r.type, histogram->GetHistogramType()); |
| EXPECT_TRUE( |
| histogram->HasConstructionArguments(r.min, r.max, r.buckets)); |
| + scoped_ptr<base::HistogramSamples> snapshot = |
| + histogram->SnapshotSamples(); |
| + base::HistogramBase::Count sample_count = snapshot->TotalCount(); |
| + EXPECT_EQ(sample_count, r.count); |
| break; |
| } |
| } |