chromium/components/sync/engine/cancelation_signal_unittest.cc

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

#include "components/sync/engine/cancelation_signal.h"

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace syncer {

class BlockingTask : public CancelationSignal::Observer {};

BlockingTask::BlockingTask(CancelationSignal* cancel_signal)
    :{}

BlockingTask::~BlockingTask() {}

void BlockingTask::RunAsync(base::WaitableEvent* task_start_signal,
                            base::WaitableEvent* task_done_signal) {}

void BlockingTask::Run(base::WaitableEvent* task_start_signal,
                       base::WaitableEvent* task_done_signal) {}

void BlockingTask::OnCancelationSignalReceived() {}

bool BlockingTask::WasStarted() {}

class CancelationSignalTest : public ::testing::Test {};

CancelationSignalTest::CancelationSignalTest()
    :{}

CancelationSignalTest::~CancelationSignalTest() = default;

void CancelationSignalTest::StartBlockingTaskAsync() {}

void CancelationSignalTest::StartBlockingTaskAndWaitForItToStart() {}

void CancelationSignalTest::CancelBlocking() {}

bool CancelationSignalTest::VerifyTaskNotStarted() {}

class FakeObserver : public CancelationSignal::Observer {};

TEST(CancelationSignalTest_SingleThread, CheckFlags) {}

// Send the cancelation signal before the task is started.  This will ensure
// that the task will never be "started" (ie. TryRegisterHandler() will fail,
// so it will never start blocking on its main WaitableEvent).
TEST_F(CancelationSignalTest, CancelEarly) {}

// Send the cancelation signal after the task has started running.  This tests
// the non-early exit code path, where the task is stopped while it is in
// progress.
TEST_F(CancelationSignalTest, Cancel) {}

}  // namespace syncer