OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ | 5 #ifndef BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ |
6 #define BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ | 6 #define BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // SingleThreadTaskRunner implementation. | 44 // SingleThreadTaskRunner implementation. |
45 bool PostDelayedTask(const tracked_objects::Location& from_here, | 45 bool PostDelayedTask(const tracked_objects::Location& from_here, |
46 const Closure& task, | 46 const Closure& task, |
47 TimeDelta delay) override; | 47 TimeDelta delay) override; |
48 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 48 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
49 const Closure& task, | 49 const Closure& task, |
50 TimeDelta delay) override; | 50 TimeDelta delay) override; |
51 | 51 |
52 bool RunsTasksOnCurrentThread() const override; | 52 bool RunsTasksOnCurrentThread() const override; |
53 | 53 |
54 std::deque<TestPendingTask> GetPendingTasks() const; | 54 std::deque<TestPendingTask> TakePendingTasks(); |
55 size_t NumPendingTasks() const; | 55 size_t NumPendingTasks() const; |
56 bool HasPendingTask() const; | 56 bool HasPendingTask() const; |
57 base::TimeDelta NextPendingTaskDelay() const; | 57 base::TimeDelta NextPendingTaskDelay() const; |
| 58 base::TimeDelta FinalPendingTaskDelay() const; |
58 | 59 |
59 // Clears the queue of pending tasks without running them. | 60 // Clears the queue of pending tasks without running them. |
60 void ClearPendingTasks(); | 61 void ClearPendingTasks(); |
61 | 62 |
62 // Runs each current pending task in order and clears the queue. Tasks posted | 63 // Runs each current pending task in order and clears the queue. Tasks posted |
63 // by the tasks that run within this call do not run within this call. Can | 64 // by the tasks that run within this call do not run within this call. Can |
64 // only be called on the thread that created this TestSimpleTaskRunner. | 65 // only be called on the thread that created this TestSimpleTaskRunner. |
65 void RunPendingTasks(); | 66 void RunPendingTasks(); |
66 | 67 |
67 // Runs pending tasks until the queue is empty. Can only be called on the | 68 // Runs pending tasks until the queue is empty. Can only be called on the |
(...skipping 11 matching lines...) Expand all Loading... |
79 mutable Lock lock_; | 80 mutable Lock lock_; |
80 | 81 |
81 std::deque<TestPendingTask> pending_tasks_; | 82 std::deque<TestPendingTask> pending_tasks_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(TestSimpleTaskRunner); | 84 DISALLOW_COPY_AND_ASSIGN(TestSimpleTaskRunner); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace base | 87 } // namespace base |
87 | 88 |
88 #endif // BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ | 89 #endif // BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ |
OLD | NEW |