Added a timer-based report to the metrics library.
Timer encapsulates a timer with basic functionality.
TimerReporter subclasses it for also sending UMA reports.
BUG=chromium-os:18800
TEST=Unit test 'timer_test' has been included
Change-Id: I9de9a2a7388721ba1476fe706a8d12788d2176ad
Reviewed-on: http://gerrit.chromium.org/gerrit/5161
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Bruno Pontes Soares Rocha <bpontes@google.com>
Reviewed-by: Bruno Pontes Soares Rocha <bpontes@google.com>
diff --git a/metrics/timer_mock.h b/metrics/timer_mock.h
new file mode 100644
index 0000000..ef29191
--- /dev/null
+++ b/metrics/timer_mock.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 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_TIMER_MOCK_H_
+#define METRICS_TIMER_MOCK_H_
+
+
+#include <string>
+
+#include <base/basictypes.h>
+#include <base/time.h>
+#include <gmock/gmock.h>
+
+#include "timer.h"
+
+namespace chromeos_metrics {
+
+class TimerMock : public Timer {
+ public:
+ MOCK_METHOD0(Start, bool());
+ MOCK_METHOD0(Stop, bool());
+ MOCK_METHOD0(Reset, bool());
+ MOCK_CONST_METHOD0(HasStarted, bool());
+ MOCK_CONST_METHOD1(GetElapsedTime, bool(base::TimeDelta* elapsed_time));
+};
+
+class TimerReporterMock : public TimerReporter {
+ public:
+ MOCK_METHOD0(Start, bool());
+ MOCK_METHOD0(Stop, bool());
+ MOCK_METHOD0(Reset, bool());
+ MOCK_CONST_METHOD0(HasStarted, bool());
+ MOCK_CONST_METHOD0(GetElapsedTime, base::TimeDelta());
+ MOCK_CONST_METHOD0(ReportMilliseconds, bool());
+};
+
+class ClockWrapperMock : public ClockWrapper {
+ public:
+ MOCK_CONST_METHOD0(GetCurrentTime, base::TimeTicks());
+};
+
+} // namespace chromeos_metrics
+
+#endif // METRICS_TIMER_MOCK_H_