| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public: | 46 public: |
| 47 TestSimpleTaskRunner(); | 47 TestSimpleTaskRunner(); |
| 48 | 48 |
| 49 // SingleThreadTaskRunner implementation. | 49 // SingleThreadTaskRunner implementation. |
| 50 bool PostDelayedTask(const tracked_objects::Location& from_here, | 50 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 51 const Closure& task, | 51 const Closure& task, |
| 52 TimeDelta delay) override; | 52 TimeDelta delay) override; |
| 53 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 53 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 54 const Closure& task, | 54 const Closure& task, |
| 55 TimeDelta delay) override; | 55 TimeDelta delay) override; |
| 56 | |
| 57 bool RunsTasksOnCurrentThread() const override; | 56 bool RunsTasksOnCurrentThread() const override; |
| 57 std::string GetThreadName() const override; |
| 58 | 58 |
| 59 const std::deque<TestPendingTask>& GetPendingTasks() const; | 59 const std::deque<TestPendingTask>& GetPendingTasks() const; |
| 60 bool HasPendingTask() const; | 60 bool HasPendingTask() const; |
| 61 base::TimeDelta NextPendingTaskDelay() const; | 61 base::TimeDelta NextPendingTaskDelay() const; |
| 62 | 62 |
| 63 // Clears the queue of pending tasks without running them. | 63 // Clears the queue of pending tasks without running them. |
| 64 void ClearPendingTasks(); | 64 void ClearPendingTasks(); |
| 65 | 65 |
| 66 // Runs each current pending task in order and clears the queue. | 66 // Runs each current pending task in order and clears the queue. |
| 67 // Any tasks posted by the tasks are not run. | 67 // Any tasks posted by the tasks are not run. |
| 68 virtual void RunPendingTasks(); | 68 virtual void RunPendingTasks(); |
| 69 | 69 |
| 70 // Runs pending tasks until the queue is empty. | 70 // Runs pending tasks until the queue is empty. |
| 71 void RunUntilIdle(); | 71 void RunUntilIdle(); |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 ~TestSimpleTaskRunner() override; | 74 ~TestSimpleTaskRunner() override; |
| 75 | 75 |
| 76 std::deque<TestPendingTask> pending_tasks_; | 76 std::deque<TestPendingTask> pending_tasks_; |
| 77 ThreadChecker thread_checker_; | 77 ThreadChecker thread_checker_; |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(TestSimpleTaskRunner); | 80 DISALLOW_COPY_AND_ASSIGN(TestSimpleTaskRunner); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace base | 83 } // namespace base |
| 84 | 84 |
| 85 #endif // BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ | 85 #endif // BASE_TEST_TEST_SIMPLE_TASK_RUNNER_H_ |
| OLD | NEW |