// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_TASK_THREAD_POOL_TEST_TASK_FACTORY_H_ #define BASE_TASK_THREAD_POOL_TEST_TASK_FACTORY_H_ #include <stddef.h> #include <unordered_set> #include "base/functional/callback_forward.h" #include "base/memory/ref_counted.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "base/task/task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool/test_utils.h" #include "base/threading/thread_checker_impl.h" namespace base { namespace internal { namespace test { // A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as // expected. Generates a test failure when: // - The RunsTasksInCurrentSequence() method of the SequencedTaskRunner // (kSequenced or kSingleThread modes) returns false on a thread on which a // Task is run. // - The task runner CurrentDefaultHandles set in the context of the task don't // match what's expected for the tested TaskSourceExecutionMode. // - The TaskSourceExecutionMode of the TaskRunner is kSequenced or // kSingleThread and Tasks don't run in posting order. // - The TaskSourceExecutionMode of the TaskRunner is kSingleThread and Tasks // don't run on the same thread. // - A Task runs more than once. class TestTaskFactory { … }; } // namespace test } // namespace internal } // namespace base #endif // BASE_TASK_THREAD_POOL_TEST_TASK_FACTORY_H_