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/child/prioritizing_task_queue_selector.h" | 5 #include "components/scheduler/child/prioritizing_task_queue_selector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 selector_.SetQueuePriority(1, | 239 selector_.SetQueuePriority(1, |
240 PrioritizingTaskQueueSelector::CONTROL_PRIORITY); | 240 PrioritizingTaskQueueSelector::CONTROL_PRIORITY); |
241 for (int i = 0; i < 100; i++) { | 241 for (int i = 0; i < 100; i++) { |
242 EXPECT_TRUE(selector_.SelectWorkQueueToService(&chosen_queue_index)); | 242 EXPECT_TRUE(selector_.SelectWorkQueueToService(&chosen_queue_index)); |
243 EXPECT_EQ(1ul, chosen_queue_index); | 243 EXPECT_EQ(1ul, chosen_queue_index); |
244 // Don't remove task from queue to simulate all queues still being full. | 244 // Don't remove task from queue to simulate all queues still being full. |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
| 248 TEST_F(PrioritizingTaskQueueSelectorTest, PreShutdownBlocksDisable) { |
| 249 selector_.SetQueuePriority(0, PrioritizingTaskQueueSelector::NORMAL_PRIORITY); |
| 250 selector_.PreShutdown(); |
| 251 selector_.DisableQueue(0); |
| 252 EXPECT_TRUE(selector_.IsQueueEnabled(0)); |
| 253 } |
| 254 |
| 255 TEST_F(PrioritizingTaskQueueSelectorTest, PreShutdownBlocksSetQueuePriority) { |
| 256 selector_.DisableQueue(0); |
| 257 selector_.PreShutdown(); |
| 258 selector_.SetQueuePriority(0, PrioritizingTaskQueueSelector::NORMAL_PRIORITY); |
| 259 EXPECT_FALSE(selector_.IsQueueEnabled(0)); |
| 260 } |
| 261 |
| 262 TEST_F(PrioritizingTaskQueueSelectorTest, PreShutdownBlocksEnable) { |
| 263 selector_.DisableQueue(0); |
| 264 selector_.PreShutdown(); |
| 265 selector_.EnableQueue(0, PrioritizingTaskQueueSelector::NORMAL_PRIORITY); |
| 266 EXPECT_FALSE(selector_.IsQueueEnabled(0)); |
| 267 } |
| 268 |
248 } // namespace scheduler | 269 } // namespace scheduler |
OLD | NEW |