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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // source. The returned TickClock will hold a reference to |this|. | 83 // source. The returned TickClock will hold a reference to |this|. |
84 std::unique_ptr<TickClock> GetMockTickClock() const; | 84 std::unique_ptr<TickClock> GetMockTickClock() const; |
85 | 85 |
86 bool HasPendingTask() const; | 86 bool HasPendingTask() const; |
87 size_t GetPendingTaskCount() const; | 87 size_t GetPendingTaskCount() const; |
88 TimeDelta NextPendingTaskDelay() const; | 88 TimeDelta NextPendingTaskDelay() const; |
89 | 89 |
90 // SingleThreadTaskRunner: | 90 // SingleThreadTaskRunner: |
91 bool RunsTasksOnCurrentThread() const override; | 91 bool RunsTasksOnCurrentThread() const override; |
92 bool PostDelayedTask(const tracked_objects::Location& from_here, | 92 bool PostDelayedTask(const tracked_objects::Location& from_here, |
93 const Closure& task, | 93 OnceClosure task, |
94 TimeDelta delay) override; | 94 TimeDelta delay) override; |
95 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 95 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
96 const Closure& task, | 96 OnceClosure task, |
97 TimeDelta delay) override; | 97 TimeDelta delay) override; |
98 | 98 |
99 protected: | 99 protected: |
100 ~TestMockTimeTaskRunner() override; | 100 ~TestMockTimeTaskRunner() override; |
101 | 101 |
102 // Whether the elapsing of virtual time is stopped or not. Subclasses can | 102 // Whether the elapsing of virtual time is stopped or not. Subclasses can |
103 // override this method to perform early exits from a running task runner. | 103 // override this method to perform early exits from a running task runner. |
104 // Defaults to always return false. | 104 // Defaults to always return false. |
105 virtual bool IsElapsingStopped(); | 105 virtual bool IsElapsingStopped(); |
106 | 106 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 size_t next_task_ordinal_; | 161 size_t next_task_ordinal_; |
162 | 162 |
163 Lock tasks_lock_; | 163 Lock tasks_lock_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); | 165 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); |
166 }; | 166 }; |
167 | 167 |
168 } // namespace base | 168 } // namespace base |
169 | 169 |
170 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ | 170 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |
OLD | NEW |