chromium/base/task/sequence_manager/sequence_manager_impl_unittest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/task/sequence_manager/sequence_manager_impl.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>

#include "base/auto_reset.h"
#include "base/cancelable_callback.h"
#include "base/debug/stack_trace.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/message_loop/message_pump_default.h"
#include "base/message_loop/message_pump_type.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/sequence_checker_impl.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/current_thread.h"
#include "base/task/sequence_manager/sequence_manager.h"
#include "base/task/sequence_manager/task_queue.h"
#include "base/task/sequence_manager/task_queue_impl.h"
#include "base/task/sequence_manager/task_queue_selector.h"
#include "base/task/sequence_manager/tasks.h"
#include "base/task/sequence_manager/test/mock_time_domain.h"
#include "base/task/sequence_manager/test/mock_time_message_pump.h"
#include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "base/task/sequence_manager/test/test_task_time_observer.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/task/sequence_manager/work_queue.h"
#include "base/task/sequence_manager/work_queue_sets.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_features.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/null_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "base/threading/sequence_local_storage_slot.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "base/trace_event/base_tracing.h"
#include "base/tracing_buildflags.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"

#if BUILDFLAG(ENABLE_BASE_TRACING)
#include <optional>

#include "base/test/trace_event_analyzer.h"
#endif  // BUILDFLAG(ENABLE_BASE_TRACING)

EnqueueOrder;
_;
AnyNumber;
Contains;
ElementsAre;
ElementsAreArray;
HasSubstr;
Mock;
Not;
Return;
StrictMock;
UnorderedElementsAre;

