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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/test/scheduler_test_common.h" | 7 #include "cc/test/scheduler_test_common.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 namespace WebKitTests { | 11 namespace WebKitTests { |
12 | 12 |
13 void FakeTimeSourceClient::onTimerTick() | 13 void FakeTimeSourceClient::onTimerTick() |
14 { | 14 { |
15 m_tickCalled = true; | 15 m_tickCalled = true; |
16 } | 16 } |
17 | 17 |
18 FakeThread::FakeThread() | 18 FakeThread::FakeThread() |
19 { | 19 { |
20 reset(); | 20 reset(); |
21 } | 21 } |
22 | 22 |
23 FakeThread::~FakeThread() | 23 FakeThread::~FakeThread() |
24 { | 24 { |
25 } | 25 } |
26 | 26 |
27 void FakeThread::postTask(PassOwnPtr<Task>) | 27 void FakeThread::runPendingTask() |
28 { | 28 { |
29 NOTREACHED(); | 29 ASSERT_TRUE(m_pendingTask); |
30 scoped_ptr<base::Closure> task = m_pendingTask.Pass(); | |
31 task->Run(); | |
30 } | 32 } |
31 | 33 |
32 void FakeThread::postDelayedTask(PassOwnPtr<Task> task, long long delay) | 34 void FakeThread::postTask(base::Closure cb) |
35 { | |
36 postDelayedTask(cb, 0); | |
enne (OOO)
2012/10/29 17:40:42
Why did this change from NOTREACHED() to postDelay
| |
37 } | |
38 | |
39 void FakeThread::postDelayedTask(base::Closure cb, long long delay) | |
33 { | 40 { |
34 if (m_runPendingTaskOnOverwrite && hasPendingTask()) | 41 if (m_runPendingTaskOnOverwrite && hasPendingTask()) |
35 runPendingTask(); | 42 runPendingTask(); |
36 | 43 |
37 EXPECT_TRUE(!hasPendingTask()); | 44 ASSERT_FALSE(hasPendingTask()); |
38 m_pendingTask = task; | 45 m_pendingTask.reset(new base::Closure(cb)); |
39 m_pendingTaskDelay = delay; | 46 m_pendingTaskDelay = delay; |
40 } | 47 } |
41 | 48 |
42 base::PlatformThreadId FakeThread::threadID() const | 49 bool FakeThread::belongsToCurrentThread() const |
43 { | 50 { |
44 return 0; | 51 return true; |
45 } | 52 } |
46 | 53 |
47 void FakeTimeSource::setClient(cc::TimeSourceClient* client) | 54 void FakeTimeSource::setClient(cc::TimeSourceClient* client) |
48 { | 55 { |
49 m_client = client; | 56 m_client = client; |
50 } | 57 } |
51 | 58 |
52 void FakeTimeSource::setActive(bool b) | 59 void FakeTimeSource::setActive(bool b) |
53 { | 60 { |
54 m_active = b; | 61 m_active = b; |
(...skipping 13 matching lines...) Expand all Loading... | |
68 { | 75 { |
69 return base::TimeTicks(); | 76 return base::TimeTicks(); |
70 } | 77 } |
71 | 78 |
72 base::TimeTicks FakeDelayBasedTimeSource::now() const | 79 base::TimeTicks FakeDelayBasedTimeSource::now() const |
73 { | 80 { |
74 return m_now; | 81 return m_now; |
75 } | 82 } |
76 | 83 |
77 } | 84 } |
OLD | NEW |