#include "quiche/quic/core/http/quic_spdy_session.h"
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#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/crypto_protocol.h"
#include "quiche/quic/core/frames/quic_stream_frame.h"
#include "quiche/quic/core/frames/quic_streams_blocked_frame.h"
#include "quiche/quic/core/http/http_constants.h"
#include "quiche/quic/core/http/http_encoder.h"
#include "quiche/quic/core/http/quic_header_list.h"
#include "quiche/quic/core/http/web_transport_http3.h"
#include "quiche/quic/core/qpack/qpack_header_table.h"
#include "quiche/quic/core/quic_config.h"
#include "quiche/quic/core/quic_crypto_stream.h"
#include "quiche/quic/core/quic_data_writer.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/core/quic_stream.h"
#include "quiche/quic/core/quic_stream_priority.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.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_encoder_peer.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_stream_peer.h"
#include "quiche/quic/test_tools/quic_stream_send_buffer_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
#include "quiche/common/quiche_endian.h"
#include "quiche/common/test_tools/quiche_test_utils.h"
#include "quiche/spdy/core/spdy_framer.h"
HttpHeaderBlock;
kV3HighestPriority;
Spdy3PriorityToHttp2Weight;
SpdyFramer;
SpdyPriority;
SpdyPriorityIR;
SpdySerializedFrame;
_;
AnyNumber;
AtLeast;
ElementsAre;
InSequence;
Invoke;
Return;
StrictMock;
namespace quic {
namespace test {
namespace {
bool VerifyAndClearStopSendingFrame(const QuicFrame& frame) { … }
class TestCryptoStream : public QuicCryptoStream, public QuicCryptoHandshaker { … };
class TestHeadersStream : public QuicHeadersStream { … };
class TestStream : public QuicSpdyStream { … };
class TestSession : public QuicSpdySession { … };
class QuicSpdySessionTestBase : public QuicTestWithParam<ParsedQuicVersion> { … };
class QuicSpdySessionTestServer : public QuicSpdySessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSpdySessionTestServer, UsesPendingStreamsForFrame) { … }
TEST_P(QuicSpdySessionTestServer, PeerAddress) { … }
TEST_P(QuicSpdySessionTestServer, SelfAddress) { … }
TEST_P(QuicSpdySessionTestServer, OneRttKeysAvailable) { … }
TEST_P(QuicSpdySessionTestServer, IsClosedStreamDefault) { … }
TEST_P(QuicSpdySessionTestServer, AvailableStreams) { … }
TEST_P(QuicSpdySessionTestServer, IsClosedStreamLocallyCreated) { … }
TEST_P(QuicSpdySessionTestServer, IsClosedStreamPeerCreated) { … }
TEST_P(QuicSpdySessionTestServer, MaximumAvailableOpenedStreams) { … }
TEST_P(QuicSpdySessionTestServer, TooManyAvailableStreams) { … }
TEST_P(QuicSpdySessionTestServer, ManyAvailableStreams) { … }
TEST_P(QuicSpdySessionTestServer,
DebugDFatalIfMarkingClosedStreamWriteBlocked) { … }
TEST_P(QuicSpdySessionTestServer, TooLargeStreamBlocked) { … }
TEST_P(QuicSpdySessionTestServer, OnCanWriteBundlesStreams) { … }
TEST_P(QuicSpdySessionTestServer, OnCanWriteCongestionControlBlocks) { … }
TEST_P(QuicSpdySessionTestServer, OnCanWriteWriterBlocks) { … }
TEST_P(QuicSpdySessionTestServer, BufferedHandshake) { … }
TEST_P(QuicSpdySessionTestServer, OnCanWriteWithClosedStream) { … }
TEST_P(QuicSpdySessionTestServer,
OnCanWriteLimitsNumWritesIfFlowControlBlocked) { … }
TEST_P(QuicSpdySessionTestServer, SendGoAway) { … }
TEST_P(QuicSpdySessionTestServer, SendGoAwayWithoutEncryption) { … }
TEST_P(QuicSpdySessionTestServer, SendHttp3GoAway) { … }
TEST_P(QuicSpdySessionTestServer, SendHttp3GoAwayAndNoMoreMaxStreams) { … }
TEST_P(QuicSpdySessionTestServer, SendHttp3GoAwayWithoutEncryption) { … }
TEST_P(QuicSpdySessionTestServer, SendHttp3GoAwayAfterStreamIsCreated) { … }
TEST_P(QuicSpdySessionTestServer, DoNotSendGoAwayTwice) { … }
TEST_P(QuicSpdySessionTestServer, InvalidGoAway) { … }
TEST_P(QuicSpdySessionTestServer, Http3GoAwayLargerIdThanBefore) { … }
TEST_P(QuicSpdySessionTestServer, ServerReplyToConnecitivityProbe) { … }
TEST_P(QuicSpdySessionTestServer, IncreasedTimeoutAfterCryptoHandshake) { … }
TEST_P(QuicSpdySessionTestServer, RstStreamBeforeHeadersDecompressed) { … }
TEST_P(QuicSpdySessionTestServer, OnStreamFrameFinStaticStreamId) { … }
TEST_P(QuicSpdySessionTestServer, OnRstStreamStaticStreamId) { … }
TEST_P(QuicSpdySessionTestServer, OnStreamFrameInvalidStreamId) { … }
TEST_P(QuicSpdySessionTestServer, OnRstStreamInvalidStreamId) { … }
TEST_P(QuicSpdySessionTestServer, HandshakeUnblocksFlowControlBlockedStream) { … }
#if !defined(OS_IOS)
TEST_P(QuicSpdySessionTestServer,
HandshakeUnblocksFlowControlBlockedHeadersStream) { … }
#endif
TEST_P(QuicSpdySessionTestServer,
ConnectionFlowControlAccountingRstOutOfOrder) { … }
TEST_P(QuicSpdySessionTestServer, InvalidStreamFlowControlWindowInHandshake) { … }
TEST_P(QuicSpdySessionTestServer, TooLowUnidirectionalStreamLimitHttp3) { … }
TEST_P(QuicSpdySessionTestServer, CustomFlowControlWindow) { … }
TEST_P(QuicSpdySessionTestServer, WindowUpdateUnblocksHeadersStream) { … }
TEST_P(QuicSpdySessionTestServer,
TooManyUnfinishedStreamsCauseServerRejectStream) { … }
TEST_P(QuicSpdySessionTestServer, DrainingStreamsDoNotCountAsOpened) { … }
class QuicSpdySessionTestClient : public QuicSpdySessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSpdySessionTestClient, UsesPendingStreamsForFrame) { … }
TEST_P(QuicSpdySessionTestClient, BadStreamFramePendingStream) { … }
TEST_P(QuicSpdySessionTestClient, PendingStreamKeepsConnectionAlive) { … }
TEST_P(QuicSpdySessionTestClient, AvailableStreamsClient) { … }
TEST_P(QuicSpdySessionTestClient, TooLargeHeadersMustNotCauseWriteAfterReset) { … }
TEST_P(QuicSpdySessionTestClient, RecordFinAfterReadSideClosed) { … }
TEST_P(QuicSpdySessionTestClient, WritePriority) { … }
TEST_P(QuicSpdySessionTestClient, Http3ServerPush) { … }
TEST_P(QuicSpdySessionTestClient, Http3ServerPushOutofOrderFrame) { … }
TEST_P(QuicSpdySessionTestClient, ServerDisableQpackDynamicTable) { … }
TEST_P(QuicSpdySessionTestClient, DisableQpackDynamicTable) { … }
TEST_P(QuicSpdySessionTestServer, OnStreamFrameLost) { … }
TEST_P(QuicSpdySessionTestServer, DonotRetransmitDataOfClosedStreams) { … }
TEST_P(QuicSpdySessionTestServer, RetransmitFrames) { … }
TEST_P(QuicSpdySessionTestServer, OnPriorityFrame) { … }
TEST_P(QuicSpdySessionTestServer, OnPriorityUpdateFrame) { … }
TEST_P(QuicSpdySessionTestServer, OnInvalidPriorityUpdateFrame) { … }
TEST_P(QuicSpdySessionTestServer, OnPriorityUpdateFrameOutOfBoundsUrgency) { … }
TEST_P(QuicSpdySessionTestServer, SimplePendingStreamType) { … }
TEST_P(QuicSpdySessionTestServer, SimplePendingStreamTypeOutOfOrderDelivery) { … }
TEST_P(QuicSpdySessionTestServer,
MultipleBytesPendingStreamTypeOutOfOrderDelivery) { … }
TEST_P(QuicSpdySessionTestServer, ReceiveControlStream) { … }
TEST_P(QuicSpdySessionTestServer, ServerDisableQpackDynamicTable) { … }
TEST_P(QuicSpdySessionTestServer, DisableQpackDynamicTable) { … }
TEST_P(QuicSpdySessionTestServer, ReceiveControlStreamOutOfOrderDelivery) { … }
TEST_P(QuicSpdySessionTestServer, StreamClosedWhileHeaderDecodingBlocked) { … }
TEST_P(QuicSpdySessionTestServer, SessionDestroyedWhileHeaderDecodingBlocked) { … }
TEST_P(QuicSpdySessionTestClient, ResetAfterInvalidIncomingStreamType) { … }
TEST_P(QuicSpdySessionTestClient, FinAfterInvalidIncomingStreamType) { … }
TEST_P(QuicSpdySessionTestClient, ResetInMiddleOfStreamType) { … }
TEST_P(QuicSpdySessionTestClient, FinInMiddleOfStreamType) { … }
TEST_P(QuicSpdySessionTestClient, DuplicateHttp3UnidirectionalStreams) { … }
TEST_P(QuicSpdySessionTestClient, EncoderStreamError) { … }
TEST_P(QuicSpdySessionTestClient, DecoderStreamError) { … }
TEST_P(QuicSpdySessionTestClient, InvalidHttp3GoAway) { … }
TEST_P(QuicSpdySessionTestClient, Http3GoAwayLargerIdThanBefore) { … }
TEST_P(QuicSpdySessionTestClient, CloseConnectionOnCancelPush) { … }
TEST_P(QuicSpdySessionTestServer, OnSetting) { … }
TEST_P(QuicSpdySessionTestServer, FineGrainedHpackErrorCodes) { … }
TEST_P(QuicSpdySessionTestServer, PeerClosesCriticalReceiveStream) { … }
TEST_P(QuicSpdySessionTestServer,
H3ControlStreamsLimitedByConnectionFlowControl) { … }
TEST_P(QuicSpdySessionTestServer, PeerClosesCriticalSendStream) { … }
TEST_P(QuicSpdySessionTestServer, CloseConnectionOnCancelPush) { … }
TEST_P(QuicSpdySessionTestServer, Http3GoAwayWhenClosingConnection) { … }
TEST_P(QuicSpdySessionTestClient, DoNotSendInitialMaxPushIdIfNotSet) { … }
TEST_P(QuicSpdySessionTestClient, ReceiveSpdySettingInHttp3) { … }
TEST_P(QuicSpdySessionTestClient, ReceiveAcceptChFrame) { … }
TEST_P(QuicSpdySessionTestClient, AcceptChViaAlps) { … }
TEST_P(QuicSpdySessionTestClient, AlpsForbiddenFrame) { … }
TEST_P(QuicSpdySessionTestClient, AlpsIncompleteFrame) { … }
TEST_P(QuicSpdySessionTestClient, SettingsViaAlpsThenOnControlStream) { … }
TEST_P(QuicSpdySessionTestClient,
SettingsViaAlpsConflictsSettingsViaControlStream) { … }
TEST_P(QuicSpdySessionTestClient, AlpsTwoSettingsFrame) { … }
void QuicSpdySessionTestBase::TestHttpDatagramSetting(
HttpDatagramSupport local_support, HttpDatagramSupport remote_support,
HttpDatagramSupport expected_support, bool expected_datagram_supported) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal04Remote04) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal04Remote09) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal04Remote04And09) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal09Remote04) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal09Remote09) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal09Remote04And09) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal04And09Remote04) { … }
TEST_P(QuicSpdySessionTestClient, HttpDatagramSettingLocal04And09Remote09) { … }
TEST_P(QuicSpdySessionTestClient,
HttpDatagramSettingLocal04And09Remote04And09) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportSettingDraft02OnlyBothSides) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportSettingDraft07OnlyBothSides) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportSettingBothDraftsBothSides) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportSettingVersionMismatch) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportSettingSetToZero) { … }
TEST_P(QuicSpdySessionTestServer, WebTransportSetting) { … }
TEST_P(QuicSpdySessionTestServer, BufferingIncomingStreams) { … }
TEST_P(QuicSpdySessionTestServer, BufferingIncomingStreamsLimit) { … }
TEST_P(QuicSpdySessionTestServer, BufferingIncomingStreamsWithFin) { … }
TEST_P(QuicSpdySessionTestServer, ResetOutgoingWebTransportStreams) { … }
TEST_P(QuicSpdySessionTestClient, WebTransportWithoutExtendedConnect) { … }
TEST_P(QuicSpdySessionTestClient, LimitEncoderDynamicTableSize) { … }
class QuicSpdySessionTestServerNoExtendedConnect
: public QuicSpdySessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSpdySessionTestServerNoExtendedConnect,
WebTransportSettingNoEffect) { … }
TEST_P(QuicSpdySessionTestServerNoExtendedConnect, BadExtendedConnectSetting) { … }
}
}
}