OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // SequencedTaskRunnerTest defines tests that implementations of | 5 // SequencedTaskRunnerTest defines tests that implementations of |
6 // SequencedTaskRunner should pass in order to be conformant. | 6 // SequencedTaskRunner should pass in order to be conformant. |
7 // See task_runner_test_template.h for a description of how to use the | 7 // See task_runner_test_template.h for a description of how to use the |
8 // constructs in this file; these work the same. | 8 // constructs in this file; these work the same. |
9 | 9 |
10 #ifndef BASE_TEST_SEQUENCED_TASK_RUNNER_TEST_TEMPLATE_H_ | 10 #ifndef BASE_TEST_SEQUENCED_TASK_RUNNER_TEST_TEMPLATE_H_ |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 const int kChildrenPerParent = 10; | 204 const int kChildrenPerParent = 10; |
205 | 205 |
206 this->delegate_.StartTaskRunner(); | 206 this->delegate_.StartTaskRunner(); |
207 const scoped_refptr<SequencedTaskRunner> task_runner = | 207 const scoped_refptr<SequencedTaskRunner> task_runner = |
208 this->delegate_.GetTaskRunner(); | 208 this->delegate_.GetTaskRunner(); |
209 | 209 |
210 for (int i = 0; i < kParentCount; ++i) { | 210 for (int i = 0; i < kParentCount; ++i) { |
211 Closure task = Bind( | 211 Closure task = Bind( |
212 &internal::SequencedTaskTracker::PostNonNestableTasks, | 212 &internal::SequencedTaskTracker::PostNonNestableTasks, |
213 this->task_tracker_, | 213 this->task_tracker_, |
214 task_runner, | 214 RetainedRef(task_runner), |
215 kChildrenPerParent); | 215 kChildrenPerParent); |
216 this->task_tracker_->PostWrappedNonNestableTask(task_runner.get(), task); | 216 this->task_tracker_->PostWrappedNonNestableTask(task_runner.get(), task); |
217 } | 217 } |
218 | 218 |
219 this->delegate_.StopTaskRunner(); | 219 this->delegate_.StopTaskRunner(); |
220 | 220 |
221 EXPECT_TRUE(CheckNonNestableInvariants( | 221 EXPECT_TRUE(CheckNonNestableInvariants( |
222 this->task_tracker_->GetTaskEvents(), | 222 this->task_tracker_->GetTaskEvents(), |
223 kParentCount * (kChildrenPerParent + 1))); | 223 kParentCount * (kChildrenPerParent + 1))); |
224 } | 224 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 341 } |
342 | 342 |
343 // SequencedTaskRunnerDelayedTest tests that the |delay| parameter of | 343 // SequencedTaskRunnerDelayedTest tests that the |delay| parameter of |
344 // is used to actually wait for |delay| ms before executing the task. | 344 // is used to actually wait for |delay| ms before executing the task. |
345 // This is not mandatory for a SequencedTaskRunner to be compliant. | 345 // This is not mandatory for a SequencedTaskRunner to be compliant. |
346 REGISTER_TYPED_TEST_CASE_P(SequencedTaskRunnerDelayedTest, DelayedTaskBasic); | 346 REGISTER_TYPED_TEST_CASE_P(SequencedTaskRunnerDelayedTest, DelayedTaskBasic); |
347 | 347 |
348 } // namespace base | 348 } // namespace base |
349 | 349 |
350 #endif // BASE_TEST_SEQUENCED_TASK_RUNNER_TEST_TEMPLATE_H_ | 350 #endif // BASE_TEST_SEQUENCED_TASK_RUNNER_TEST_TEMPLATE_H_ |
OLD | NEW |