| 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 #ifndef BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ | 5 #ifndef BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |
| 6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ | 6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool PostDelayedTask(const tracked_objects::Location& from_here, | 87 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 88 const Closure& task, | 88 const Closure& task, |
| 89 TimeDelta delay) override; | 89 TimeDelta delay) override; |
| 90 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 90 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 91 const Closure& task, | 91 const Closure& task, |
| 92 TimeDelta delay) override; | 92 TimeDelta delay) override; |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 ~TestMockTimeTaskRunner() override; | 95 ~TestMockTimeTaskRunner() override; |
| 96 | 96 |
| 97 // Whether the elapsing of virtual time is stopped or not. Subclasses can |
| 98 // override this method to perform early exits from a running task runner. |
| 99 // Defaults to always return false. |
| 100 virtual bool IsElapsingStopped(); |
| 101 |
| 97 // Called before the next task to run is selected, so that subclasses have a | 102 // Called before the next task to run is selected, so that subclasses have a |
| 98 // last chance to make sure all tasks are posted. | 103 // last chance to make sure all tasks are posted. |
| 99 virtual void OnBeforeSelectingTask(); | 104 virtual void OnBeforeSelectingTask(); |
| 100 | 105 |
| 101 // Called after the current mock time has been incremented so that subclasses | 106 // Called after the current mock time has been incremented so that subclasses |
| 102 // can react to the passing of time. | 107 // can react to the passing of time. |
| 103 virtual void OnAfterTimePassed(); | 108 virtual void OnAfterTimePassed(); |
| 104 | 109 |
| 105 // Called after each task is run so that subclasses may perform additional | 110 // Called after each task is run so that subclasses may perform additional |
| 106 // activities, e.g., pump additional task runners. | 111 // activities, e.g., pump additional task runners. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // |tasks_lock_| is held. | 149 // |tasks_lock_| is held. |
| 145 TaskPriorityQueue tasks_; | 150 TaskPriorityQueue tasks_; |
| 146 Lock tasks_lock_; | 151 Lock tasks_lock_; |
| 147 | 152 |
| 148 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); | 153 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); |
| 149 }; | 154 }; |
| 150 | 155 |
| 151 } // namespace base | 156 } // namespace base |
| 152 | 157 |
| 153 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ | 158 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |
| OLD | NEW |