19 #ifndef PAGESPEED_KERNEL_BASE_MOCK_TIMER_H_
20 #define PAGESPEED_KERNEL_BASE_MOCK_TIMER_H_
28 namespace net_instaweb {
35 typedef void (*Callback)(
void* user_data);
47 void SetTimeMs(int64 new_time_ms) {
SetTimeUs(1000 * new_time_ms); }
70 virtual int64
NowUs()
const;
79 mutable int64 time_us_;
80 scoped_ptr<AbstractMutex> mutex_;
81 std::vector<TimeAndCallback> deltas_us_;
82 mutable unsigned int next_delta_;
Definition: mock_timer.h:33
virtual int64 NowUs() const
Returns number of microseconds since 1970.
void AdvanceMs(int64 delta_ms)
Advance time, in milliseconds.
Definition: mock_timer.h:53
static const int64 kApr_5_2010_ms
A useful recent time-constant for testing.
Definition: mock_timer.h:38
void SetTimeUs(int64 new_time_us)
Abstract interface for implementing a mutex.
Definition: abstract_mutex.h:28
void SetTimeDeltaUs(int64 delta_us)
Set time advances in microseconds for the next calls to NowUs/NowMs.
Definition: mock_timer.h:56
void SetTimeDeltaUsWithCallback(int64 delta_us, Function *callback)
Definition: function.h:47
MockTimer(AbstractMutex *mutex, int64 time_ms)
Takes ownership of mutex.
virtual void SleepMs(int64 ms)
Sleep for given number of milliseconds.
Definition: mock_timer.h:72
void SetTimeDeltaMs(int64 delta_ms)
Set time advances in milliseconds for the next calls to NowUs/NowMs.
Definition: mock_timer.h:67
void AdvanceUs(int64 delta_us)
Advance forward time by the specified number of microseconds.
Definition: mock_timer.h:50
virtual void SleepUs(int64 us)
Sleep for given number of microseconds.
Definition: mock_timer.h:71
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27