#include "base/synchronization/waitable_event_watcher.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
const test::TaskEnvironment::MainThreadType testing_main_threads[] = …;
void QuitWhenSignaled(base::OnceClosure quit_closure, WaitableEvent* event) { … }
class DecrementCountContainer { … };
}
class WaitableEventWatcherTest
: public testing::TestWithParam<test::TaskEnvironment::MainThreadType> { … };
TEST_P(WaitableEventWatcherTest, BasicSignalManual) { … }
TEST_P(WaitableEventWatcherTest, BasicSignalAutomatic) { … }
TEST_P(WaitableEventWatcherTest, BasicCancel) { … }
TEST_P(WaitableEventWatcherTest, CancelAfterSet) { … }
TEST_P(WaitableEventWatcherTest, OutlivesTaskEnvironment) { … }
TEST_P(WaitableEventWatcherTest, SignaledAtStartManual) { … }
TEST_P(WaitableEventWatcherTest, SignaledAtStartAutomatic) { … }
TEST_P(WaitableEventWatcherTest, StartWatchingInCallback) { … }
TEST_P(WaitableEventWatcherTest, MultipleWatchersManual) { … }
TEST_P(WaitableEventWatcherTest, MultipleWatchersAutomatic) { … }
class WaitableEventWatcherDeletionTest
: public testing::TestWithParam<
std::tuple<test::TaskEnvironment::MainThreadType, bool>> { … };
TEST_P(WaitableEventWatcherDeletionTest, DeleteUnder) { … }
TEST_P(WaitableEventWatcherDeletionTest, SignalAndDelete) { … }
TEST_P(WaitableEventWatcherDeletionTest, DeleteWatcherBeforeCallback) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}