#include <sys/socket.h>
#include "base/compiler_specific.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump_for_io.h"
#include "base/posix/eintr_wrapper.h"
#include "base/run_loop.h"
#include "base/task/current_thread.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
#include "base/message_loop/message_pump_epoll.h"
#endif
namespace base {
#if !BUILDFLAG(IS_NACL)
namespace {
class FdWatchControllerPosixTest : public testing::Test,
public testing::WithParamInterface<bool> { … };
class TestHandler : public MessagePumpForIO::FdWatcher { … };
class CallClosureHandler : public MessagePumpForIO::FdWatcher { … };
TEST_P(FdWatchControllerPosixTest, FileDescriptorWatcherOutlivesMessageLoop) { … }
TEST_P(FdWatchControllerPosixTest, FileDescriptorWatcherDoubleStop) { … }
TEST_P(FdWatchControllerPosixTest, FileDescriptorWatcherDeleteInCallback) { … }
class ReaderWriterHandler : public MessagePumpForIO::FdWatcher { … };
class MessageLoopForIoPosixReadAndWriteTest
: public testing::TestWithParam<ReaderWriterHandler::Action> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MessageLoopForIoPosixReadAndWriteTest, AfterRead) { … }
TEST_P(MessageLoopForIoPosixReadAndWriteTest, AfterWrite) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FdWatchControllerPosixTest, WatchReadable) { … }
TEST_P(FdWatchControllerPosixTest, WatchReadableTwiceSameWatcher) { … }
TEST_P(FdWatchControllerPosixTest, WatchReadableTwiceDifferentWatcher) { … }
TEST_P(FdWatchControllerPosixTest, WatchWritable) { … }
TEST_P(FdWatchControllerPosixTest, RunUntilIdle) { … }
void StopWatching(MessagePumpForIO::FdWatchController* controller,
RunLoop* run_loop) { … }
TEST_P(FdWatchControllerPosixTest, StopFromHandler) { … }
TEST_P(FdWatchControllerPosixTest, NonPersistentWatcher) { … }
TEST_P(FdWatchControllerPosixTest, PersistentWatcher) { … }
void StopWatchingAndWatchAgain(MessagePumpForIO::FdWatchController* controller,
int fd,
MessagePumpForIO::FdWatcher* new_handler,
RunLoop* run_loop) { … }
TEST_P(FdWatchControllerPosixTest, StopAndRestartFromHandler) { … }
TEST_P(FdWatchControllerPosixTest, IoEventThenTimer) { … }
TEST_P(FdWatchControllerPosixTest, TimerThenIoEvent) { … }
}
#endif
}