chromium/net/quic/quic_chromium_client_stream_test.cc

// Copyright 2012 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_chromium_client_stream.h"

#include <string>
#include <string_view>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/quic/quic_chromium_client_session.h"
#include "net/quic/quic_context.h"
#include "net/test/gtest_util.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/core/http/quic_spdy_client_session_base.h"
#include "net/third_party/quiche/src/quiche/quic/core/http/quic_spdy_client_stream.h"
#include "net/third_party/quiche/src/quiche/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_server_id.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_config_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_connection_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_spdy_session_peer.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"

_;
Return;

namespace net::test {
namespace {

class EstablishedCryptoStream : public quic::test::MockQuicCryptoStream {};

class MockQuicClientSessionBase : public quic::QuicSpdyClientSessionBase {};

MockQuicClientSessionBase::MockQuicClientSessionBase(
    quic::QuicConnection* connection)
    :{}

MockQuicClientSessionBase::~MockQuicClientSessionBase() = default;

class QuicChromiumClientStreamTest
    : public ::testing::TestWithParam<quic::ParsedQuicVersion>,
      public WithTaskEnvironment {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(QuicChromiumClientStreamTest, Handle) {}

TEST_P(QuicChromiumClientStreamTest, HandleAfterConnectionClose) {}

TEST_P(QuicChromiumClientStreamTest, HandleAfterStreamReset) {}

TEST_P(QuicChromiumClientStreamTest, OnFinRead) {}

TEST_P(QuicChromiumClientStreamTest, OnDataAvailable) {}

TEST_P(QuicChromiumClientStreamTest, OnDataAvailableAfterReadBody) {}

TEST_P(QuicChromiumClientStreamTest, ProcessHeadersWithError) {}

TEST_P(QuicChromiumClientStreamTest, OnDataAvailableWithError) {}

TEST_P(QuicChromiumClientStreamTest, OnError) {}

TEST_P(QuicChromiumClientStreamTest, OnTrailers) {}

// Tests that trailers are marked as consumed only before delegate is to be
// immediately notified about trailers.
TEST_P(QuicChromiumClientStreamTest, MarkTrailersConsumedWhenNotifyDelegate) {}

// Test that if Read() is called after response body is read and after trailers
// are received but not yet delivered, Read() will return ERR_IO_PENDING instead
// of 0 (EOF).
TEST_P(QuicChromiumClientStreamTest, ReadAfterTrailersReceivedButNotDelivered) {}

TEST_P(QuicChromiumClientStreamTest, WriteStreamData) {}

TEST_P(QuicChromiumClientStreamTest, WriteStreamDataAsync) {}

TEST_P(QuicChromiumClientStreamTest, WritevStreamData) {}

TEST_P(QuicChromiumClientStreamTest, WritevStreamDataAsync) {}

TEST_P(QuicChromiumClientStreamTest, WriteConnectUdpPayload) {}

TEST_P(QuicChromiumClientStreamTest, HeadersBeforeHandle) {}

TEST_P(QuicChromiumClientStreamTest, HeadersAndDataBeforeHandle) {}

// Regression test for https://crbug.com/1043531.
TEST_P(QuicChromiumClientStreamTest, ResetOnEmptyResponseHeaders) {}

// Tests that the stream resets when it receives an invalid ":status"
// pseudo-header value.
TEST_P(QuicChromiumClientStreamTest, InvalidStatus) {}

// Tests that the stream resets when it receives 101 Switching Protocols.
TEST_P(QuicChromiumClientStreamTest, SwitchingProtocolsResponse) {}

// Tests that the stream ignores 100 Continue response.
TEST_P(QuicChromiumClientStreamTest, ContinueResponse) {}

// Tests that the stream handles 103 Early Hints responses.
TEST_P(QuicChromiumClientStreamTest, EarlyHintsResponses) {}

// Tests that pending reads for Early Hints work.
TEST_P(QuicChromiumClientStreamTest, EarlyHintsAsync) {}

// Tests that Early Hints after the initial headers is treated as an error.
TEST_P(QuicChromiumClientStreamTest, EarlyHintsAfterInitialHeaders) {}

// Similar to the above test but don't read the initial headers.
TEST_P(QuicChromiumClientStreamTest, EarlyHintsAfterInitialHeadersWithoutRead) {}

// Regression test for https://crbug.com/1248970. Write an Early Hints headers,
// an initial response headers and trailers in succession without reading in
// the middle of writings.
TEST_P(QuicChromiumClientStreamTest, TrailersAfterEarlyHintsWithoutRead) {}

}  // namespace
}  // namespace net::test