OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NULL_TASK_RUNNER_H_ | 5 #ifndef BASE_TEST_NULL_TASK_RUNNER_H_ |
6 #define BASE_TEST_NULL_TASK_RUNNER_H_ | 6 #define BASE_TEST_NULL_TASK_RUNNER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 | 14 |
15 // Helper class for tests that need to provide an implementation of a | 15 // Helper class for tests that need to provide an implementation of a |
16 // *TaskRunner class but don't actually care about tasks being run. | 16 // *TaskRunner class but don't actually care about tasks being run. |
17 | 17 |
18 class NullTaskRunner : public base::SingleThreadTaskRunner { | 18 class NullTaskRunner : public base::SingleThreadTaskRunner { |
19 public: | 19 public: |
20 NullTaskRunner(); | 20 NullTaskRunner(); |
21 | 21 |
22 bool PostDelayedTask(const tracked_objects::Location& from_here, | 22 bool PostDelayedTask(const tracked_objects::Location& from_here, |
23 base::OnceClosure task, | 23 base::OnceClosure task, |
24 base::TimeDelta delay) override; | 24 base::TimeDelta delay) override; |
25 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 25 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
26 base::OnceClosure task, | 26 base::OnceClosure task, |
27 base::TimeDelta delay) override; | 27 base::TimeDelta delay) override; |
28 // Always returns true to avoid triggering DCHECKs. | 28 // Always returns true to avoid triggering DCHECKs. |
29 bool RunsTasksOnCurrentThread() const override; | 29 bool RunsTasksInCurrentSequence() const override; |
30 | 30 |
31 protected: | 31 protected: |
32 ~NullTaskRunner() override; | 32 ~NullTaskRunner() override; |
33 | 33 |
34 DISALLOW_COPY_AND_ASSIGN(NullTaskRunner); | 34 DISALLOW_COPY_AND_ASSIGN(NullTaskRunner); |
35 }; | 35 }; |
36 | 36 |
37 } // namespace base | 37 } // namespace base |
38 | 38 |
39 #endif // BASE_TEST_NULL_TASK_RUNNER_H_ | 39 #endif // BASE_TEST_NULL_TASK_RUNNER_H_ |
OLD | NEW |