Bertrand SIMONNET | 52e5b99 | 2015-08-10 15:18:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 16 | |
| 17 | #ifndef METRICS_TIMER_MOCK_H_ |
| 18 | #define METRICS_TIMER_MOCK_H_ |
| 19 | |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 20 | #include <string> |
| 21 | |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 22 | #include <gmock/gmock.h> |
| 23 | |
Samuel Tan | 1c4d8f1 | 2015-09-15 11:40:47 -0700 | [diff] [blame] | 24 | #include "metrics/timer.h" |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 25 | |
| 26 | namespace chromeos_metrics { |
| 27 | |
| 28 | class TimerMock : public Timer { |
| 29 | public: |
| 30 | MOCK_METHOD0(Start, bool()); |
| 31 | MOCK_METHOD0(Stop, bool()); |
| 32 | MOCK_METHOD0(Reset, bool()); |
| 33 | MOCK_CONST_METHOD0(HasStarted, bool()); |
| 34 | MOCK_CONST_METHOD1(GetElapsedTime, bool(base::TimeDelta* elapsed_time)); |
| 35 | }; |
| 36 | |
| 37 | class TimerReporterMock : public TimerReporter { |
| 38 | public: |
Bertrand SIMONNET | e6cfd64 | 2014-07-09 16:35:23 -0700 | [diff] [blame] | 39 | TimerReporterMock() : TimerReporter("", 0, 0, 0) {} |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 40 | MOCK_METHOD0(Start, bool()); |
| 41 | MOCK_METHOD0(Stop, bool()); |
| 42 | MOCK_METHOD0(Reset, bool()); |
| 43 | MOCK_CONST_METHOD0(HasStarted, bool()); |
Bruno Rocha | e3bdf0f | 2011-08-18 11:28:30 -0700 | [diff] [blame] | 44 | MOCK_CONST_METHOD1(GetElapsedTime, bool(base::TimeDelta* elapsed_time)); |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 45 | MOCK_CONST_METHOD0(ReportMilliseconds, bool()); |
Bruno Rocha | e3bdf0f | 2011-08-18 11:28:30 -0700 | [diff] [blame] | 46 | MOCK_CONST_METHOD0(histogram_name, std::string&()); |
| 47 | MOCK_CONST_METHOD0(min, int()); |
| 48 | MOCK_CONST_METHOD0(max, int()); |
| 49 | MOCK_CONST_METHOD0(num_buckets, int()); |
Bruno Rocha | be388f3 | 2011-08-02 12:40:17 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | class ClockWrapperMock : public ClockWrapper { |
| 53 | public: |
| 54 | MOCK_CONST_METHOD0(GetCurrentTime, base::TimeTicks()); |
| 55 | }; |
| 56 | |
| 57 | } // namespace chromeos_metrics |
| 58 | |
| 59 | #endif // METRICS_TIMER_MOCK_H_ |