OLD | NEW |
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 "platform/scheduler/base/work_queue_sets.h" | 5 #include "platform/scheduler/base/work_queue_sets.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "platform/scheduler/base/work_queue.h" | 10 #include "platform/scheduler/base/work_queue.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 TEST_F(WorkQueueSetsTest, OnPushQueue) { | 73 TEST_F(WorkQueueSetsTest, OnPushQueue) { |
74 WorkQueue* work_queue = NewTaskQueue("queue"); | 74 WorkQueue* work_queue = NewTaskQueue("queue"); |
75 size_t set = TaskQueue::NORMAL_PRIORITY; | 75 size_t set = TaskQueue::NORMAL_PRIORITY; |
76 work_queue_sets_->ChangeSetIndex(work_queue, set); | 76 work_queue_sets_->ChangeSetIndex(work_queue, set); |
77 | 77 |
78 WorkQueue* selected_work_queue; | 78 WorkQueue* selected_work_queue; |
79 EXPECT_FALSE( | 79 EXPECT_FALSE( |
80 work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); | 80 work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); |
81 | 81 |
| 82 // Calls OnPushQueue. |
82 work_queue->Push(FakeTaskWithEnqueueOrder(10)); | 83 work_queue->Push(FakeTaskWithEnqueueOrder(10)); |
83 work_queue_sets_->OnPushQueue(work_queue); | |
84 | 84 |
85 EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); | 85 EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); |
86 EXPECT_EQ(work_queue, selected_work_queue); | 86 EXPECT_EQ(work_queue, selected_work_queue); |
87 } | 87 } |
88 | 88 |
89 TEST_F(WorkQueueSetsTest, GetOldestQueueInSet_SingleTaskInSet) { | 89 TEST_F(WorkQueueSetsTest, GetOldestQueueInSet_SingleTaskInSet) { |
90 WorkQueue* work_queue = NewTaskQueue("queue"); | 90 WorkQueue* work_queue = NewTaskQueue("queue"); |
91 work_queue->Push(FakeTaskWithEnqueueOrder(10)); | 91 work_queue->Push(FakeTaskWithEnqueueOrder(10)); |
92 size_t set = 1; | 92 size_t set = 1; |
93 work_queue_sets_->ChangeSetIndex(work_queue, set); | 93 work_queue_sets_->ChangeSetIndex(work_queue, set); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 EXPECT_FALSE(work_queue_sets_->IsSetEmpty(set)); | 252 EXPECT_FALSE(work_queue_sets_->IsSetEmpty(set)); |
253 | 253 |
254 work_queue->PopTaskForTest(); | 254 work_queue->PopTaskForTest(); |
255 work_queue_sets_->OnPopQueue(work_queue); | 255 work_queue_sets_->OnPopQueue(work_queue); |
256 EXPECT_TRUE(work_queue_sets_->IsSetEmpty(set)); | 256 EXPECT_TRUE(work_queue_sets_->IsSetEmpty(set)); |
257 } | 257 } |
258 | 258 |
259 } // namespace internal | 259 } // namespace internal |
260 } // namespace scheduler | 260 } // namespace scheduler |
261 } // namespace blink | 261 } // namespace blink |
OLD | NEW |