| 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 "content/child/scheduler/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" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace scheduler { |
| 15 | 15 |
| 16 class MockObserver | 16 class MockObserver : public TaskQueueSelector::Observer { |
| 17 : public TaskQueueSelector::Observer { | |
| 18 public: | 17 public: |
| 19 MockObserver() {} | 18 MockObserver() {} |
| 20 virtual ~MockObserver() {} | 19 virtual ~MockObserver() {} |
| 21 | 20 |
| 22 MOCK_METHOD0(OnTaskQueueEnabled, void()); | 21 MOCK_METHOD0(OnTaskQueueEnabled, void()); |
| 23 | 22 |
| 24 private: | 23 private: |
| 25 DISALLOW_COPY_AND_ASSIGN(MockObserver); | 24 DISALLOW_COPY_AND_ASSIGN(MockObserver); |
| 26 }; | 25 }; |
| 27 | 26 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 238 } |
| 240 selector_.SetQueuePriority(1, | 239 selector_.SetQueuePriority(1, |
| 241 PrioritizingTaskQueueSelector::CONTROL_PRIORITY); | 240 PrioritizingTaskQueueSelector::CONTROL_PRIORITY); |
| 242 for (int i = 0; i < 100; i++) { | 241 for (int i = 0; i < 100; i++) { |
| 243 EXPECT_TRUE(selector_.SelectWorkQueueToService(&chosen_queue_index)); | 242 EXPECT_TRUE(selector_.SelectWorkQueueToService(&chosen_queue_index)); |
| 244 EXPECT_EQ(1ul, chosen_queue_index); | 243 EXPECT_EQ(1ul, chosen_queue_index); |
| 245 // 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. |
| 246 } | 245 } |
| 247 } | 246 } |
| 248 | 247 |
| 249 } // namespace content | 248 } // namespace scheduler |
| OLD | NEW |