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

Side by Side Diff: components/scheduler/base/task_queue_selector_unittest.cc

Issue 1441073006: Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_selector.h" 5 #include "components/scheduler/base/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/pending_task.h" 9 #include "base/pending_task.h"
10 #include "components/scheduler/base/task_queue_impl.h" 10 #include "components/scheduler/base/task_queue_impl.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 selector_.GetTaskQueueSets()->OnPopQueue(chosen_queue); 69 selector_.GetTaskQueueSets()->OnPopQueue(chosen_queue);
70 } 70 }
71 return order; 71 return order;
72 } 72 }
73 73
74 static void TestFunction() {} 74 static void TestFunction() {}
75 75
76 protected: 76 protected:
77 void SetUp() final { 77 void SetUp() final {
78 virtual_time_domain_ = make_scoped_refptr<VirtualTimeDomain>( 78 virtual_time_domain_ = make_scoped_refptr<VirtualTimeDomain>(
79 new VirtualTimeDomain(base::TimeTicks())); 79 new VirtualTimeDomain(nullptr, base::TimeTicks()));
80 for (size_t i = 0; i < kTaskQueueCount; i++) { 80 for (size_t i = 0; i < kTaskQueueCount; i++) {
81 scoped_refptr<TaskQueueImpl> task_queue = make_scoped_refptr( 81 scoped_refptr<TaskQueueImpl> task_queue = make_scoped_refptr(
82 new TaskQueueImpl(nullptr, virtual_time_domain_, 82 new TaskQueueImpl(nullptr, virtual_time_domain_,
83 TaskQueue::Spec("test queue"), "test", "test")); 83 TaskQueue::Spec("test queue"), "test", "test"));
84 selector_.AddQueue(task_queue.get()); 84 selector_.AddQueue(task_queue.get());
85 task_queues_.push_back(task_queue); 85 task_queues_.push_back(task_queue);
86 } 86 }
87 for (size_t i = 0; i < kTaskQueueCount; i++) { 87 for (size_t i = 0; i < kTaskQueueCount; i++) {
88 EXPECT_TRUE(selector_.IsQueueEnabled(task_queues_[i].get())) << i; 88 EXPECT_TRUE(selector_.IsQueueEnabled(task_queues_[i].get())) << i;
89 queue_to_index_map_.insert(std::make_pair(task_queues_[i].get(), i)); 89 queue_to_index_map_.insert(std::make_pair(task_queues_[i].get(), i));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 size_t queue_order[] = {0, 1}; 278 size_t queue_order[] = {0, 1};
279 PushTasks(tasks, queue_order); 279 PushTasks(tasks, queue_order);
280 280
281 EXPECT_FALSE(selector_.EnabledWorkQueuesEmpty()); 281 EXPECT_FALSE(selector_.EnabledWorkQueuesEmpty());
282 PopTasks(); 282 PopTasks();
283 EXPECT_TRUE(selector_.EnabledWorkQueuesEmpty()); 283 EXPECT_TRUE(selector_.EnabledWorkQueuesEmpty());
284 } 284 }
285 285
286 } // namespace internal 286 } // namespace internal
287 } // namespace scheduler 287 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698