#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <memory>
#include <string>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/socket_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest-spi.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
IsError;
IsOk;
namespace net {
namespace {
const char kMsg1[] = …;
const int kLen1 = …;
const char kMsg2[] = …;
const int kLen2 = …;
const char kMsg3[] = …;
const int kLen3 = …;
const char kMsg4[] = …;
const int kLen4 = …;
class ReentrantHelper { … };
class SequencedSocketDataTest : public TestWithTaskEnvironment { … };
SequencedSocketDataTest::SequencedSocketDataTest() = default;
SequencedSocketDataTest::~SequencedSocketDataTest() { … }
void SequencedSocketDataTest::Initialize(base::span<const MockRead> reads,
base::span<const MockWrite> writes) { … }
void SequencedSocketDataTest::AssertSyncReadEquals(const char* data, int len) { … }
void SequencedSocketDataTest::AssertAsyncReadEquals(const char* data, int len) { … }
void SequencedSocketDataTest::AssertReadReturns(int len, int rv) { … }
void SequencedSocketDataTest::AssertReadBufferEquals(const char* data,
int len) { … }
void SequencedSocketDataTest::AssertSyncWriteEquals(const char* data, int len) { … }
void SequencedSocketDataTest::AssertAsyncWriteEquals(const char* data,
int len) { … }
bool SequencedSocketDataTest::IsPaused() const { … }
void SequencedSocketDataTest::Resume() { … }
void SequencedSocketDataTest::RunUntilPaused() { … }
void SequencedSocketDataTest::AssertWriteReturns(const char* data,
int len,
int rv) { … }
void SequencedSocketDataTest::ReentrantReadCallback(const char* data,
int len1,
int len2,
int expected_rv2,
int rv) { … }
void SequencedSocketDataTest::ReentrantAsyncReadCallback(int expected_rv,
int len,
int rv) { … }
void SequencedSocketDataTest::ReentrantWriteCallback(int expected_rv1,
const char* data,
int len,
int expected_rv2,
int rv) { … }
void SequencedSocketDataTest::ReentrantAsyncWriteCallback(
const char* data,
int len,
CompletionOnceCallback callback,
int expected_rv,
int rv) { … }
void SequencedSocketDataTest::FailingCompletionCallback(int rv) { … }
TEST_F(SequencedSocketDataTest, SingleSyncRead) { … }
TEST_F(SequencedSocketDataTest, MultipleSyncReads) { … }
TEST_F(SequencedSocketDataTest, SingleAsyncRead) { … }
TEST_F(SequencedSocketDataTest, MultipleAsyncReads) { … }
TEST_F(SequencedSocketDataTest, MixedReads) { … }
TEST_F(SequencedSocketDataTest, SyncReadFromCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, ManyReentrantReads) { … }
TEST_F(SequencedSocketDataTest, AsyncReadFromCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, SingleSyncReadTooEarly) { … }
TEST_F(SequencedSocketDataTest, SingleSyncReadSmallBuffer) { … }
TEST_F(SequencedSocketDataTest, SingleSyncReadLargeBuffer) { … }
TEST_F(SequencedSocketDataTest, SingleAsyncReadLargeBuffer) { … }
TEST_F(SequencedSocketDataTest, HangingRead) { … }
TEST_F(SequencedSocketDataTest, SingleSyncWriteTooEarly) { … }
TEST_F(SequencedSocketDataTest, SingleSyncWriteTooSmall) { … }
TEST_F(SequencedSocketDataTest, SingleSyncPartialWrite) { … }
TEST_F(SequencedSocketDataTest, SingleSyncWrite) { … }
TEST_F(SequencedSocketDataTest, MultipleSyncWrites) { … }
TEST_F(SequencedSocketDataTest, SingleAsyncWrite) { … }
TEST_F(SequencedSocketDataTest, MultipleAsyncWrites) { … }
TEST_F(SequencedSocketDataTest, MixedWrites) { … }
TEST_F(SequencedSocketDataTest, SyncWriteFromCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, AsyncWriteFromCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, ManyReentrantWrites) { … }
TEST_F(SequencedSocketDataTest, MixedSyncOperations) { … }
TEST_F(SequencedSocketDataTest, MixedAsyncOperations) { … }
TEST_F(SequencedSocketDataTest, InterleavedAsyncOperations) { … }
TEST_F(SequencedSocketDataTest, InterleavedMixedOperations) { … }
TEST_F(SequencedSocketDataTest, AsyncReadFromWriteCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, AsyncWriteFromReadCompletionCallback) { … }
TEST_F(SequencedSocketDataTest, MixedReentrantOperations) { … }
TEST_F(SequencedSocketDataTest, MixedReentrantOperationsThenSynchronousRead) { … }
TEST_F(SequencedSocketDataTest, MixedReentrantOperationsThenSynchronousWrite) { … }
TEST_F(SequencedSocketDataTest, PauseAndResume_PauseRead) { … }
TEST_F(SequencedSocketDataTest, PauseAndResume_WritePauseRead) { … }
TEST_F(SequencedSocketDataTest, PauseAndResume_PauseWrite) { … }
TEST_F(SequencedSocketDataTest, PauseAndResume_ReadPauseWrite) { … }
}
}