| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void RunUntilIdle(); | 53 void RunUntilIdle(); |
| 54 | 54 |
| 55 // Returns the current virtual time. | 55 // Returns the current virtual time. |
| 56 TimeTicks GetCurrentMockTime() const; | 56 TimeTicks GetCurrentMockTime() const; |
| 57 | 57 |
| 58 // Returns a TickClock that uses the mock time of |this| as its time source. | 58 // Returns a TickClock that uses the mock time of |this| as its time source. |
| 59 // The returned TickClock will hold a reference to |this|. | 59 // The returned TickClock will hold a reference to |this|. |
| 60 scoped_ptr<TickClock> GetMockTickClock() const; | 60 scoped_ptr<TickClock> GetMockTickClock() const; |
| 61 | 61 |
| 62 bool HasPendingTask() const; | 62 bool HasPendingTask() const; |
| 63 size_t GetPendingTaskCount() const; |
| 63 TimeDelta NextPendingTaskDelay() const; | 64 TimeDelta NextPendingTaskDelay() const; |
| 64 | 65 |
| 65 // SingleThreadTaskRunner: | 66 // SingleThreadTaskRunner: |
| 66 bool RunsTasksOnCurrentThread() const override; | 67 bool RunsTasksOnCurrentThread() const override; |
| 67 bool PostDelayedTask(const tracked_objects::Location& from_here, | 68 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 68 const base::Closure& task, | 69 const base::Closure& task, |
| 69 TimeDelta delay) override; | 70 TimeDelta delay) override; |
| 70 bool PostNonNestableDelayedTask( | 71 bool PostNonNestableDelayedTask( |
| 71 const tracked_objects::Location& from_here, | 72 const tracked_objects::Location& from_here, |
| 72 const base::Closure& task, | 73 const base::Closure& task, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // |tasks_lock_| is held. | 114 // |tasks_lock_| is held. |
| 114 TaskPriorityQueue tasks_; | 115 TaskPriorityQueue tasks_; |
| 115 base::Lock tasks_lock_; | 116 base::Lock tasks_lock_; |
| 116 | 117 |
| 117 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); | 118 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 } // namespace base | 121 } // namespace base |
| 121 | 122 |
| 122 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ | 123 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |
| OLD | NEW |