#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) { … }
TEST_F(CancelationSignalTest, CancelEarly) { … }
TEST_F(CancelationSignalTest, Cancel) { … }
}