1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/timer/mock_timer.h"
9 MockTimer::MockTimer(bool retain_user_task
, bool is_repeating
)
10 : Timer(retain_user_task
, is_repeating
),
14 MockTimer::MockTimer(const tracked_objects::Location
& posted_from
,
16 const base::Closure
& user_task
,
18 : Timer(true, is_repeating
),
23 MockTimer::~MockTimer() {
26 bool MockTimer::IsRunning() const {
30 base::TimeDelta
MockTimer::GetCurrentDelay() const {
34 void MockTimer::Start(const tracked_objects::Location
& posted_from
,
36 const base::Closure
& user_task
) {
38 user_task_
= user_task
;
42 void MockTimer::Stop() {
44 if (!retain_user_task())
48 void MockTimer::Reset() {
49 DCHECK(!user_task_
.is_null());
53 void MockTimer::Fire() {
55 base::Closure old_task
= user_task_
;