#include "base/threading/thread_checker.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_token.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/simple_thread.h"
#include "base/threading/thread_local.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base::internal {
namespace {
class RunCallbackThread : public SimpleThread { … };
void RunCallbackOnNewThreadSynchronously(OnceClosure callback) { … }
void ExpectCalledOnValidThread(ThreadCheckerImpl* thread_checker) { … }
void ExpectNotCalledOnValidThread(ThreadCheckerImpl* thread_checker) { … }
void ExpectNotCalledOnValidThreadWithSequenceTokenThreadBound(
ThreadCheckerImpl* thread_checker,
SequenceToken sequence_token) { … }
}
TEST(ThreadCheckerTest, AllowedSameThreadNoSequenceToken) { … }
TEST(ThreadCheckerTest, AllowedSameThreadAndSequenceDifferentThreadBoundTasks) { … }
TEST(ThreadCheckerTest, AllowedSameThreadSequenceAndTaskNotThreadBound) { … }
TEST(ThreadCheckerTest,
DisallowedSameThreadAndSequenceDifferentTasksNotThreadBound) { … }
TEST(ThreadCheckerTest, DisallowedDifferentThreadsNoSequenceToken) { … }
TEST(ThreadCheckerTest, DisallowedDifferentThreadsSameSequence) { … }
TEST(ThreadCheckerTest, DisallowedSameThreadDifferentSequence) { … }
TEST(ThreadCheckerTest, DetachFromThread) { … }
TEST(ThreadCheckerTest, DetachFromThreadWithSequenceToken) { … }
class ThreadCheckerOwner { … };
TEST(ThreadCheckerTest, CalledOnValidThreadFromThreadDestruction) { … }
TEST(ThreadCheckerTest, CalledOnValidThreadFromThreadDestructionDetached) { … }
TEST(ThreadCheckerTest, Move) { … }
TEST(ThreadCheckerTest, MoveAssignIntoDetached) { … }
TEST(ThreadCheckerTest, MoveFromDetachedRebinds) { … }
TEST(ThreadCheckerTest, MoveOffThreadBanned) { … }
namespace {
class ThreadCheckerMacroTest : public testing::Test { … };
}
TEST_F(ThreadCheckerMacroTest, Macros) { … }
}