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