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