Index: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc |
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc |
index ed91bfac1b981f370ca3091b44057560d31c0ed8..5f750da52bc2840f60a6a858d3d17e04a649d22b 100644 |
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc |
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc |
@@ -272,9 +272,10 @@ TEST_F(TaskQueueManagerTest, NowNotCalledForNestedTasks) { |
} |
runners_[0]->PostTask( |
- FROM_HERE, base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
- base::RetainedRef(runners_[0]), |
- base::Unretained(&tasks_to_post_from_nested_loop))); |
+ FROM_HERE, |
+ base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
+ base::RetainedRef(runners_[0]), |
+ base::Unretained(&tasks_to_post_from_nested_loop))); |
base::RunLoop().RunUntilIdle(); |
// We need to call Now twice, to measure the start and end of the outermost |
@@ -357,9 +358,10 @@ TEST_F(TaskQueueManagerTest, NonNestableTaskDoesntExecuteInNestedLoop) { |
std::make_pair(base::Bind(&TestTask, 5, &run_order), true)); |
runners_[0]->PostTask( |
- FROM_HERE, base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
- base::RetainedRef(runners_[0]), |
- base::Unretained(&tasks_to_post_from_nested_loop))); |
+ FROM_HERE, |
+ base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
+ base::RetainedRef(runners_[0]), |
+ base::Unretained(&tasks_to_post_from_nested_loop))); |
base::RunLoop().RunUntilIdle(); |
// Note we expect task 3 to run last because it's non-nestable. |
@@ -861,8 +863,9 @@ TEST_F(TaskQueueManagerTest, PostFromThread) { |
void RePostingTestTask(scoped_refptr<base::SingleThreadTaskRunner> runner, |
int* run_count) { |
(*run_count)++; |
- runner->PostTask(FROM_HERE, Bind(&RePostingTestTask, |
- base::Unretained(runner.get()), run_count)); |
+ runner->PostTask( |
+ FROM_HERE, |
+ Bind(&RePostingTestTask, base::Unretained(runner.get()), run_count)); |
} |
TEST_F(TaskQueueManagerTest, DoWorkCantPostItselfMultipleTimes) { |
@@ -889,9 +892,10 @@ TEST_F(TaskQueueManagerTest, PostFromNestedRunloop) { |
runners_[0]->PostTask(FROM_HERE, base::Bind(&TestTask, 0, &run_order)); |
runners_[0]->PostTask( |
- FROM_HERE, base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
- base::RetainedRef(runners_[0]), |
- base::Unretained(&tasks_to_post_from_nested_loop))); |
+ FROM_HERE, |
+ base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
+ base::RetainedRef(runners_[0]), |
+ base::Unretained(&tasks_to_post_from_nested_loop))); |
runners_[0]->PostTask(FROM_HERE, base::Bind(&TestTask, 2, &run_order)); |
base::RunLoop().RunUntilIdle(); |
@@ -1098,8 +1102,9 @@ TEST_F(TaskQueueManagerTest, DeleteTaskQueueManagerInsideATask) { |
Initialize(1u); |
runners_[0]->PostTask( |
- FROM_HERE, base::Bind(&TaskQueueManagerTest::DeleteTaskQueueManager, |
- base::Unretained(this))); |
+ FROM_HERE, |
+ base::Bind(&TaskQueueManagerTest::DeleteTaskQueueManager, |
+ base::Unretained(this))); |
// This should not crash, assuming DoWork detects the TaskQueueManager has |
// been deleted. |
@@ -1196,8 +1201,9 @@ TEST_F(TaskQueueManagerTest, ImmediateAndDelayedTaskInterleaving) { |
test_task_runner_->RunForPeriod(delay); |
for (int i = 0; i < 9; i++) { |
- runners_[0]->PostTask(FROM_HERE, base::Bind(&ExpensiveTestTask, i, |
- now_src_.get(), &run_order)); |
+ runners_[0]->PostTask( |
+ FROM_HERE, |
+ base::Bind(&ExpensiveTestTask, i, now_src_.get(), &run_order)); |
} |
test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); |
@@ -1283,10 +1289,11 @@ TEST_F(TaskQueueManagerTest, QuitWhileNested) { |
bool was_nested = true; |
base::RunLoop run_loop; |
- runners_[0]->PostTask(FROM_HERE, base::Bind(&PostAndQuitFromNestedRunloop, |
- base::Unretained(&run_loop), |
- base::RetainedRef(runners_[0]), |
- base::Unretained(&was_nested))); |
+ runners_[0]->PostTask( |
+ FROM_HERE, |
+ base::Bind(&PostAndQuitFromNestedRunloop, base::Unretained(&run_loop), |
+ base::RetainedRef(runners_[0]), |
+ base::Unretained(&was_nested))); |
base::RunLoop().RunUntilIdle(); |
EXPECT_FALSE(was_nested); |
@@ -1525,9 +1532,10 @@ TEST_F(TaskQueueManagerTest, UnregisterTaskQueueInNestedLoop) { |
base::Unretained(task_queue.get())), |
true)); |
runners_[0]->PostTask( |
- FROM_HERE, base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
- base::RetainedRef(runners_[0]), |
- base::Unretained(&tasks_to_post_from_nested_loop))); |
+ FROM_HERE, |
+ base::Bind(&PostFromNestedRunloop, message_loop_.get(), |
+ base::RetainedRef(runners_[0]), |
+ base::Unretained(&tasks_to_post_from_nested_loop))); |
base::RunLoop().RunUntilIdle(); |
// Add a final call to HasOneRefTask. This gives the manager a chance to |
@@ -2047,10 +2055,12 @@ TEST_F(TaskQueueManagerTest, CurrentlyExecutingTaskQueue_TaskRunning) { |
internal::TaskQueueImpl* queue1 = runners_[1].get(); |
std::vector<TaskQueue*> task_sources; |
- queue0->PostTask(FROM_HERE, base::Bind(&CurrentlyExecutingTaskQueueTestTask, |
- manager_.get(), &task_sources)); |
- queue1->PostTask(FROM_HERE, base::Bind(&CurrentlyExecutingTaskQueueTestTask, |
- manager_.get(), &task_sources)); |
+ queue0->PostTask(FROM_HERE, |
+ base::Bind(&CurrentlyExecutingTaskQueueTestTask, |
+ manager_.get(), &task_sources)); |
+ queue1->PostTask(FROM_HERE, |
+ base::Bind(&CurrentlyExecutingTaskQueueTestTask, |
+ manager_.get(), &task_sources)); |
test_task_runner_->RunUntilIdle(); |
EXPECT_THAT(task_sources, ElementsAre(queue0, queue1)); |
@@ -2094,10 +2104,10 @@ TEST_F(TaskQueueManagerTest, CurrentlyExecutingTaskQueue_NestedLoop) { |
manager_.get(), &task_sources), |
queue2)); |
- queue0->PostTask( |
- FROM_HERE, base::Bind(&RunloopCurrentlyExecutingTaskQueueTestTask, |
- message_loop_.get(), manager_.get(), &task_sources, |
- &tasks_to_post_from_nested_loop)); |
+ queue0->PostTask(FROM_HERE, |
+ base::Bind(&RunloopCurrentlyExecutingTaskQueueTestTask, |
+ message_loop_.get(), manager_.get(), |
+ &task_sources, &tasks_to_post_from_nested_loop)); |
base::RunLoop().RunUntilIdle(); |
EXPECT_THAT(task_sources, ElementsAre(queue0, queue1, queue2, queue0)); |
@@ -2202,20 +2212,24 @@ TEST_F(TaskQueueManagerTest, NoWakeUpsForCanceledDelayedTasks) { |
base::TimeDelta delay4(base::TimeDelta::FromSeconds(30)); |
std::vector<base::TimeTicks> run_times; |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task1.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task1.weak_factory_.GetWeakPtr(), &run_times), |
delay1); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task2.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task2.weak_factory_.GetWeakPtr(), &run_times), |
delay2); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task3.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task3.weak_factory_.GetWeakPtr(), &run_times), |
delay3); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task4.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task4.weak_factory_.GetWeakPtr(), &run_times), |
delay4); |
task2.weak_factory_.InvalidateWeakPtrs(); |
@@ -2250,20 +2264,24 @@ TEST_F(TaskQueueManagerTest, NoWakeUpsForCanceledDelayedTasksReversePostOrder) { |
base::TimeDelta delay4(base::TimeDelta::FromSeconds(30)); |
std::vector<base::TimeTicks> run_times; |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task4.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task4.weak_factory_.GetWeakPtr(), &run_times), |
delay4); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task3.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task3.weak_factory_.GetWeakPtr(), &run_times), |
delay3); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task2.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task2.weak_factory_.GetWeakPtr(), &run_times), |
delay2); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task1.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task1.weak_factory_.GetWeakPtr(), &run_times), |
delay1); |
task2.weak_factory_.InvalidateWeakPtrs(); |
@@ -2298,20 +2316,24 @@ TEST_F(TaskQueueManagerTest, TimeDomainWakeUpOnlyCancelledIfAllUsesCancelled) { |
base::TimeDelta delay4(base::TimeDelta::FromSeconds(30)); |
std::vector<base::TimeTicks> run_times; |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task1.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task1.weak_factory_.GetWeakPtr(), &run_times), |
delay1); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task2.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task2.weak_factory_.GetWeakPtr(), &run_times), |
delay2); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task3.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task3.weak_factory_.GetWeakPtr(), &run_times), |
delay3); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task4.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task4.weak_factory_.GetWeakPtr(), &run_times), |
delay4); |
// Post a non-canceled task with |delay3|. So we should still get a wakeup at |
@@ -2432,20 +2454,24 @@ TEST_F(TaskQueueManagerTest, SweepCanceledDelayedTasks) { |
base::TimeDelta delay4(base::TimeDelta::FromSeconds(30)); |
std::vector<base::TimeTicks> run_times; |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task1.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task1.weak_factory_.GetWeakPtr(), &run_times), |
delay1); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task2.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task2.weak_factory_.GetWeakPtr(), &run_times), |
delay2); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task3.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task3.weak_factory_.GetWeakPtr(), &run_times), |
delay3); |
runners_[0]->PostDelayedTask( |
- FROM_HERE, base::Bind(&CancelableTask::RecordTimeTask, |
- task4.weak_factory_.GetWeakPtr(), &run_times), |
+ FROM_HERE, |
+ base::Bind(&CancelableTask::RecordTimeTask, |
+ task4.weak_factory_.GetWeakPtr(), &run_times), |
delay4); |
EXPECT_EQ(4u, runners_[0]->GetNumberOfPendingTasks()); |