OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/task_scheduler/scheduler_worker_stack.h" | 5 #include "base/task_scheduler/scheduler_worker_stack.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/task_scheduler/scheduler_worker.h" | 10 #include "base/task_scheduler/scheduler_worker.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 SchedulerWorker::InitialState::ALIVE); | 60 SchedulerWorker::InitialState::ALIVE); |
61 ASSERT_TRUE(worker_c_); | 61 ASSERT_TRUE(worker_c_); |
62 } | 62 } |
63 | 63 |
64 void TearDown() override { | 64 void TearDown() override { |
65 worker_a_->JoinForTesting(); | 65 worker_a_->JoinForTesting(); |
66 worker_b_->JoinForTesting(); | 66 worker_b_->JoinForTesting(); |
67 worker_c_->JoinForTesting(); | 67 worker_c_->JoinForTesting(); |
68 } | 68 } |
69 | 69 |
70 std::unique_ptr<SchedulerWorker> worker_a_; | 70 scoped_refptr<SchedulerWorker> worker_a_; |
71 std::unique_ptr<SchedulerWorker> worker_b_; | 71 scoped_refptr<SchedulerWorker> worker_b_; |
72 std::unique_ptr<SchedulerWorker> worker_c_; | 72 scoped_refptr<SchedulerWorker> worker_c_; |
73 | 73 |
74 private: | 74 private: |
75 TaskTracker task_tracker_; | 75 TaskTracker task_tracker_; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 // Verify that Push() and Pop() add/remove values in FIFO order. | 80 // Verify that Push() and Pop() add/remove values in FIFO order. |
81 TEST_F(TaskSchedulerWorkerStackTest, PushPop) { | 81 TEST_F(TaskSchedulerWorkerStackTest, PushPop) { |
82 SchedulerWorkerStack stack; | 82 SchedulerWorkerStack stack; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 // Verify that Push() DCHECKs when a value is inserted twice. | 251 // Verify that Push() DCHECKs when a value is inserted twice. |
252 TEST_F(TaskSchedulerWorkerStackTest, PushTwice) { | 252 TEST_F(TaskSchedulerWorkerStackTest, PushTwice) { |
253 SchedulerWorkerStack stack; | 253 SchedulerWorkerStack stack; |
254 stack.Push(worker_a_.get()); | 254 stack.Push(worker_a_.get()); |
255 EXPECT_DCHECK_DEATH({ stack.Push(worker_a_.get()); }); | 255 EXPECT_DCHECK_DEATH({ stack.Push(worker_a_.get()); }); |
256 } | 256 } |
257 | 257 |
258 } // namespace internal | 258 } // namespace internal |
259 } // namespace base | 259 } // namespace base |
OLD | NEW |