| 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/sequence.h" | 5 #include "base/task_scheduler/sequence.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 // Tasks to be handed off to a Sequence for testing. | 57 // Tasks to be handed off to a Sequence for testing. |
| 58 std::unique_ptr<Task> task_a_owned_; | 58 std::unique_ptr<Task> task_a_owned_; |
| 59 std::unique_ptr<Task> task_b_owned_; | 59 std::unique_ptr<Task> task_b_owned_; |
| 60 std::unique_ptr<Task> task_c_owned_; | 60 std::unique_ptr<Task> task_c_owned_; |
| 61 std::unique_ptr<Task> task_d_owned_; | 61 std::unique_ptr<Task> task_d_owned_; |
| 62 std::unique_ptr<Task> task_e_owned_; | 62 std::unique_ptr<Task> task_e_owned_; |
| 63 | 63 |
| 64 // Raw pointers to those same tasks for verification. This is needed because | 64 // Raw pointers to those same tasks for verification. This is needed because |
| 65 // the scoped_ptrs above no longer point to the tasks once they have been | 65 // the unique_ptrs above no longer point to the tasks once they have been |
| 66 // moved into a Sequence. | 66 // moved into a Sequence. |
| 67 const Task* task_a_; | 67 const Task* task_a_; |
| 68 const Task* task_b_; | 68 const Task* task_b_; |
| 69 const Task* task_c_; | 69 const Task* task_c_; |
| 70 const Task* task_d_; | 70 const Task* task_d_; |
| 71 const Task* task_e_; | 71 const Task* task_e_; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerSequenceTest); | 74 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerSequenceTest); |
| 75 }; | 75 }; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Verify that a DCHECK fires if TakeTask() is called on an empty sequence. | 219 // Verify that a DCHECK fires if TakeTask() is called on an empty sequence. |
| 220 TEST_F(TaskSchedulerSequenceTest, TakeEmptySequence) { | 220 TEST_F(TaskSchedulerSequenceTest, TakeEmptySequence) { |
| 221 scoped_refptr<Sequence> sequence(new Sequence); | 221 scoped_refptr<Sequence> sequence(new Sequence); |
| 222 EXPECT_DCHECK_DEATH({ sequence->TakeTask(); }); | 222 EXPECT_DCHECK_DEATH({ sequence->TakeTask(); }); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace internal | 225 } // namespace internal |
| 226 } // namespace base | 226 } // namespace base |
| OLD | NEW |