1 // Copyright 2012 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 "cc/test/scheduler_test_common.h"
7 #include "base/logging.h"
11 void FakeTimeSourceClient::OnTimerTick() { tick_called_
= true; }
13 FakeThread::FakeThread() { Reset(); }
15 FakeThread::~FakeThread() {}
17 void FakeThread::RunPendingTask() {
18 ASSERT_TRUE(pending_task_
);
19 scoped_ptr
<base::Closure
> task
= pending_task_
.Pass();
23 void FakeThread::PostTask(base::Closure cb
) {
24 PostDelayedTask(cb
, base::TimeDelta());
27 void FakeThread::PostDelayedTask(base::Closure cb
, base::TimeDelta delay
) {
28 if (run_pending_task_on_overwrite_
&& HasPendingTask())
31 ASSERT_FALSE(HasPendingTask());
32 pending_task_
.reset(new base::Closure(cb
));
33 pending_task_delay_
= delay
.InMilliseconds();
36 bool FakeThread::BelongsToCurrentThread() const { return true; }
38 void FakeTimeSource::SetClient(TimeSourceClient
* client
) { client_
= client
; }
40 void FakeTimeSource::SetActive(bool b
) { active_
= b
; }
42 bool FakeTimeSource::Active() const { return active_
; }
44 base::TimeTicks
FakeTimeSource::LastTickTime() { return base::TimeTicks(); }
46 base::TimeTicks
FakeTimeSource::NextTickTime() { return base::TimeTicks(); }
48 base::TimeTicks
FakeDelayBasedTimeSource::Now() const { return now_
; }