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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 Closure(), | 37 Closure(), |
38 TaskTraits().WithPriority(TaskPriority::BACKGROUND))), | 38 TaskTraits().WithPriority(TaskPriority::BACKGROUND))), |
39 task_a_(task_a_owned_.get()), | 39 task_a_(task_a_owned_.get()), |
40 task_b_(task_b_owned_.get()), | 40 task_b_(task_b_owned_.get()), |
41 task_c_(task_c_owned_.get()), | 41 task_c_(task_c_owned_.get()), |
42 task_d_(task_d_owned_.get()), | 42 task_d_(task_d_owned_.get()), |
43 task_e_(task_e_owned_.get()) {} | 43 task_e_(task_e_owned_.get()) {} |
44 | 44 |
45 protected: | 45 protected: |
46 // Tasks to be handed off to a Sequence for testing. | 46 // Tasks to be handed off to a Sequence for testing. |
47 scoped_ptr<Task> task_a_owned_; | 47 std::unique_ptr<Task> task_a_owned_; |
48 scoped_ptr<Task> task_b_owned_; | 48 std::unique_ptr<Task> task_b_owned_; |
49 scoped_ptr<Task> task_c_owned_; | 49 std::unique_ptr<Task> task_c_owned_; |
50 scoped_ptr<Task> task_d_owned_; | 50 std::unique_ptr<Task> task_d_owned_; |
51 scoped_ptr<Task> task_e_owned_; | 51 std::unique_ptr<Task> task_e_owned_; |
52 | 52 |
53 // Raw pointers to those same tasks for verification. This is needed because | 53 // Raw pointers to those same tasks for verification. This is needed because |
54 // the scoped_ptrs above no longer point to the tasks once they have been | 54 // the scoped_ptrs above no longer point to the tasks once they have been |
55 // moved into a Sequence. | 55 // moved into a Sequence. |
56 const Task* task_a_; | 56 const Task* task_a_; |
57 const Task* task_b_; | 57 const Task* task_b_; |
58 const Task* task_c_; | 58 const Task* task_c_; |
59 const Task* task_d_; | 59 const Task* task_d_; |
60 const Task* task_e_; | 60 const Task* task_e_; |
61 | 61 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Pop task D. The highest priority is now from task E (BACKGROUND). The | 176 // Pop task D. The highest priority is now from task E (BACKGROUND). The |
177 // task in front of the sequence is now task E. | 177 // task in front of the sequence is now task E. |
178 sequence->PopTask(); | 178 sequence->PopTask(); |
179 ExpectSortKey(TaskPriority::BACKGROUND, task_e_->sequenced_time, | 179 ExpectSortKey(TaskPriority::BACKGROUND, task_e_->sequenced_time, |
180 sequence->GetSortKey()); | 180 sequence->GetSortKey()); |
181 } | 181 } |
182 | 182 |
183 } // namespace internal | 183 } // namespace internal |
184 } // namespace base | 184 } // namespace base |
OLD | NEW |