OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/test/scheduler_test_common.h" | 5 #include "cc/test/scheduler_test_common.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 void FakeTimeSourceClient::OnTimerTick() { tick_called_ = true; } | 11 void FakeTimeSourceClient::OnTimerTick() { tick_called_ = true; } |
12 | 12 |
13 FakeThread::FakeThread() { Reset(); } | |
14 | |
15 FakeThread::~FakeThread() {} | |
16 | |
17 void FakeThread::RunPendingTask() { | |
18 ASSERT_TRUE(pending_task_); | |
19 scoped_ptr<base::Closure> task = pending_task_.Pass(); | |
20 task->Run(); | |
21 } | |
22 | |
23 void FakeThread::PostTask(base::Closure cb) { | |
24 PostDelayedTask(cb, base::TimeDelta()); | |
25 } | |
26 | |
27 void FakeThread::PostDelayedTask(base::Closure cb, base::TimeDelta delay) { | |
28 if (run_pending_task_on_overwrite_ && HasPendingTask()) | |
29 RunPendingTask(); | |
30 | |
31 ASSERT_FALSE(HasPendingTask()); | |
32 pending_task_.reset(new base::Closure(cb)); | |
33 pending_task_delay_ = delay.InMilliseconds(); | |
34 } | |
35 | |
36 bool FakeThread::BelongsToCurrentThread() const { return true; } | |
37 | |
38 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } | 13 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } |
39 | 14 |
40 } // namespace cc | 15 } // namespace cc |
OLD | NEW |