Chromium Code Reviews| Index: chrome/test/base/uma_histogram_helper.h |
| diff --git a/chrome/test/base/uma_histogram_helper.h b/chrome/test/base/uma_histogram_helper.h |
| index 76e841fcfd3651266eb709273d8a9b20d44ff400..ff8e402e688d48dea85b8fcbceeb1f183f963373 100644 |
| --- a/chrome/test/base/uma_histogram_helper.h |
| +++ b/chrome/test/base/uma_histogram_helper.h |
| @@ -14,25 +14,34 @@ |
| // intended. |
| class UMAHistogramHelper { |
| public: |
| + // To be called before the body of the test code. |
|
Alexei Svitkine (slow)
2014/06/12 17:09:14
Comment is confusing since you can't generally cal
Mike Lerman
2014/06/12 18:12:16
Done.
|
| UMAHistogramHelper(); |
|
Alexei Svitkine (slow)
2014/06/12 17:09:14
Add a destructor declaration and put its implement
Mike Lerman
2014/06/12 18:12:15
Done.
|
| + // Parameters should be string literals of all histograms to snapshot. |
| + // Call this before executing the test code. |
| + void PrepareSnapshot(const char**, int num_histograms); |
| + |
| // Each child process may have its own histogram data, make sure this data |
| // gets accumulated into the browser process before we examine the histograms. |
| void Fetch(); |
| // We know the exact number of samples in a bucket, and that no other bucket |
| - // should have samples. |
| + // should have samples. If |PrepareSnapshot| was called for |name| histogram, |
| + // then the |expected_count| is the diff from the snapshot. |
| void ExpectUniqueSample(const std::string& name, |
| base::HistogramBase::Sample sample, |
| base::HistogramBase::Count expected_count); |
| // We know the exact number of samples in a bucket, but other buckets may |
| - // have samples as well. |
| + // have samples as well. If |PrepareSnapshot| was called for |name| histogram, |
| + // then the |expected_count| is the diff from the snapshot. |
| void ExpectBucketCount(const std::string& name, |
| base::HistogramBase::Sample sample, |
| base::HistogramBase::Count expected_count); |
| - // We don't know the values of the samples, but we know how many there are. |
| + // We don't know the values of the samples, but we know how many there are. If |
| + // |PrepareSnapshot| was called for |name| histogram, then the |
| + // |count| is the diff from the snapshot. |
| void ExpectTotalCount(const std::string& name, |
| base::HistogramBase::Count count); |
| @@ -49,6 +58,10 @@ class UMAHistogramHelper { |
| base::HistogramSamples& samples); |
| DISALLOW_COPY_AND_ASSIGN(UMAHistogramHelper); |
| + |
| + // The map from histogram names to their snapshots |
| + std::map<std::string, scoped_ptr<base::HistogramSamples> > |
| + histogram_snapshots; |
| }; |
| #endif // CHROME_TEST_BASE_UMA_HISTOGRAM_HELPER_H_ |