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 #ifndef BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ |
6 #define BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ | 6 #define BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <unordered_set> | 10 #include <unordered_set> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/synchronization/condition_variable.h" | 14 #include "base/synchronization/condition_variable.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "base/task_scheduler/task_traits.h" | 17 #include "base/task_scheduler/task_traits.h" |
18 #include "base/threading/thread_checker_impl.h" | 18 #include "base/threading/thread_checker_impl.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 | 21 |
22 class WaitableEvent; | 22 class WaitableEvent; |
23 | 23 |
24 namespace internal { | 24 namespace internal { |
25 namespace test { | 25 namespace test { |
26 | 26 |
27 // A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as | 27 // A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as |
28 // expected. Generates a test failure when: | 28 // expected. Generates a test failure when: |
29 // - The TaskRunnerHandles set in the context of the task don't match what's | |
30 // - expected for the tested ExecutionMode. | |
fdoray
2016/04/28 14:37:52
no hyphen on this line
gab
2016/04/28 15:43:23
Done.
| |
29 // - The ExecutionMode of the TaskRunner is SEQUENCED or SINGLE_THREADED and | 31 // - The ExecutionMode of the TaskRunner is SEQUENCED or SINGLE_THREADED and |
30 // Tasks don't run in posting order. | 32 // Tasks don't run in posting order. |
31 // - The ExecutionMode of the TaskRunner is SINGLE_THREADED and Tasks don't | 33 // - The ExecutionMode of the TaskRunner is SINGLE_THREADED and Tasks don't |
32 // run on the same thread. | 34 // run on the same thread. |
33 // - A Task runs more than once. | 35 // - A Task runs more than once. |
34 class TestTaskFactory { | 36 class TestTaskFactory { |
35 public: | 37 public: |
36 enum class PostNestedTask { | 38 enum class PostNestedTask { |
37 YES, | 39 YES, |
38 NO, | 40 NO, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 ThreadCheckerImpl thread_checker_; | 86 ThreadCheckerImpl thread_checker_; |
85 | 87 |
86 DISALLOW_COPY_AND_ASSIGN(TestTaskFactory); | 88 DISALLOW_COPY_AND_ASSIGN(TestTaskFactory); |
87 }; | 89 }; |
88 | 90 |
89 } // namespace test | 91 } // namespace test |
90 } // namespace internal | 92 } // namespace internal |
91 } // namespace base | 93 } // namespace base |
92 | 94 |
93 #endif // BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ | 95 #endif // BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ |
OLD | NEW |