#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "google_apis/gcm/base/socket_stream.h"
#include <stdint.h>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/ip_address.h"
#include "net/base/network_isolation_key.h"
#include "net/log/net_log_source.h"
#include "net/socket/socket_test_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/network_context.h"
#include "services/network/network_service.h"
#include "services/network/public/mojom/proxy_resolving_socket.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
namespace gcm {
namespace {
ReadList;
WriteList;
const char kReadData[] = …;
const int kReadDataSize = …;
const char kReadData2[] = …;
const int kReadData2Size = …;
const char kWriteData[] = …;
const int kWriteDataSize = …;
class GCMSocketStreamTest : public testing::Test { … };
GCMSocketStreamTest::GCMSocketStreamTest()
: … { … }
GCMSocketStreamTest::~GCMSocketStreamTest() { … }
void GCMSocketStreamTest::BuildSocket(const ReadList& read_list,
const WriteList& write_list) { … }
void GCMSocketStreamTest::PumpLoop() { … }
std::string_view GCMSocketStreamTest::DoInputStreamRead(int bytes) { … }
int GCMSocketStreamTest::DoOutputStreamWrite(std::string_view write_src) { … }
int GCMSocketStreamTest::DoOutputStreamWriteWithoutFlush(
std::string_view write_src) { … }
void GCMSocketStreamTest::WaitForData(int msg_size) { … }
void GCMSocketStreamTest::OpenConnection() { … }
void GCMSocketStreamTest::ResetInputStream() { … }
void GCMSocketStreamTest::ResetOutputStream() { … }
TEST_F(GCMSocketStreamTest, ReadDataSync) { … }
TEST_F(GCMSocketStreamTest, ReadPartialDataSync) { … }
TEST_F(GCMSocketStreamTest, ReadAsync) { … }
TEST_F(GCMSocketStreamTest, TwoReadsAtOnce) { … }
TEST_F(GCMSocketStreamTest, TwoReadsAtOnceWithRebuild) { … }
TEST_F(GCMSocketStreamTest, ReadError) { … }
TEST_F(GCMSocketStreamTest, ReadDisconnected) { … }
TEST_F(GCMSocketStreamTest, WriteFull) { … }
TEST_F(GCMSocketStreamTest, WritePartial) { … }
TEST_F(GCMSocketStreamTest, WritePartialWithLengthChecking) { … }
TEST_F(GCMSocketStreamTest, WriteNone) { … }
TEST_F(GCMSocketStreamTest, WriteThenRead) { … }
TEST_F(GCMSocketStreamTest, ReadThenWrite) { … }
TEST_F(GCMSocketStreamTest, WriteError) { … }
TEST_F(GCMSocketStreamTest, WriteDisconnected) { … }
}
}