#include "base/sync_socket.h"
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
constexpr TimeDelta kReceiveTimeout = …;
class HangingReceiveThread : public DelegateSimpleThread::Delegate { … };
void SendReceivePeek(SyncSocket* socket_a, SyncSocket* socket_b) { … }
}
class SyncSocketTest : public testing::Test { … };
TEST_F(SyncSocketTest, NormalSendReceivePeek) { … }
TEST_F(SyncSocketTest, ClonedSendReceivePeek) { … }
class CancelableSyncSocketTest : public testing::Test { … };
TEST_F(CancelableSyncSocketTest, NormalSendReceivePeek) { … }
TEST_F(CancelableSyncSocketTest, ClonedSendReceivePeek) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_ShutdownCancelsReceive …
#else
#define MAYBE_ShutdownCancelsReceive …
#endif
TEST_F(CancelableSyncSocketTest, MAYBE_ShutdownCancelsReceive) { … }
TEST_F(CancelableSyncSocketTest, ShutdownCancelsReceiveWithTimeout) { … }
TEST_F(CancelableSyncSocketTest, ReceiveAfterShutdown) { … }
TEST_F(CancelableSyncSocketTest, ReceiveWithTimeoutAfterShutdown) { … }
}