| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "components/scheduler/base/task_queue_manager.h" | 5 #include "components/scheduler/base/task_queue_manager.h" | 
| 6 | 6 | 
| 7 #include "base/location.h" | 7 #include "base/location.h" | 
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" | 
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" | 
| 10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" | 
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1451 | 1451 | 
| 1452   domain_b->AdvanceTo(start_time + base::TimeDelta::FromMilliseconds(50)); | 1452   domain_b->AdvanceTo(start_time + base::TimeDelta::FromMilliseconds(50)); | 
| 1453 | 1453 | 
| 1454   test_task_runner_->RunUntilIdle(); | 1454   test_task_runner_->RunUntilIdle(); | 
| 1455   EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4)); | 1455   EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4)); | 
| 1456 | 1456 | 
| 1457   manager_->UnregisterTimeDomain(domain_a); | 1457   manager_->UnregisterTimeDomain(domain_a); | 
| 1458   manager_->UnregisterTimeDomain(domain_b); | 1458   manager_->UnregisterTimeDomain(domain_b); | 
| 1459 } | 1459 } | 
| 1460 | 1460 | 
|  | 1461 namespace { | 
|  | 1462 void ChromiumRunloopInspectionTask( | 
|  | 1463     scoped_refptr<cc::OrderedSimpleTaskRunner> test_task_runner) { | 
|  | 1464   EXPECT_EQ(1u, test_task_runner->NumPendingTasks()); | 
|  | 1465 } | 
|  | 1466 }  // namespace | 
|  | 1467 | 
|  | 1468 TEST_F(TaskQueueManagerTest, NumberOfPendingTasksOnChromiumRunLoop) { | 
|  | 1469   Initialize(1u); | 
|  | 1470 | 
|  | 1471   // NOTE because tasks posted to the chromiumrun loop are not cancellable, we | 
|  | 1472   // will end up with a lot more tasks posted if the delayed tasks were posted | 
|  | 1473   // in the reverse order. | 
|  | 1474   // TODO(alexclarke): Consider talking to the message pump directly. | 
|  | 1475   test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); | 
|  | 1476   for (int i = 1; i < 100; i++) { | 
|  | 1477     runners_[0]->PostDelayedTask( | 
|  | 1478         FROM_HERE, | 
|  | 1479         base::Bind(&ChromiumRunloopInspectionTask, test_task_runner_), | 
|  | 1480         base::TimeDelta::FromMilliseconds(i)); | 
|  | 1481   } | 
|  | 1482   test_task_runner_->RunUntilIdle(); | 
|  | 1483 } | 
|  | 1484 | 
| 1461 }  // namespace scheduler | 1485 }  // namespace scheduler | 
| OLD | NEW | 
|---|