Implement a persistent storage aggregation counter class.
This class is currently used to aggregate the active daily use time
but can also be used to aggregate other data (e.g., active use time
between crashes) before sending to UMA. Abstracting this in a separate
class also simplifies the daemon unit tests.
An alternative design would store the data on shutdown (but may slow
down shutdown a little). This should do it for now.
BUG=none
TEST=gmerged on device,inspected logs,about:histograms,etc.
Review URL: http://codereview.chromium.org/2731008
diff --git a/metrics/counter_mock.h b/metrics/counter_mock.h
new file mode 100644
index 0000000..22327ac
--- /dev/null
+++ b/metrics/counter_mock.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 The Chromium OS 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 METRICS_COUNTER_MOCK_H_
+#define METRICS_COUNTER_MOCK_H_
+
+#include <string>
+
+#include <gmock/gmock.h>
+
+#include "counter.h"
+
+namespace chromeos_metrics {
+
+class TaggedCounterMock : public TaggedCounterInterface {
+ public:
+ MOCK_METHOD3(Init, void(const char* filename,
+ Reporter reporter, void* reporter_handle));
+ MOCK_METHOD2(Update, void(int tag, int count));
+ MOCK_METHOD0(Flush, void());
+};
+
+} // namespace chromeos_metrics
+
+#endif // METRICS_COUNTER_MOCK_H_