| 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 "platform/scheduler/child/scheduler_helper.h" | 5 #include "platform/scheduler/child/scheduler_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 RunUntilIdle(); | 108 RunUntilIdle(); |
| 109 EXPECT_THAT(run_order, | 109 EXPECT_THAT(run_order, |
| 110 testing::ElementsAre(std::string("D1"), std::string("D2"), | 110 testing::ElementsAre(std::string("D1"), std::string("D2"), |
| 111 std::string("D3"), std::string("D4"))); | 111 std::string("D3"), std::string("D4"))); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(SchedulerHelperTest, TestRentrantTask) { | 114 TEST_F(SchedulerHelperTest, TestRentrantTask) { |
| 115 int count = 0; | 115 int count = 0; |
| 116 std::vector<int> run_order; | 116 std::vector<int> run_order; |
| 117 default_task_runner_->PostTask( | 117 default_task_runner_->PostTask( |
| 118 FROM_HERE, base::Bind(AppendToVectorReentrantTask, | 118 FROM_HERE, |
| 119 base::RetainedRef(default_task_runner_), &run_order, | 119 base::Bind(AppendToVectorReentrantTask, |
| 120 &count, 5)); | 120 base::RetainedRef(default_task_runner_), &run_order, &count, |
| 121 5)); |
| 121 RunUntilIdle(); | 122 RunUntilIdle(); |
| 122 | 123 |
| 123 EXPECT_THAT(run_order, testing::ElementsAre(0, 1, 2, 3, 4)); | 124 EXPECT_THAT(run_order, testing::ElementsAre(0, 1, 2, 3, 4)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 TEST_F(SchedulerHelperTest, IsShutdown) { | 127 TEST_F(SchedulerHelperTest, IsShutdown) { |
| 127 EXPECT_FALSE(scheduler_helper_->IsShutdown()); | 128 EXPECT_FALSE(scheduler_helper_->IsShutdown()); |
| 128 | 129 |
| 129 scheduler_helper_->Shutdown(); | 130 scheduler_helper_->Shutdown(); |
| 130 EXPECT_TRUE(scheduler_helper_->IsShutdown()); | 131 EXPECT_TRUE(scheduler_helper_->IsShutdown()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 voter->SetQueueEnabled(false); | 228 voter->SetQueueEnabled(false); |
| 228 | 229 |
| 229 EXPECT_CALL(observer, OnTriedToExecuteBlockedTask(_, _)).Times(1); | 230 EXPECT_CALL(observer, OnTriedToExecuteBlockedTask(_, _)).Times(1); |
| 230 RunUntilIdle(); | 231 RunUntilIdle(); |
| 231 | 232 |
| 232 scheduler_helper_->SetObserver(nullptr); | 233 scheduler_helper_->SetObserver(nullptr); |
| 233 } | 234 } |
| 234 | 235 |
| 235 } // namespace scheduler | 236 } // namespace scheduler |
| 236 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |