OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/test/test_mock_time_task_runner.h" | 5 #include "base/test/test_mock_time_task_runner.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/time/clock.h" | 9 #include "base/time/clock.h" |
10 #include "base/time/tick_clock.h" | 10 #include "base/time/tick_clock.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 AutoLock scoped_lock(tasks_lock_); | 147 AutoLock scoped_lock(tasks_lock_); |
148 tasks_.push(TestPendingTask(from_here, task, now_ticks_, delay, | 148 tasks_.push(TestPendingTask(from_here, task, now_ticks_, delay, |
149 TestPendingTask::NESTABLE)); | 149 TestPendingTask::NESTABLE)); |
150 return true; | 150 return true; |
151 } | 151 } |
152 | 152 |
153 bool TestMockTimeTaskRunner::PostNonNestableDelayedTask( | 153 bool TestMockTimeTaskRunner::PostNonNestableDelayedTask( |
154 const tracked_objects::Location& from_here, | 154 const tracked_objects::Location& from_here, |
155 const Closure& task, | 155 const Closure& task, |
156 TimeDelta delay) { | 156 TimeDelta delay) { |
157 NOTREACHED(); | 157 return PostDelayedTask(from_here, task, delay); |
158 return false; | |
159 } | 158 } |
160 | 159 |
161 void TestMockTimeTaskRunner::OnBeforeSelectingTask() { | 160 void TestMockTimeTaskRunner::OnBeforeSelectingTask() { |
162 // Empty default implementation. | 161 // Empty default implementation. |
163 } | 162 } |
164 | 163 |
165 void TestMockTimeTaskRunner::OnAfterTimePassed() { | 164 void TestMockTimeTaskRunner::OnAfterTimePassed() { |
166 // Empty default implementation. | 165 // Empty default implementation. |
167 } | 166 } |
168 | 167 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (!tasks_.empty() && | 202 if (!tasks_.empty() && |
204 (tasks_.top().GetTimeToRun() - reference) <= max_delta) { | 203 (tasks_.top().GetTimeToRun() - reference) <= max_delta) { |
205 *next_task = tasks_.top(); | 204 *next_task = tasks_.top(); |
206 tasks_.pop(); | 205 tasks_.pop(); |
207 return true; | 206 return true; |
208 } | 207 } |
209 return false; | 208 return false; |
210 } | 209 } |
211 | 210 |
212 } // namespace base | 211 } // namespace base |
OLD | NEW |