Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: components/scheduler/child/prioritizing_task_queue_selector_unittest.cc

Issue 1101703003: Adds a SHUTDOWN_TASK_QUEUE and a PreShutdown api to the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « components/scheduler/child/prioritizing_task_queue_selector.cc ('k') | components/scheduler/child/scheduler_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698