chromium/net/quic/quic_proxy_client_socket_unittest.cc

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

#include "net/quic/quic_proxy_client_socket.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/proxy_string_util.h"
#include "net/base/test_proxy_delegate.h"
#include "net/http/http_response_headers.h"
#include "net/log/net_log.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/quic/quic_chromium_client_session.h"
#include "net/quic/quic_http_utils.h"
#include "net/quic/quic_proxy_client_socket_test_base.h"
#include "net/quic/test_quic_crypto_client_config_handle.h"
#include "net/quic/test_task_runner.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/third_party/quiche/src/quiche/common/http/http_header_block.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"

_;
AnyNumber;
Return;

namespace net::test {

class QuicProxyClientSocketTest : public QuicProxyClientSocketTestBase {};

TEST_P(QuicProxyClientSocketTest, ConnectSendsCorrectRequest) {}

TEST_P(QuicProxyClientSocketTest, ProxyDelegateExtraHeaders) {}

TEST_P(QuicProxyClientSocketTest, ConnectWithAuthRequested) {}

TEST_P(QuicProxyClientSocketTest, ConnectWithAuthCredentials) {}

// Tests that a redirect response from a CONNECT fails.
TEST_P(QuicProxyClientSocketTest, ConnectRedirects) {}

TEST_P(QuicProxyClientSocketTest, ConnectFails) {}

TEST_P(QuicProxyClientSocketTest, WasEverUsedReturnsCorrectValue) {}

TEST_P(QuicProxyClientSocketTest, GetPeerAddressReturnsCorrectValues) {}

TEST_P(QuicProxyClientSocketTest, IsConnectedAndIdle) {}

TEST_P(QuicProxyClientSocketTest, GetTotalReceivedBytes) {}

TEST_P(QuicProxyClientSocketTest, SetStreamPriority) {}

TEST_P(QuicProxyClientSocketTest, WriteSendsDataInDataFrame) {}

TEST_P(QuicProxyClientSocketTest, WriteSplitsLargeDataIntoMultiplePackets) {}

// ----------- Read

TEST_P(QuicProxyClientSocketTest, ReadReadsDataInDataFrame) {}

TEST_P(QuicProxyClientSocketTest, ReadDataFromBufferedFrames) {}

TEST_P(QuicProxyClientSocketTest, ReadDataMultipleBufferedFrames) {}

TEST_P(QuicProxyClientSocketTest, LargeReadWillMergeDataFromDifferentFrames) {}

TEST_P(QuicProxyClientSocketTest, MultipleShortReadsThenMoreRead) {}

TEST_P(QuicProxyClientSocketTest, ReadWillSplitDataFromLargeFrame) {}

TEST_P(QuicProxyClientSocketTest, MultipleReadsFromSameLargeFrame) {}

TEST_P(QuicProxyClientSocketTest, ReadAuthResponseBody) {}

TEST_P(QuicProxyClientSocketTest, ReadErrorResponseBody) {}

// ----------- Reads and Writes

TEST_P(QuicProxyClientSocketTest, AsyncReadAroundWrite) {}

TEST_P(QuicProxyClientSocketTest, AsyncWriteAroundReads) {}

// ----------- Reading/Writing on Closed socket

// Reading from an already closed socket should return 0
TEST_P(QuicProxyClientSocketTest, ReadOnClosedSocketReturnsZero) {}

// Read pending when socket is closed should return 0
TEST_P(QuicProxyClientSocketTest, PendingReadOnCloseReturnsZero) {}

// Reading from a disconnected socket is an error
TEST_P(QuicProxyClientSocketTest, ReadOnDisconnectSocketReturnsNotConnected) {}

// Reading data after receiving FIN should return buffered data received before
// FIN, then 0.
TEST_P(QuicProxyClientSocketTest, ReadAfterFinReceivedReturnsBufferedData) {}

// Calling Write() on a closed socket is an error.
TEST_P(QuicProxyClientSocketTest, WriteOnClosedStream) {}

// Calling Write() on a disconnected socket is an error.
TEST_P(QuicProxyClientSocketTest, WriteOnDisconnectedSocket) {}

// If the socket is closed with a pending Write(), the callback should be called
// with the same error the session was closed with.
TEST_P(QuicProxyClientSocketTest, WritePendingOnClose) {}

TEST_P(QuicProxyClientSocketTest, DisconnectWithWritePending) {}

// If the socket is Disconnected with a pending Read(), the callback
// should not be called.
TEST_P(QuicProxyClientSocketTest, DisconnectWithReadPending) {}

// If the socket is Reset when both a read and write are pending,
// both should be called back.
TEST_P(QuicProxyClientSocketTest, RstWithReadAndWritePending) {}

// Makes sure the proxy client socket's source gets the expected NetLog events
// and only the expected NetLog events (No SpdySession events).
TEST_P(QuicProxyClientSocketTest, NetLog) {}

// A helper class that will delete |sock| when the callback is invoked.
class DeleteSockCallback : public TestCompletionCallbackBase {};

// If the socket is reset when both a read and write are pending, and the
// read callback causes the socket to be deleted, the write callback should
// not be called.
TEST_P(QuicProxyClientSocketTest, RstWithReadAndWritePendingDelete) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace net::test