Chromium Code Reviews| Index: base/task_scheduler/task_scheduler_impl_unittest.cc |
| diff --git a/base/task_scheduler/task_scheduler_impl_unittest.cc b/base/task_scheduler/task_scheduler_impl_unittest.cc |
| index 6aaf4af8753cd16976280e8c0af0f56cbaeb93e9..76f06d35b8a16ef05341ab45017f46eb7e6c05fc 100644 |
| --- a/base/task_scheduler/task_scheduler_impl_unittest.cc |
| +++ b/base/task_scheduler/task_scheduler_impl_unittest.cc |
| @@ -322,5 +322,27 @@ TEST_F(TaskSchedulerImplTest, GetMaxConcurrentTasksWithTraitsDeprecated) { |
| TaskTraits().WithPriority(TaskPriority::USER_BLOCKING).MayBlock())); |
| } |
| +// Verify that the RunsTasksOnCurrentThread() method of a Sequenced TaskRunner |
| +// returns false when called from a task that isn't part of the sequence. Note: |
|
gab
2017/02/21 21:39:50
"Note:" ?
robliao
2017/02/22 01:04:19
Removed. (It's no longer needed)
|
| +TEST_F(TaskSchedulerImplTest, SequencedRunsTasksOnCurrentThread) { |
| + auto task_runner = |
| + scheduler_->CreateSingleThreadTaskRunnerWithTraits(TaskTraits()); |
| + auto sequenced_task_runner = |
| + scheduler_->CreateSequencedTaskRunnerWithTraits(TaskTraits()); |
| + |
| + WaitableEvent task_ran(WaitableEvent::ResetPolicy::MANUAL, |
| + WaitableEvent::InitialState::NOT_SIGNALED); |
| + task_runner->PostTask( |
| + FROM_HERE, |
| + Bind( |
| + [](scoped_refptr<TaskRunner> sequenced_task_runner, |
| + WaitableEvent* task_ran) { |
| + EXPECT_FALSE(sequenced_task_runner->RunsTasksOnCurrentThread()); |
| + task_ran->Signal(); |
| + }, |
| + sequenced_task_runner, Unretained(&task_ran))); |
| + task_ran.Wait(); |
|
gab
2017/02/21 21:39:50
Also test the other way around?
And drop TaskSche
robliao
2017/02/22 01:04:19
Removed redundant test and added reverse.
|
| +} |
| + |
| } // namespace internal |
| } // namespace base |