chromium/google_apis/gcm/base/socket_stream_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#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() {}

// A read where all data is already available.
TEST_F(GCMSocketStreamTest, ReadDataSync) {}

// A read that comes in two parts.
TEST_F(GCMSocketStreamTest, ReadPartialDataSync) {}

// A read where no data is available at first (IO_PENDING will be returned).
TEST_F(GCMSocketStreamTest, ReadAsync) {}

// Simulate two packets arriving at once. Read them in two separate calls.
TEST_F(GCMSocketStreamTest, TwoReadsAtOnce) {}

// Simulate two packets arriving at once. Read them in two calls separated
// by a Rebuild.
TEST_F(GCMSocketStreamTest, TwoReadsAtOnceWithRebuild) {}

// Simulate a read that is aborted.
TEST_F(GCMSocketStreamTest, ReadError) {}

// Simulate a read after the connection is closed.
TEST_F(GCMSocketStreamTest, ReadDisconnected) {}

// Write a full message in one go.
TEST_F(GCMSocketStreamTest, WriteFull) {}

// Write a message in two go's.
TEST_F(GCMSocketStreamTest, WritePartial) {}

// Regression test for crbug.com/866635.
TEST_F(GCMSocketStreamTest, WritePartialWithLengthChecking) {}

// Write a message completely asynchronously (returns IO_PENDING before
// finishing the write in two go's).
TEST_F(GCMSocketStreamTest, WriteNone) {}

// Write a message then read a message.
TEST_F(GCMSocketStreamTest, WriteThenRead) {}

// Read a message then write a message.
TEST_F(GCMSocketStreamTest, ReadThenWrite) {}

// Simulate a write that gets aborted.
TEST_F(GCMSocketStreamTest, WriteError) {}

// Simulate a write after the connection is closed.
TEST_F(GCMSocketStreamTest, WriteDisconnected) {}

}  // namespace
}  // namespace gcm