namespace base {
namespace sequence_manager {
namespace internal {

namespace {

enum class RunnerType {};

enum class WakeUpType {};

// Expresses whether metrics subsampling in ThreadController should always or
// never sample which affects the count of calls to Now().
enum class MetricsSampling {};

enum class TestQueuePriority : TaskQueue::QueuePriority {};

std::string ToString(RunnerType type) {}

std::string ToString(WakeUpType type) {}

std::string ToString(MetricsSampling sampling) {}

std::string GetTestNameSuffix(
    const testing::TestParamInfo<
        std::tuple<RunnerType, WakeUpType, MetricsSampling>>& info) {}

TaskQueueImpl* GetTaskQueueImpl(TaskQueue* task_queue) {}

constexpr TimeDelta kLeeway =;

MockTask;

// This class abstracts the details of how the SequenceManager runs tasks.
// Subclasses will use a MockTaskRunner, a MessageLoop or a MockMessagePump. We
// can then have common tests for all the scenarios by just using this
// interface.
class Fixture {};

class CallCountingTickClock : public TickClock {};

class FixtureWithMockTaskRunner final : public Fixture {};

class FixtureWithMockMessagePump : public Fixture {};

// Convenience wrapper around the fixtures so that we can use parametrized tests
// instead of templated ones. The latter would be more verbose as all method
// calls to the fixture would need to be like this->method()
class SequenceManagerTest
    : public testing::TestWithParam<
          std::tuple<RunnerType, WakeUpType, MetricsSampling>>,
      public Fixture {};

auto GetTestTypes() {}

INSTANTIATE_TEST_SUITE_P();

void PostFromNestedRunloop(scoped_refptr<SingleThreadTaskRunner> runner,
                           std::vector<std::pair<OnceClosure, bool>>* tasks) {}

void NopTask() {}

class TestCountUsesTimeSource : public TickClock {};

class QueueTimeTaskObserver : public TaskObserver {};

}  // namespace

TEST_P(SequenceManagerTest, GetCorrectTaskRunnerForCurrentTask) {}

TEST_P(SequenceManagerTest, NowNotCalledIfUnneeded) {}

TEST_P(SequenceManagerTest,
       NowCalledMinimumNumberOfTimesToComputeTaskDurations) {}

TEST_P(SequenceManagerTest,
       NowCalledMinimumNumberOfTimesToComputeTaskDurationsDelayedFenceAllowed) {}

void NullTask() {}

void TestTask(uint64_t value, std::vector<EnqueueOrder>* out_result) {}

void DisableQueueTestTask(uint64_t value,
                          std::vector<EnqueueOrder>* out_result,
                          TaskQueue::QueueEnabledVoter* voter) {}

TEST_P(SequenceManagerTest, SingleQueuePosting) {}

TEST_P(SequenceManagerTest, MultiQueuePosting) {}

TEST_P(SequenceManagerTest, NonNestableTaskPosting) {}

TEST_P(SequenceManagerTest, NonNestableTaskExecutesInExpectedOrder) {}

TEST_P(SequenceManagerTest, NonNestableTasksDoesntExecuteInNestedLoop) {}

TEST_P(SequenceManagerTest, NonNestableTasksShutdownQueue) {}

TEST_P(SequenceManagerTest, NonNestableTaskQueueTimeShiftsToEndOfNestedLoop) {}

namespace {

void InsertFenceAndPostTestTask(int id,
                                std::vector<EnqueueOrder>* run_order,
                                TaskQueue* task_queue,
                                SequenceManagerForTest* manager) {}

}  // namespace

TEST_P(SequenceManagerTest, TaskQueueDisabledFromNestedLoop) {}

TEST_P(SequenceManagerTest,
       HasTaskToRunImmediatelyOrReadyDelayedTask_ImmediateTask) {}

TEST_P(SequenceManagerTest,
       HasTaskToRunImmediatelyOrReadyDelayedTask_DelayedTask) {}

TEST_P(SequenceManagerTest, DelayedTaskPosting) {}

TEST_P(SequenceManagerTest, DelayedTaskAtPosting) {}

TEST_P(SequenceManagerTest, DelayedTaskAtPosting_FlexiblePreferEarly) {}

TEST_P(SequenceManagerTest, DelayedTaskAtPosting_MixedDelayPolicy) {}

TEST_P(SequenceManagerTest, DelayedTaskAtPosting_Immediate) {}

TEST(SequenceManagerTestWithMockTaskRunner,
     DelayedTaskExecutedInOneMessageLoopTask) {}

TEST_P(SequenceManagerTest, DelayedTaskPosting_MultipleTasks_DecendingOrder) {}

TEST_P(SequenceManagerTest,
       DelayedTaskAtPosting_MultipleTasks_DescendingOrder) {}

TEST_P(SequenceManagerTest, DelayedTaskPosting_MultipleTasks_AscendingOrder) {}

TEST_P(SequenceManagerTest, DelayedTaskAtPosting_MultipleTasks_AscendingOrder) {}

TEST(SequenceManagerTestWithMockTaskRunner,
     PostDelayedTask_SharesUnderlyingDelayedTasks) {}

TEST(SequenceManagerTestWithMockTaskRunner,
     CrossThreadTaskPostingToDisabledQueueDoesntScheduleWork) {}

TEST(SequenceManagerTestWithMockTaskRunner,
     CrossThreadTaskPostingToBlockedQueueDoesntScheduleWork) {}

namespace {

class TestObject {};

int TestObject::destructor_count__ =;

}  // namespace

TEST_P(SequenceManagerTest, PendingDelayedTasksRemovedOnShutdown) {}

TEST_P(SequenceManagerTest, InsertAndRemoveFence) {}

TEST_P(SequenceManagerTest, RemovingFenceForDisabledQueueDoesNotPostDoWork) {}

TEST_P(SequenceManagerTest, EnablingFencedQueueDoesNotPostDoWork) {}

TEST_P(SequenceManagerTest, DenyRunning_BeforePosting) {}

TEST_P(SequenceManagerTest, DenyRunning_AfterPosting) {}

TEST_P(SequenceManagerTest, DenyRunning_AfterRemovingFence) {}

TEST_P(SequenceManagerTest, RemovingFenceWithDelayedTask) {}

TEST_P(SequenceManagerTest, RemovingFenceWithMultipleDelayedTasks) {}

TEST_P(SequenceManagerTest, InsertFencePreventsDelayedTasksFromRunning) {}

TEST_P(SequenceManagerTest, MultipleFences) {}

TEST_P(SequenceManagerTest, InsertFenceThenImmediatlyRemoveDoesNotBlock) {}

TEST_P(SequenceManagerTest, InsertFencePostThenRemoveDoesNotBlock) {}

TEST_P(SequenceManagerTest, MultipleFencesWithInitiallyEmptyQueue) {}

TEST_P(SequenceManagerTest, BlockedByFence) {}

TEST_P(SequenceManagerTest, BlockedByFence_BothTypesOfFence) {}

namespace {

void RecordTimeTask(std::vector<TimeTicks>* run_times, const TickClock* clock) {}

void RecordTimeAndQueueTask(
    std::vector<std::pair<TaskQueue*, TimeTicks>>* run_times,
    TaskQueue* task_queue,
    const TickClock* clock) {}

}  // namespace

TEST_P(SequenceManagerTest, DelayedFence_DelayedTasks) {}

TEST_P(SequenceManagerTest, DelayedFence_ImmediateTasks) {}

TEST_P(SequenceManagerTest, DelayedFence_RemovedFenceDoesNotActivate) {}

TEST_P(SequenceManagerTest, DelayedFence_TakeIncomingImmediateQueue) {}

namespace {

void ReentrantTestTask(TaskQueue* runner,
                       int countdown,
                       std::vector<EnqueueOrder>* out_result) {}

}  // namespace

TEST_P(SequenceManagerTest, ReentrantPosting) {}

namespace {

class RefCountedCallbackFactory {};

}  // namespace

TEST_P(SequenceManagerTest, NoTasksAfterShutdown) {}

void PostTaskToRunner(TaskQueue* runner, std::vector<EnqueueOrder>* run_order) {}

TEST_P(SequenceManagerTest, PostFromThread) {}

void RePostingTestTask(TaskQueue* runner, int* run_count) {}

TEST_P(SequenceManagerTest, DoWorkCantPostItselfMultipleTimes) {}

TEST_P(SequenceManagerTest, PostFromNestedRunloop) {}

TEST_P(SequenceManagerTest, WorkBatching) {}

namespace {

class MockTaskObserver : public TaskObserver {};

}  // namespace

TEST_P(SequenceManagerTest, TaskObserverAdding) {}

TEST_P(SequenceManagerTest, TaskObserverRemoving) {}

void RemoveObserverTask(SequenceManagerImpl* manager, TaskObserver* observer) {}

TEST_P(SequenceManagerTest, TaskObserverRemovingInsideTask) {}

TEST_P(SequenceManagerTest, QueueTaskObserverAdding) {}

TEST_P(SequenceManagerTest, QueueTaskObserverRemoving) {}

void RemoveQueueObserverTask(TaskQueue* queue, TaskObserver* observer) {}

TEST_P(SequenceManagerTest, QueueTaskObserverRemovingInsideTask) {}

TEST_P(SequenceManagerTest, CancelHandleInsideTaskObserver) {}

TEST_P(SequenceManagerTest, ThreadCheckAfterTermination) {}

TEST_P(SequenceManagerTest, GetNextDelayedWakeUp) {}

TEST_P(SequenceManagerTest, GetNextDelayedWakeUp_MultipleQueues) {}

TEST(SequenceManagerWithTaskRunnerTest, DeleteSequenceManagerInsideATask) {}

TEST_P(SequenceManagerTest, GetAndClearSystemIsQuiescentBit) {}

TEST_P(SequenceManagerTest, HasTaskToRunImmediatelyOrReadyDelayedTask) {}

TEST_P(SequenceManagerTest,
       HasTaskToRunImmediatelyOrReadyDelayedTask_DelayedTasks) {}

TEST_P(SequenceManagerTest, ImmediateTasksAreNotStarvedByDelayedTasks) {}

TEST_P(SequenceManagerTest,
       DelayedTaskDoesNotSkipAHeadOfNonDelayedTask_SameQueue) {}

TEST_P(SequenceManagerTest,
       DelayedTaskDoesNotSkipAHeadOfNonDelayedTask_DifferentQueues) {}

TEST_P(SequenceManagerTest, DelayedTaskDoesNotSkipAHeadOfShorterDelayedTask) {}

namespace {

void CheckIsNested(bool* is_nested) {}

void PostAndQuitFromNestedRunloop(RunLoop* run_loop,
                                  TaskQueue* runner,
                                  bool* was_nested) {}

}  // namespace

TEST_P(SequenceManagerTest, QuitWhileNested) {}

namespace {

class SequenceNumberCapturingTaskObserver : public TaskObserver {};

}  // namespace

TEST_P(SequenceManagerTest, SequenceNumSetWhenTaskIsPosted) {}

TEST_P(SequenceManagerTest, NewTaskQueues) {}

TEST_P(SequenceManagerTest, ShutdownTaskQueue_TaskRunnersDetaching) {}

TEST_P(SequenceManagerTest, ShutdownTaskQueue) {}

TEST_P(SequenceManagerTest, ShutdownTaskQueue_WithDelayedTasks) {}

namespace {
void ShutdownQueue(TaskQueue::Handle queue) {}
}  // namespace

TEST_P(SequenceManagerTest, ShutdownTaskQueue_InTasks) {}

namespace {

class MockObserver : public SequenceManager::Observer {};

}  // namespace

TEST_P(SequenceManagerTest, ShutdownTaskQueueInNestedLoop) {}

TEST_P(SequenceManagerTest, TimeDomainMigrationWithIncomingImmediateTasks) {}

// Test that no wake up is scheduled for a delayed task in the future when a
// time domain is present.
TEST_P(SequenceManagerTest, TimeDomainDoesNotCauseWakeUp) {}

TEST_P(SequenceManagerTest,
       PostDelayedTasksReverseOrderAlternatingTimeDomains) {}

namespace {

class MockTaskQueueThrottler : public TaskQueue::Throttler {};

}  // namespace

TEST_P(SequenceManagerTest, TaskQueueThrottler_ImmediateTask) {}

TEST_P(SequenceManagerTest, TaskQueueThrottler_DelayedTask) {}

TEST_P(SequenceManagerTest, TaskQueueThrottler_OnWakeUp) {}

TEST_P(SequenceManagerTest, TaskQueueThrottler_ResetThrottler) {}

TEST_P(SequenceManagerTest, TaskQueueThrottler_DelayedTaskMultipleQueues) {}

TEST_P(SequenceManagerTest, TaskQueueThrottler_DelayedWorkWhichCanRunNow) {}

namespace {

class CancelableTask {};

class DestructionCallback {};

}  // namespace

TEST_P(SequenceManagerTest, TaskQueueThrottler_SweepCanceledDelayedTasks) {}

TEST_P(SequenceManagerTest, SweepLastTaskInQueue) {}

TEST_P(SequenceManagerTest, CancelledTaskPostAnother_ReclaimMemory) {}

// Regression test to ensure that posting a new task from the destructor of a
// canceled task doesn't crash.
TEST_P(SequenceManagerTest,
       CancelledTaskPostAnother_MoveReadyDelayedTasksToWorkQueues) {}

TEST_P(SequenceManagerTest,
       CancelledTaskPostAnother_RemoveAllCanceledDelayedTasksFromFront) {}

TEST_P(SequenceManagerTest, CancelledImmediateTaskShutsDownQueue) {}

TEST_P(SequenceManagerTest, CancelledDelayedTaskShutsDownQueue) {}

namespace {

void ChromiumRunloopInspectionTask(
    scoped_refptr<TestMockTimeTaskRunner> test_task_runner) {}

}  // namespace

TEST(SequenceManagerTestWithMockTaskRunner,
     NumberOfPendingTasksOnChromiumRunLoop) {}

namespace {

class QuadraticTask {};

class LinearTask {};

bool ShouldExit(QuadraticTask* quadratic_task, LinearTask* linear_task) {}

}  // namespace

TEST_P(SequenceManagerTest,
       DelayedTasksDontBadlyStarveNonDelayedWork_SameQueue) {}

TEST_P(SequenceManagerTest, ImmediateWorkCanStarveDelayedTasks_SameQueue) {}

TEST_P(SequenceManagerTest,
       DelayedTasksDontBadlyStarveNonDelayedWork_DifferentQueue) {}

TEST_P(SequenceManagerTest, ImmediateWorkCanStarveDelayedTasks_DifferentQueue) {}

TEST_P(SequenceManagerTest, CurrentlyExecutingTaskQueue_NoTaskRunning) {}

namespace {
void CurrentlyExecutingTaskQueueTestTask(
    SequenceManagerImpl* sequence_manager,
    std::vector<internal::TaskQueueImpl*>* task_sources) {}
}  // namespace

TEST_P(SequenceManagerTest, CurrentlyExecutingTaskQueue_TaskRunning) {}

namespace {
void RunloopCurrentlyExecutingTaskQueueTestTask(
    SequenceManagerImpl* sequence_manager,
    std::vector<internal::TaskQueueImpl*>* task_sources,
    std::vector<std::pair<OnceClosure, TaskQueue*>>* tasks) {}
}  // namespace

TEST_P(SequenceManagerTest, CurrentlyExecutingTaskQueue_NestedLoop) {}

TEST_P(SequenceManagerTest, NoWakeUpsForCanceledDelayedTasks) {}

TEST_P(SequenceManagerTest, NoWakeUpsForCanceledDelayedTasksReversePostOrder) {}

TEST_P(SequenceManagerTest, TimeDomainWakeUpOnlyCancelledIfAllUsesCancelled) {}

TEST_P(SequenceManagerTest, SweepCanceledDelayedTasks) {}

TEST_P(SequenceManagerTest, SweepCanceledDelayedTasks_ManyTasks) {}

TEST_P(SequenceManagerTest, DelayedTasksNotSelected) {}

TEST_P(SequenceManagerTest, DelayedTasksNotSelectedWithImmediateTask) {}

TEST_P(SequenceManagerTest,
       DelayedTasksNotSelectedWithImmediateTaskWithPriority) {}

TEST_P(SequenceManagerTest, GetPendingWakeUp) {}

TEST_P(SequenceManagerTest, GetPendingWakeUp_Disabled) {}

TEST_P(SequenceManagerTest, GetPendingWakeUp_Fence) {}

TEST_P(SequenceManagerTest, GetPendingWakeUp_FenceUnblocking) {}

TEST_P(SequenceManagerTest, GetPendingWakeUp_DelayedTaskReady) {}

TEST_P(SequenceManagerTest, RemoveAllCanceledDelayedTasksFromFront) {}

TEST_P(SequenceManagerTest,
       RemoveAllCanceledDelayedTasksFromFront_MultipleQueues) {}

namespace {
void MessageLoopTaskWithDelayedQuit(Fixture* fixture, TaskQueue* task_queue) {}
}  // namespace

TEST_P(SequenceManagerTest, DelayedTaskRunsInNestedMessageLoop) {}

namespace {
void MessageLoopTaskWithImmediateQuit(OnceClosure non_nested_quit_closure,
                                      TaskQueue* task_queue) {}
}  // namespace

TEST_P(SequenceManagerTest, DelayedNestedMessageLoopDoesntPreventTasksRunning) {}

TEST_P(SequenceManagerTest, CouldTaskRun_DisableAndReenable) {}

TEST_P(SequenceManagerTest, CouldTaskRun_Fence) {}

TEST_P(SequenceManagerTest, CouldTaskRun_FenceBeforeThenAfter) {}

TEST_P(SequenceManagerTest, DelayedDoWorkNotPostedForDisabledQueue) {}

TEST_P(SequenceManagerTest, DisablingQueuesChangesDelayTillNextDoWork) {}

TEST_P(SequenceManagerTest, GetNextDesiredWakeUp) {}

TEST_P(SequenceManagerTest, SetTimeDomainForDisabledQueue) {}

namespace {
void SetOnTaskHandlers(TaskQueue* task_queue,
                       int* start_counter,
                       int* complete_counter) {}

void UnsetOnTaskHandlers(TaskQueue* task_queue) {}
}  // namespace

TEST_P(SequenceManagerTest, ProcessTasksWithoutTaskTimeObservers) {}

TEST_P(SequenceManagerTest, ProcessTasksWithTaskTimeObservers) {}

TEST_P(SequenceManagerTest, ObserverNotFiredAfterTaskQueueDestructed) {}

TEST_P(SequenceManagerTest,
       OnQueueNextWakeUpChangedNotFiredForDisabledQueuePostTask) {}

TEST_P(SequenceManagerTest,
       OnQueueNextWakeUpChangedNotFiredForCrossThreadDisabledQueuePostTask) {}

TEST_P(SequenceManagerTest, GracefulShutdown_ManagerDeletedInFlight) {}

TEST_P(SequenceManagerTest, SequenceManagerDeletedWithQueuesToDelete) {}

TEST(SequenceManagerBasicTest, DefaultTaskRunnerSupport) {}

TEST_P(SequenceManagerTest, CanceledTasksInQueueCantMakeOtherTasksSkipAhead) {}

TEST_P(SequenceManagerTest, TaskQueueDeleted) {}

namespace {

class RunOnDestructionHelper {};

base::OnceClosure RunOnDestruction(base::OnceClosure task) {}

base::OnceClosure PostOnDestruction(TaskQueue* task_queue,
                                    base::OnceClosure task) {}

}  // namespace

TEST_P(SequenceManagerTest, TaskQueueUsedInTaskDestructorAfterShutdown) {}

TEST_P(SequenceManagerTest, TaskQueueTaskRunnerDetach) {}

TEST_P(SequenceManagerTest, DestructorPostChainDuringShutdown) {}

TEST_P(SequenceManagerTest, DestructorPostsViaTaskRunnerHandleDuringShutdown) {}

TEST_P(SequenceManagerTest, CreateUnboundSequenceManagerWhichIsNeverBound) {}

TEST_P(SequenceManagerTest, HasPendingHighResolutionTasks) {}

TEST_P(SequenceManagerTest, HasPendingHighResolutionTasksLowPriority) {}

TEST_P(SequenceManagerTest,
       HasPendingHighResolutionTasksLowAndNormalPriorityQueues) {}

namespace {

class PostTaskWhenDeleted;
void CallbackWithDestructor(std::unique_ptr<PostTaskWhenDeleted>);

class PostTaskWhenDeleted {};

void CallbackWithDestructor(std::unique_ptr<PostTaskWhenDeleted> object) {}

}  // namespace

TEST_P(SequenceManagerTest, DoesNotRecordQueueTimeIfSettingFalse) {}

TEST_P(SequenceManagerTest, RecordsQueueTimeIfSettingTrue) {}

namespace {

// Inject a test point for recording the destructor calls for OnceClosure
// objects sent to PostTask(). It is awkward usage since we are trying to hook
// the actual destruction, which is not a common operation.
class DestructionObserverProbe : public RefCounted<DestructionObserverProbe> {};

class SMDestructionObserver : public CurrentThread::DestructionObserver {};

}  // namespace

TEST_P(SequenceManagerTest, DestructionObserverTest) {}

TEST_P(SequenceManagerTest, GetMessagePump) {}

namespace {

class MockTimeDomain : public TimeDomain {};

}  // namespace

TEST_P(SequenceManagerTest, OnIdleTimeDomainNotification) {}

TEST_P(SequenceManagerTest, CreateTaskQueue) {}

TEST_P(SequenceManagerTest, GetPendingTaskCountForTesting) {}

TEST_P(SequenceManagerTest, PostDelayedTaskFromOtherThread) {}

namespace {

void PostTaskA(scoped_refptr<TaskRunner> task_runner) {}

void PostTaskB(scoped_refptr<TaskRunner> task_runner) {}

void PostTaskC(scoped_refptr<TaskRunner> task_runner) {}

}  // namespace

TEST_P(SequenceManagerTest, DescribeAllPendingTasks) {}

TEST_P(SequenceManagerTest, TaskPriortyInterleaving) {}

namespace {

class CancelableTaskWithDestructionObserver {};

}  // namespace

TEST_P(SequenceManagerTest, PeriodicHousekeeping) {}

namespace {

class MockCrashKeyImplementation : public debug::CrashKeyImplementation {};

}  // namespace

TEST_P(SequenceManagerTest, CrossQueueTaskPostingWhenQueueDeleted) {}

TEST_P(SequenceManagerTest, UnregisterTaskQueueTriggersScheduleWork) {}

TEST_P(SequenceManagerTest, ReclaimMemoryRemovesCorrectQueueFromSet) {}

namespace {

class TaskObserverExpectingNoDelayedRunTime : public TaskObserver {};

}  // namespace

// The |delayed_run_time| must not be set for immediate tasks as that prevents
// external observers from correctly identifying delayed tasks.
// https://crbug.com/1029137
TEST_P(SequenceManagerTest, NoDelayedRunTimeForImmediateTask) {}

TEST_P(SequenceManagerTest, TaskObserverBlockedOrLowPriority_QueueDisabled) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_FenceBeginningOfTime) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_PostedBeforeFenceNow) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_PostedAfterFenceNow) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_LowerPriorityWhileQueued) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_LowPriorityWhenQueueing) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_LowPriorityWhenRunning) {}

TEST_P(SequenceManagerTest,
       TaskObserverBlockedOrLowPriority_TaskObserverUnblockedWithBacklog) {}

TEST_P(SequenceManagerTest, TaskObserverBlockedOrLowPriority_Mix) {}

TEST_P(SequenceManagerTest, DelayedTaskOrderFromMultipleQueues) {}

TEST_P(SequenceManagerTest, OnTaskPostedCallbacks) {}

// `RunOrPostTask` is tightly integrated with `ThreadControllerWithMessagePump`
// and `RunLoop` so its tests can't use `SequenceManagerTest`.
class SequenceManagerRunOrPostTaskTest : public testing::Test {};

// Verify that `RunOrPostTask` from the bound thread does not run the task
// synchronously if there is no active `RunLoop`.
TEST_F(SequenceManagerRunOrPostTaskTest, FromBoundThreadOutsideRunLoop) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is no active `RunLoop`.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadOutsideRunLoop) {}

// Verify that `RunOrPostTask` from a task running on the bound thread does not
// run the task synchronously.
TEST_F(SequenceManagerRunOrPostTaskTest, FromInsideTask) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is a queued task.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadWithQueuedTask) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is a queued task in a different queue from the same
// `SequenceManager`.
TEST_F(SequenceManagerRunOrPostTaskTest,
       FromOtherThreadWithQueuedTaskOtherQueue) {}

// Verify that `RunOrPostTask` from another thread runs the task synchronously
// if there is no queued or running task.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadNoQueuedOrRunningTask) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously when "internal work" is simulated.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadInternalWork) {}

// Verify that `RunOrPostTask` from another thread runs the task synchronously
// if there is no running task and the only queued task is in a different queue
// which is disabled.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadDisabledQueue) {}

// Verify that `RunOrPostTask` from another thread runs the task synchronously
// if there is no running task and the only queued task is in a different queue
// which is disabled.
TEST_F(SequenceManagerRunOrPostTaskTest,
       FromOtherThreadQueuedTaskInDisabledOtherQueue) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is a running task.
TEST_F(SequenceManagerRunOrPostTaskTest, FromOtherThreadWithRunningTask) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is a running task blocked in a nested loop.
TEST_F(SequenceManagerRunOrPostTaskTest,
       FromOtherThreadWithRunningTaskInNestedLoop) {}

// Verify that `RunOrPostTask` from another thread does not run the task
// synchronously if there is a running task in a different queue from the same
// `SequenceManager`.
TEST_F(SequenceManagerRunOrPostTaskTest,
       FromOtherThreadWithRunningTaskOtherQueue) {}

// Verify that a task run synchronously inside `RunOrPostTask` prevents another
// task from starting on the bound thread.
TEST_F(SequenceManagerRunOrPostTaskTest,
       MainThreadCantStartTaskDuringRunOrPostTask) {}

// Verify that when `RunOrPostTask` is called concurrently from multiple
// threads, only one can execute its task synchronously.
TEST_F(SequenceManagerRunOrPostTaskTest, ConcurrentCalls) {}

// Verify the behavior of `SequenceCheckerImpl` and `ThreadCheckerImpl` in a
// callback that runs synchronously in `RunOrPostTask` on another thread.
TEST_F(SequenceManagerRunOrPostTaskTest, SequenceAndThreadChecker) {}

// Same as SequenceManagerRunOrPostTaskTest.SequenceAndThreadChecker, but
// `RunOrPostTask()` is invoked from a `ThreadPool` task (i.e. within a
// `TaskScope`).
TEST_F(SequenceManagerRunOrPostTaskTest,
       SequenceAndThreadCheckerFromThreadPool) {}

TEST_F(SequenceManagerRunOrPostTaskTest, CurrentDefaultTaskRunner) {}

TEST(
    SequenceManagerTest,
    CanAccessSingleThreadTaskRunnerCurrentDefaultHandleHandleDuringSequenceLocalStorageSlotDestruction) {}

TEST(SequenceManagerTest, BindOnDifferentThreadWithActiveVoters) {}

}  // namespace internal
}  // namespace sequence_manager
}  // namespace base