#include "quiche/quic/core/http/quic_spdy_stream.h"
#include <algorithm>
#include <array>
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/macros.h"
#include "absl/memory/memory.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/crypto/null_encrypter.h"
#include "quiche/quic/core/http/http_constants.h"
#include "quiche/quic/core/http/http_encoder.h"
#include "quiche/quic/core/http/http_frames.h"
#include "quiche/quic/core/http/quic_spdy_session.h"
#include "quiche/quic/core/http/spdy_utils.h"
#include "quiche/quic/core/http/web_transport_http3.h"
#include "quiche/quic/core/qpack/value_splitting_header_list.h"
#include "quiche/quic/core/quic_connection.h"
#include "quiche/quic/core/quic_stream_sequencer_buffer.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/core/quic_write_blocked_list.h"
#include "quiche/quic/platform/api/quic_expect_bug.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/qpack/qpack_test_utils.h"
#include "quiche/quic/test_tools/quic_config_peer.h"
#include "quiche/quic/test_tools/quic_connection_peer.h"
#include "quiche/quic/test_tools/quic_flow_controller_peer.h"
#include "quiche/quic/test_tools/quic_session_peer.h"
#include "quiche/quic/test_tools/quic_spdy_session_peer.h"
#include "quiche/quic/test_tools/quic_spdy_stream_peer.h"
#include "quiche/quic/test_tools/quic_stream_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/common/capsule.h"
#include "quiche/common/quiche_ip_address.h"
#include "quiche/common/quiche_mem_slice_storage.h"
#include "quiche/common/simple_buffer_allocator.h"
Capsule;
HttpHeaderBlock;
IpAddressRange;
kV3HighestPriority;
kV3LowestPriority;
_;
AnyNumber;
AtLeast;
DoAll;
ElementsAre;
HasSubstr;
Invoke;
InvokeWithoutArgs;
MatchesRegex;
Optional;
Pair;
Return;
SaveArg;
StrictMock;
namespace quic {
namespace test {
namespace {
constexpr bool kShouldProcessData = …;
constexpr absl::string_view kDataFramePayload = …;
class TestCryptoStream : public QuicCryptoStream, public QuicCryptoHandshaker { … };
class TestStream : public QuicSpdyStream { … };
class TestSession : public MockQuicSpdySession { … };
class TestMockUpdateStreamSession : public MockQuicSpdySession { … };
class QuicSpdyStreamTest : public QuicTestWithParam<ParsedQuicVersion> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSpdyStreamTest, ProcessHeaderList) { … }
TEST_P(QuicSpdyStreamTest, ProcessTooLargeHeaderList) { … }
TEST_P(QuicSpdyStreamTest, QpackProcessLargeHeaderListDiscountOverhead) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeaderListWithFin) { … }
TEST_P(QuicSpdyStreamTest, ParseHeaderStatusCode) { … }
TEST_P(QuicSpdyStreamTest, MarkHeadersConsumed) { … }
TEST_P(QuicSpdyStreamTest, ProcessWrongFramesOnSpdyStream) { … }
TEST_P(QuicSpdyStreamTest, Http3FrameError) { … }
TEST_P(QuicSpdyStreamTest, UnexpectedHttp3Frame) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBody) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragments) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragmentsSplit) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyReadv) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndLargeBodySmallReadv) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyMarkConsumed) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndConsumeMultipleBody) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyIncrementalReadv) { … }
TEST_P(QuicSpdyStreamTest, ProcessHeadersUsingReadvWithMultipleIovecs) { … }
TEST_P(QuicSpdyStreamTest, StreamFlowControlBlocked) { … }
TEST_P(QuicSpdyStreamTest, StreamFlowControlNoWindowUpdateIfNotConsumed) { … }
TEST_P(QuicSpdyStreamTest, StreamFlowControlWindowUpdate) { … }
TEST_P(QuicSpdyStreamTest, ConnectionFlowControlWindowUpdate) { … }
TEST_P(QuicSpdyStreamTest, StreamFlowControlViolation) { … }
TEST_P(QuicSpdyStreamTest, TestHandlingQuicRstStreamNoError) { … }
TEST_P(QuicSpdyStreamTest, ConnectionFlowControlViolation) { … }
TEST_P(QuicSpdyStreamTest, StreamFlowControlFinNotBlocked) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersViaHeaderList) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersWithOffset) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersWithoutOffset) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersWithoutFin) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersAfterHeadersWithFin) { … }
TEST_P(QuicSpdyStreamTest, ReceivingTrailersAfterBodyWithFin) { … }
TEST_P(QuicSpdyStreamTest, ClosingStreamWithNoTrailers) { … }
TEST_P(QuicSpdyStreamTest, WritingTrailersSendsAFin) { … }
TEST_P(QuicSpdyStreamTest, DoNotSendPriorityUpdateWithDefaultUrgency) { … }
TEST_P(QuicSpdyStreamTest, ChangePriority) { … }
TEST_P(QuicSpdyStreamTest, ChangePriorityBeforeWritingHeaders) { … }
TEST_P(QuicSpdyStreamTest, WritingTrailersFinalOffset) { … }
TEST_P(QuicSpdyStreamTest, WritingTrailersClosesWriteSide) { … }
TEST_P(QuicSpdyStreamTest, WritingTrailersWithQueuedBytes) { … }
TEST_P(QuicSpdyStreamTest, WritingTrailersAfterFIN) { … }
TEST_P(QuicSpdyStreamTest, HeaderStreamNotiferCorrespondingSpdyStream) { … }
TEST_P(QuicSpdyStreamTest, OnPriorityFrame) { … }
TEST_P(QuicSpdyStreamTest, OnPriorityFrameAfterSendingData) { … }
TEST_P(QuicSpdyStreamTest, SetPriorityBeforeUpdateStreamPriority) { … }
TEST_P(QuicSpdyStreamTest, StreamWaitsForAcks) { … }
TEST_P(QuicSpdyStreamTest, StreamDataGetAckedMultipleTimes) { … }
TEST_P(QuicSpdyStreamTest, HeadersAckNotReportedWriteOrBufferBody) { … }
TEST_P(QuicSpdyStreamTest, HeadersAckNotReportedWriteBodySlices) { … }
TEST_P(QuicSpdyStreamTest, HeaderBytesNotReportedOnRetransmission) { … }
TEST_P(QuicSpdyStreamTest, HeadersFrameOnRequestStream) { … }
TEST_P(QuicSpdyStreamTest, ProcessBodyAfterTrailers) { … }
TEST_P(QuicSpdyStreamTest, MalformedHeadersStopHttpDecoder) { … }
TEST_P(QuicSpdyStreamTest, DoNotMarkConsumedAfterQpackDecodingError) { … }
TEST_P(QuicSpdyStreamTest, ImmediateHeaderDecodingWithDynamicTableEntries) { … }
TEST_P(QuicSpdyStreamTest, BlockedHeaderDecoding) { … }
TEST_P(QuicSpdyStreamTest, BlockedHeaderDecodingAndStopReading) { … }
TEST_P(QuicSpdyStreamTest, AsyncErrorDecodingHeaders) { … }
TEST_P(QuicSpdyStreamTest, BlockedHeaderDecodingUnblockedWithBufferedError) { … }
TEST_P(QuicSpdyStreamTest, AsyncErrorDecodingTrailers) { … }
TEST_P(QuicSpdyStreamTest, HeaderDecodingUnblockedAfterStreamClosed) { … }
TEST_P(QuicSpdyStreamTest, HeaderDecodingUnblockedAfterResetReceived) { … }
class QuicSpdyStreamIncrementalConsumptionTest : public QuicSpdyStreamTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSpdyStreamIncrementalConsumptionTest, OnlyKnownFrames) { … }
TEST_P(QuicSpdyStreamIncrementalConsumptionTest, ReceiveUnknownFrame) { … }
TEST_P(QuicSpdyStreamIncrementalConsumptionTest,
ReceiveUnsupportedMetadataFrame) { … }
class MockMetadataVisitor : public QuicSpdyStream::MetadataVisitor { … };
TEST_P(QuicSpdyStreamIncrementalConsumptionTest, ReceiveMetadataFrame) { … }
TEST_P(QuicSpdyStreamIncrementalConsumptionTest,
ResetDuringMultipleMetadataFrames) { … }
TEST_P(QuicSpdyStreamIncrementalConsumptionTest, UnknownFramesInterleaved) { … }
TEST_P(QuicSpdyStreamTest, DataBeforeHeaders) { … }
TEST_P(QuicSpdyStreamTest, TrailersAfterTrailers) { … }
TEST_P(QuicSpdyStreamTest, DataAfterTrailers) { … }
TEST_P(QuicSpdyStreamTest, StopProcessingIfConnectionClosed) { … }
TEST_P(QuicSpdyStreamTest, StreamCancellationWhenStreamReset) { … }
TEST_P(QuicSpdyStreamTest, StreamCancellationOnResetReceived) { … }
TEST_P(QuicSpdyStreamTest, WriteHeadersReturnValue) { … }
TEST_P(QuicSpdyStreamTest, TwoResetStreamFrames) { … }
TEST_P(QuicSpdyStreamTest, ProcessOutgoingWebTransportHeaders) { … }
TEST_P(QuicSpdyStreamTest, ProcessIncomingWebTransportHeaders) { … }
TEST_P(QuicSpdyStreamTest, IncomingWebTransportStreamWhenUnsupported) { … }
TEST_P(QuicSpdyStreamTest, IncomingWebTransportStream) { … }
TEST_P(QuicSpdyStreamTest, IncomingWebTransportStreamWithPaddingDraft02) { … }
TEST_P(QuicSpdyStreamTest, IncomingWebTransportStreamWithPaddingDraft07) { … }
TEST_P(QuicSpdyStreamTest, ReceiveHttpDatagram) { … }
TEST_P(QuicSpdyStreamTest, SendHttpDatagram) { … }
TEST_P(QuicSpdyStreamTest, GetMaxDatagramSize) { … }
TEST_P(QuicSpdyStreamTest, Capsules) { … }
TEST_P(QuicSpdyStreamTest,
QUIC_TEST_DISABLED_IN_CHROME(HeadersAccumulatorNullptr)) { … }
TEST_P(QuicSpdyStreamTest, ReadAfterReset) { … }
TEST_P(QuicSpdyStreamTest, ColonDisallowedInHeaderName) { … }
}
}
}