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

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

Issue 1432263002: (reland) Adds TimeDomains to the TaskQueueManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to fix test bug Created 5 years, 1 month 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"
11 #include "components/scheduler/base/task_queue_sets.h" 11 #include "components/scheduler/base/task_queue_sets.h"
12 #include "components/scheduler/base/time_domain.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 using testing::_; 16 using testing::_;
16 17
17 namespace scheduler { 18 namespace scheduler {
18 namespace internal { 19 namespace internal {
19 20
20 class MockObserver : public TaskQueueSelector::Observer { 21 class MockObserver : public TaskQueueSelector::Observer {
21 public: 22 public:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 selector_.GetTaskQueueSets()->OnPopQueue(chosen_queue); 69 selector_.GetTaskQueueSets()->OnPopQueue(chosen_queue);
69 } 70 }
70 return order; 71 return order;
71 } 72 }
72 73
73 static void TestFunction() {} 74 static void TestFunction() {}
74 75
75 protected: 76 protected:
76 void SetUp() final { 77 void SetUp() final {
77 for (size_t i = 0; i < kTaskQueueCount; i++) { 78 for (size_t i = 0; i < kTaskQueueCount; i++) {
78 scoped_refptr<TaskQueueImpl> task_queue = 79 scoped_refptr<TaskQueueImpl> task_queue = make_scoped_refptr(
79 make_scoped_refptr(new TaskQueueImpl( 80 new TaskQueueImpl(nullptr, scoped_refptr<TimeDomain>(),
80 nullptr, TaskQueue::Spec("test queue"), "test", "test")); 81 TaskQueue::Spec("test queue"), "test", "test"));
81 selector_.AddQueue(task_queue.get()); 82 selector_.AddQueue(task_queue.get());
82 task_queues_.push_back(task_queue); 83 task_queues_.push_back(task_queue);
83 } 84 }
84 for (size_t i = 0; i < kTaskQueueCount; i++) { 85 for (size_t i = 0; i < kTaskQueueCount; i++) {
85 EXPECT_TRUE(selector_.IsQueueEnabled(task_queues_[i].get())) << i; 86 EXPECT_TRUE(selector_.IsQueueEnabled(task_queues_[i].get())) << i;
86 queue_to_index_map_.insert(std::make_pair(task_queues_[i].get(), i)); 87 queue_to_index_map_.insert(std::make_pair(task_queues_[i].get(), i));
87 } 88 }
88 } 89 }
89 90
90 const size_t kTaskQueueCount = 5; 91 const size_t kTaskQueueCount = 5;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 size_t queue_order[] = {0, 1}; 275 size_t queue_order[] = {0, 1};
275 PushTasks(tasks, queue_order); 276 PushTasks(tasks, queue_order);
276 277
277 EXPECT_FALSE(selector_.EnabledWorkQueuesEmpty()); 278 EXPECT_FALSE(selector_.EnabledWorkQueuesEmpty());
278 PopTasks(); 279 PopTasks();
279 EXPECT_TRUE(selector_.EnabledWorkQueuesEmpty()); 280 EXPECT_TRUE(selector_.EnabledWorkQueuesEmpty());
280 } 281 }
281 282
282 } // namespace internal 283 } // namespace internal
283 } // namespace scheduler 284 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698