ScopedTaskScheduler should allow reassigning MessageLoop::task_runner after it's created |
||||
Issue descriptionFrom https://groups.google.com/a/chromium.org/d/msg/scheduler-dev/I6xoPn32JkM/mn56yVTABgAJ, gab@chromium.org said: You can combine this with a base::ScopedTaskScheduler to mock time for tasks posted to TaskScheduler. Thinking about it it's currently slightly convoluted though as you'll need to do the following in this specific order in your test fixture: private: base::MessageLoop message_loop_; base::ScopedMockTimeMessageLoopTaskRunner_ mock_time_task_runner_; base::ScopedTaskScheduler scoped_task_scheduler_; Ideally we could do: private: base::ScopedTaskScheduler scoped_task_scheduler_; base::ScopedMockTimeMessageLoopTaskRunner_ mock_time_task_runner_; Just like we can currently do: private: base::TestBrowserThreadBundle thread_bundle_; base::ScopedMockTimeMessageLoopTaskRunner_ mock_time_task_runner_; The reason it's currently convoluted is that ScopedTaskScheduler takes a reference to MessageLoop::task_runner() when it's constructed so the mock needs to already be in place by the time ScopedTaskScheduler is constructed.
,
Feb 17 2017
,
Feb 21 2017
Re-opening because this broke a unit test in https://codereview.chromium.org/2565873002/
,
Feb 22 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3c23304fa3f46c328792413ea3de60ea86e27fbd commit 3c23304fa3f46c328792413ea3de60ea86e27fbd Author: joenotcharles <joenotcharles@chromium.org> Date: Wed Feb 22 22:07:17 2017 Use the saved task runner if TestTaskScheduler is re-entered from a task executed by RunTask. BUG= 690504 Review-Url: https://codereview.chromium.org/2713513003 Cr-Commit-Position: refs/heads/master@{#452226} [modify] https://crrev.com/3c23304fa3f46c328792413ea3de60ea86e27fbd/base/test/scoped_task_scheduler.cc [modify] https://crrev.com/3c23304fa3f46c328792413ea3de60ea86e27fbd/base/test/scoped_task_scheduler_unittest.cc
,
Feb 22 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by bugdroid1@chromium.org
, Feb 16 2017