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 */ 16 17 #ifndef METRICS_TIMER_MOCK_H_ 18 #define METRICS_TIMER_MOCK_H_ 19 20 #include <string> 21 22 #include <gmock/gmock.h> 23 24 #include "metrics/timer.h" 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: TimerReporterMock()39 TimerReporterMock() : TimerReporter("", 0, 0, 0) {} 40 MOCK_METHOD0(Start, bool()); 41 MOCK_METHOD0(Stop, bool()); 42 MOCK_METHOD0(Reset, bool()); 43 MOCK_CONST_METHOD0(HasStarted, bool()); 44 MOCK_CONST_METHOD1(GetElapsedTime, bool(base::TimeDelta* elapsed_time)); 45 MOCK_CONST_METHOD0(ReportMilliseconds, bool()); 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()); 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_ 60