| 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 // This file defines tests that implementations of TaskRunner should | 5 // This file defines tests that implementations of TaskRunner should |
| 6 // pass in order to be conformant, as well as test cases for optional behavior. | 6 // pass in order to be conformant, as well as test cases for optional behavior. |
| 7 // Here's how you use it to test your implementation. | 7 // Here's how you use it to test your implementation. |
| 8 // | 8 // |
| 9 // Say your class is called MyTaskRunner. Then you need to define a | 9 // Say your class is called MyTaskRunner. Then you need to define a |
| 10 // class called MyTaskRunnerTestDelegate in my_task_runner_unittest.cc | 10 // class called MyTaskRunnerTestDelegate in my_task_runner_unittest.cc |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // INSTANTIATE_TYPED_TEST_CASE_P( | 50 // INSTANTIATE_TYPED_TEST_CASE_P( |
| 51 // MyTaskRunner, TaskRunnerAffinityTest, MyTaskRunnerTestDelegate); | 51 // MyTaskRunner, TaskRunnerAffinityTest, MyTaskRunnerTestDelegate); |
| 52 | 52 |
| 53 | 53 |
| 54 #ifndef BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ | 54 #ifndef BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ |
| 55 #define BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ | 55 #define BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ |
| 56 | 56 |
| 57 #include <cstddef> | 57 #include <cstddef> |
| 58 #include <map> | 58 #include <map> |
| 59 | 59 |
| 60 #include "base/basictypes.h" | |
| 61 #include "base/bind.h" | 60 #include "base/bind.h" |
| 62 #include "base/callback.h" | 61 #include "base/callback.h" |
| 63 #include "base/location.h" | 62 #include "base/location.h" |
| 63 #include "base/macros.h" |
| 64 #include "base/memory/ref_counted.h" | 64 #include "base/memory/ref_counted.h" |
| 65 #include "base/single_thread_task_runner.h" | 65 #include "base/single_thread_task_runner.h" |
| 66 #include "base/synchronization/condition_variable.h" | 66 #include "base/synchronization/condition_variable.h" |
| 67 #include "base/synchronization/lock.h" | 67 #include "base/synchronization/lock.h" |
| 68 #include "base/task_runner.h" | 68 #include "base/task_runner.h" |
| 69 #include "base/threading/thread.h" | 69 #include "base/threading/thread.h" |
| 70 #include "base/tracked_objects.h" | 70 #include "base/tracked_objects.h" |
| 71 #include "testing/gtest/include/gtest/gtest.h" | 71 #include "testing/gtest/include/gtest/gtest.h" |
| 72 | 72 |
| 73 namespace base { | 73 namespace base { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 this->task_tracker_->GetTaskRunCounts()); | 225 this->task_tracker_->GetTaskRunCounts()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // TaskRunnerAffinityTest tests that the TaskRunner implementation | 228 // TaskRunnerAffinityTest tests that the TaskRunner implementation |
| 229 // can determine if tasks will never be run on a specific thread. | 229 // can determine if tasks will never be run on a specific thread. |
| 230 REGISTER_TYPED_TEST_CASE_P(TaskRunnerAffinityTest, RunsTasksOnCurrentThread); | 230 REGISTER_TYPED_TEST_CASE_P(TaskRunnerAffinityTest, RunsTasksOnCurrentThread); |
| 231 | 231 |
| 232 } // namespace base | 232 } // namespace base |
| 233 | 233 |
| 234 #endif // BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ | 234 #endif // BASE_TEST_TASK_RUNNER_TEST_TEMPLATE_H_ |
| OLD | NEW |