Index: base/test/test_mock_time_task_runner.h |
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h |
index 624f739cfa55604089e39858919ccaf117bb5701..1bcff916474e92200e623751f678e2481303e139 100644 |
--- a/base/test/test_mock_time_task_runner.h |
+++ b/base/test/test_mock_time_task_runner.h |
@@ -165,6 +165,23 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner { |
DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); |
}; |
+// A scoped wrapper around TestMockTimeTaskRunner that replaces message loop's |
gab
2016/11/15 19:52:01
s/message loop's task runner/MessageLoop::current(
bruthig
2016/11/15 21:52:45
Done.
|
+// task runner with a TestMockTimeTaskRunner and resets it back at the end of |
+// the scope. |
+class ScopedMockTaskRunnerWrapper { |
gab
2016/11/15 19:52:01
Make name ML specific, i.e. ScopedMockMessageLoopT
danakj
2016/11/15 19:58:13
I think this class could go in its own .h and .cc
bruthig
2016/11/15 21:52:45
Done.
bruthig
2016/11/15 21:52:45
Done.
|
+ public: |
+ ScopedMockTaskRunnerWrapper(); |
+ virtual ~ScopedMockTaskRunnerWrapper(); |
gab
2016/11/15 19:52:01
non-virtual destructor for class with no virtual m
bruthig
2016/11/15 21:52:45
Done.
|
+ |
+ base::TestMockTimeTaskRunner* task_runner() { return task_runner_.get(); } |
gab
2016/11/15 19:52:01
const
bruthig
2016/11/15 21:52:45
If we return a "const TestMockTimeTaskRunner*" the
gab
2016/11/15 22:02:05
Sorry, I meant to make the method const, i.e.
ba
bruthig
2016/11/15 22:17:57
Are you sure? The style guide advises not to make
gab
2016/11/15 23:16:59
Ah interesting, had missed that part of it, please
|
+ |
+ private: |
+ scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; |
gab
2016/11/15 19:52:01
const (will also require to move initialization to
bruthig
2016/11/15 21:52:45
Done, but not sure if you meant
const scoped_refpt
gab
2016/11/15 22:02:05
const scoped_refptr<TestMockTimeTaskRunner>
(i.e.
bruthig
2016/11/15 22:17:57
Thx
|
+ scoped_refptr<base::SingleThreadTaskRunner> previous_task_runner_; |
gab
2016/11/15 19:52:01
nit: no base:: prefix above nor in .cc file (this
bruthig
2016/11/15 21:52:44
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedMockTaskRunnerWrapper); |
+}; |
+ |
} // namespace base |
#endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ |