chromium/base/task/sequenced_task_runner_unittest.cc

// 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.

#include "base/task/sequenced_task_runner.h"

#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/gtest_prod_util.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/sequence_checker_impl.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/null_task_runner.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/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace {

class FlagOnDelete {};

class SequencedTaskRunnerTest : public testing::Test {};

}  // namespace

SequenceBoundUniquePtr;

TEST_F(SequencedTaskRunnerTest, OnTaskRunnerDeleterOnMainThread) {}

TEST_F(SequencedTaskRunnerTest, OnTaskRunnerDeleterTargetStoppedEarly) {}

TEST_F(SequencedTaskRunnerTest, DelayedTaskHandle_RunTask) {}

TEST_F(SequencedTaskRunnerTest, DelayedTaskHandle_CancelTask) {}

TEST_F(SequencedTaskRunnerTest, DelayedTaskHandle_DestroyTask) {}

// Tests that if PostCancelableDelayedTask() fails, the returned handle will be
// invalid.
TEST_F(SequencedTaskRunnerTest, DelayedTaskHandle_PostTaskFailed) {}

namespace {

// Tests for the SequencedTaskRunner::CurrentDefaultHandle machinery.
class SequencedTaskRunnerCurrentDefaultHandleTest : public ::testing::Test {};

}  // namespace

TEST_F(SequencedTaskRunnerCurrentDefaultHandleTest, FromTaskEnvironment) {}

TEST_F(SequencedTaskRunnerCurrentDefaultHandleTest,
       FromThreadPoolSequencedTask) {}

TEST_F(SequencedTaskRunnerCurrentDefaultHandleTest,
       NoHandleFromUnsequencedTask) {}

// Verify that `CurrentDefaultHandle` can be used to set the current default
// `SequencedTaskRunner` to null in a scope that already has a default.
TEST_F(SequencedTaskRunnerCurrentDefaultHandleTest, OverrideWithNull) {}

// Verify that `CurrentDefaultHandle` can be used to set the current default
// `SequencedTaskRunner` to a non-null value in a scope that already has a
// default.
TEST_F(SequencedTaskRunnerCurrentDefaultHandleTest, OverrideWithNonNull) {}

TEST(SequencedTaskRunnerCurrentDefaultHandleTestWithoutTaskEnvironment,
     FromHandleInScope) {}

}  // namespace base