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

Unified Diff: src/platform/metrics/metrics_library.h

Issue 2049007: Start transition the metrics library to non-static API. Use gmock in tests. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Break down tests to avoid explicit metrics lib mock checkpoints. Created 10 years, 7 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
« no previous file with comments | « src/platform/metrics/metrics_daemon_test.cc ('k') | src/platform/metrics/metrics_library.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/metrics/metrics_library.h
diff --git a/src/platform/metrics/metrics_library.h b/src/platform/metrics/metrics_library.h
index 73839605007b39af97c326d924893f33427d2b62..e5e9024c0d2a462f547bd3fc8cd09223c943140d 100644
--- a/src/platform/metrics/metrics_library.h
+++ b/src/platform/metrics/metrics_library.h
@@ -16,9 +16,21 @@
// TODO(sosa@chromium.org): Add testing for send methods
-// Library used to send metrics both Autotest and Chrome.
-class MetricsLibrary {
+class MetricsLibraryInterface {
public:
+ virtual void Init() = 0;
+ virtual bool SendToUMA(const std::string& name, int sample,
+ int min, int max, int nbuckets) = 0;
+ virtual bool SendEnumToUMA(const std::string& name, int sample, int max) = 0;
+ virtual ~MetricsLibraryInterface() {}
+};
+
+// Library used to send metrics to both Autotest and Chrome/UMA.
+class MetricsLibrary : public MetricsLibraryInterface {
+ public:
+ // Initializes the library.
+ void Init();
+
// Sends histogram data to Chrome for transport to UMA and returns
// true on success. This method results in the equivalent of an
// asynchronous non-blocking RPC to UMA_HISTOGRAM_CUSTOM_COUNTS
@@ -30,6 +42,10 @@ class MetricsLibrary {
// |nbuckets| is the number of histogram buckets.
// [0,min) is the implicit underflow bucket.
// [|max|,infinity) is the implicit overflow bucket.
+ bool SendToUMA(const std::string& name, int sample,
+ int min, int max, int nbuckets);
+
+ // Deprecated.
static bool SendToChrome(const std::string& name, int sample,
int min, int max, int nbuckets);
@@ -42,6 +58,9 @@ class MetricsLibrary {
// |max| is the maximum value of the histogram samples.
// 0 is the implicit underflow bucket.
// [|max|,infinity) is the implicit overflow bucket.
+ bool SendEnumToUMA(const std::string& name, int sample, int max);
+
+ // Deprecated.
static bool SendEnumToChrome(const std::string& name, int sample, int max);
// Sends to Autotest and returns true on success.
« no previous file with comments | « src/platform/metrics/metrics_daemon_test.cc ('k') | src/platform/metrics/metrics_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698