| 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> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class WaitableEvent; | 23 class WaitableEvent; |
| 24 | 24 |
| 25 namespace internal { | 25 namespace internal { |
| 26 namespace test { | 26 namespace test { |
| 27 | 27 |
| 28 // A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as | 28 // A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as |
| 29 // expected. Generates a test failure when: | 29 // expected. Generates a test failure when: |
| 30 // - The RunsTasksOnCurrentThread() method of the TaskRunner returns false on a | 30 // - The RunsTasksOnCurrentThread() method of the TaskRunner returns false on a |
| 31 // thread on which a Task is run. | 31 // thread on which a Task is run. |
| 32 // - The TaskRunnerHandles set in the context of the task don't match what's |
| 33 // expected for the tested ExecutionMode. |
| 32 // - The ExecutionMode of the TaskRunner is SEQUENCED or SINGLE_THREADED and | 34 // - The ExecutionMode of the TaskRunner is SEQUENCED or SINGLE_THREADED and |
| 33 // Tasks don't run in posting order. | 35 // Tasks don't run in posting order. |
| 34 // - The ExecutionMode of the TaskRunner is SINGLE_THREADED and Tasks don't | 36 // - The ExecutionMode of the TaskRunner is SINGLE_THREADED and Tasks don't run |
| 35 // run on the same thread. | 37 // on the same thread. |
| 36 // - A Task runs more than once. | 38 // - A Task runs more than once. |
| 37 class TestTaskFactory { | 39 class TestTaskFactory { |
| 38 public: | 40 public: |
| 39 enum class PostNestedTask { | 41 enum class PostNestedTask { |
| 40 YES, | 42 YES, |
| 41 NO, | 43 NO, |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 // Constructs a TestTaskFactory that posts tasks to |task_runner|. | 46 // Constructs a TestTaskFactory that posts tasks to |task_runner|. |
| 45 // |execution_mode| is the ExecutionMode of |task_runner|. | 47 // |execution_mode| is the ExecutionMode of |task_runner|. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ThreadCheckerImpl thread_checker_; | 92 ThreadCheckerImpl thread_checker_; |
| 91 | 93 |
| 92 DISALLOW_COPY_AND_ASSIGN(TestTaskFactory); | 94 DISALLOW_COPY_AND_ASSIGN(TestTaskFactory); |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 } // namespace test | 97 } // namespace test |
| 96 } // namespace internal | 98 } // namespace internal |
| 97 } // namespace base | 99 } // namespace base |
| 98 | 100 |
| 99 #endif // BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ | 101 #endif // BASE_TASK_SCHEDULER_TEST_TASK_FACTORY_H_ |
| OLD | NEW |