Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5022)

Unified Diff: chrome/test/base/uma_histogram_helper.h

Issue 309843002: Improve UMA tests; improve no-op reconcilor; new reconcilor test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698