OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_TEST_SCOPED_MOCK_MESSAGE_LOOP_TASK_RUNNER_WRAPPER_H_ | |
6 #define BASE_TEST_SCOPED_MOCK_MESSAGE_LOOP_TASK_RUNNER_WRAPPER_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <memory> | |
11 #include <queue> | |
12 #include <vector> | |
13 | |
14 #include "base/macros.h" | |
15 #include "base/single_thread_task_runner.h" | |
16 #include "base/synchronization/lock.h" | |
17 #include "base/test/test_pending_task.h" | |
18 #include "base/threading/thread_checker.h" | |
19 #include "base/time/time.h" | |
20 | |
21 namespace base { | |
gab
2016/11/15 22:02:06
empty line after namespace
bruthig
2016/11/15 22:17:57
Done.
| |
22 class TestMockTimeTaskRunner; | |
23 class SingleThreadTaskRunner; | |
24 | |
25 // A scoped wrapper around TestMockTimeTaskRunner that replaces | |
26 // MessageLoop::current()'s task runner (and consequently | |
27 // ThreadTaskRunnerHandle) with a TestMockTimeTaskRunner and resets it back at | |
28 // the end of the scope. | |
29 class ScopedMockMessageLoopTaskRunnerWrapper { | |
30 public: | |
31 ScopedMockMessageLoopTaskRunnerWrapper(); | |
32 ~ScopedMockMessageLoopTaskRunnerWrapper(); | |
33 | |
34 TestMockTimeTaskRunner* task_runner() { return task_runner_.get(); } | |
35 | |
36 private: | |
37 const scoped_refptr<TestMockTimeTaskRunner> task_runner_; | |
38 scoped_refptr<SingleThreadTaskRunner> previous_task_runner_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(ScopedMockMessageLoopTaskRunnerWrapper); | |
41 }; | |
42 | |
43 } // namespace base | |
44 | |
45 #endif // BASE_TEST_SCOPED_MOCK_MESSAGE_LOOP_TASK_RUNNER_WRAPPER_H_ | |
OLD | NEW |