Index: chrome/test/base/chrome_histogram_tester.h |
diff --git a/chrome/test/base/chrome_histogram_tester.h b/chrome/test/base/chrome_histogram_tester.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b07119b627ab6815994ba093bef822e026526e4 |
--- /dev/null |
+++ b/chrome/test/base/chrome_histogram_tester.h |
@@ -0,0 +1,41 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_TEST_BASE_CHROME_HISTOGRAM_TESTER_H_ |
+#define CHROME_TEST_BASE_CHROME_HISTOGRAM_TESTER_H_ |
+ |
+#include "base/test/histogram_tester.h" |
+ |
+#include "base/memory/linked_ptr.h" |
+#include "base/metrics/histogram.h" |
+#include "base/metrics/histogram_base.h" |
Ilya Sherman
2014/07/15 03:56:36
nit: Are these two includes needed?
Mike Lerman
2014/07/16 17:29:04
These four aren't needed!
|
+#include "base/metrics/histogram_samples.h" |
+ |
+// ChromeHistogramTester provides a simple interface for examining UMA |
+// histograms. Tests can use this interface to verify that UMA data is getting |
+// logged as intended. |
Ilya Sherman
2014/07/15 03:56:36
Please document how this class differs from base::
Mike Lerman
2014/07/16 17:29:04
Done.
|
+class ChromeHistogramTester : public base::HistogramTester { |
+ public: |
+ // ChromeHistogramTester should be created before the execution of the test |
+ // case. |
+ ChromeHistogramTester(); |
+ |
+ ~ChromeHistogramTester(); |
+ |
+ // Fetch the values to be tested. This must be called after the test code has |
+ // been executed but before performing the necessary assertions. This may be |
+ // called multiple times. |
+ virtual void FetchTestingSnapshot() OVERRIDE; |
+ |
+ private: |
+ void FetchCallback(); |
Ilya Sherman
2014/07/15 03:56:36
nit: Please document this method. Also, perhaps "
Mike Lerman
2014/07/16 17:29:04
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeHistogramTester); |
Ilya Sherman
2014/07/15 03:56:36
nit: This should be the last line in the class.
Mike Lerman
2014/07/16 17:29:04
Done.
|
+ |
+ // The map from histogram names to their snapshots |
+ std::map<std::string, linked_ptr<base::HistogramSamples> > |
+ histogram_snapshots; |
Ilya Sherman
2014/07/15 03:56:36
Is this actually needed? I don't see it being use
Mike Lerman
2014/07/16 17:29:04
Done.
|
+}; |
+ |
+#endif // CHROME_TEST_BASE_CHROME_HISTOGRAM_TESTER_H_ |