#include "quiche/quic/core/quic_session.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/macros.h"
#include "absl/memory/memory.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/crypto/null_decrypter.h"
#include "quiche/quic/core/crypto/null_encrypter.h"
#include "quiche/quic/core/crypto/transport_parameters.h"
#include "quiche/quic/core/frames/quic_max_streams_frame.h"
#include "quiche/quic/core/quic_crypto_stream.h"
#include "quiche/quic/core/quic_data_writer.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/core/quic_stream.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/mock_quic_session_visitor.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_stream_id_manager_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_logging.h"
#include "quiche/common/quiche_mem_slice_storage.h"
kV3HighestPriority;
SpdyPriority;
_;
AnyNumber;
AtLeast;
InSequence;
Invoke;
NiceMock;
Return;
StrictMock;
WithArg;
namespace quic {
namespace test {
namespace {
class TestCryptoStream : public QuicCryptoStream, public QuicCryptoHandshaker { … };
class TestStream : public QuicStream { … };
class TestSession : public QuicSession { … };
MATCHER_P(IsFrame, type, "") { … }
class QuicSessionTestBase : public QuicTestWithParam<ParsedQuicVersion> { … };
class QuicSessionTestServer : public QuicSessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSessionTestServer, PeerAddress) { … }
TEST_P(QuicSessionTestServer, SelfAddress) { … }
TEST_P(QuicSessionTestServer, DontCallOnWriteBlockedForDisconnectedConnection) { … }
TEST_P(QuicSessionTestServer, OneRttKeysAvailable) { … }
TEST_P(QuicSessionTestServer, IsClosedStreamDefault) { … }
TEST_P(QuicSessionTestServer, AvailableBidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, AvailableUnidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, MaxAvailableBidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, MaxAvailableUnidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, IsClosedBidirectionalStreamLocallyCreated) { … }
TEST_P(QuicSessionTestServer, IsClosedUnidirectionalStreamLocallyCreated) { … }
TEST_P(QuicSessionTestServer, IsClosedBidirectionalStreamPeerCreated) { … }
TEST_P(QuicSessionTestServer, IsClosedUnidirectionalStreamPeerCreated) { … }
TEST_P(QuicSessionTestServer, MaximumAvailableOpenedBidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, MaximumAvailableOpenedUnidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, TooManyAvailableBidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, TooManyAvailableUnidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, ManyAvailableBidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, ManyAvailableUnidirectionalStreams) { … }
TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) { … }
TEST_P(QuicSessionTestServer, OnCanWrite) { … }
TEST_P(QuicSessionTestServer, TestBatchedWrites) { … }
TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) { … }
TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) { … }
TEST_P(QuicSessionTestServer, OnCanWriteWriterBlocks) { … }
TEST_P(QuicSessionTestServer, SendStreamsBlocked) { … }
TEST_P(QuicSessionTestServer, LimitMaxStreams) { … }
TEST_P(QuicSessionTestServer, BufferedHandshake) { … }
TEST_P(QuicSessionTestServer, OnCanWriteWithClosedStream) { … }
TEST_P(QuicSessionTestServer, OnCanWriteLimitsNumWritesIfFlowControlBlocked) { … }
TEST_P(QuicSessionTestServer, SendGoAway) { … }
TEST_P(QuicSessionTestServer, DoNotSendGoAwayTwice) { … }
TEST_P(QuicSessionTestServer, InvalidGoAway) { … }
TEST_P(QuicSessionTestServer, ServerReplyToConnectivityProbe) { … }
TEST_P(QuicSessionTestServer, IncreasedTimeoutAfterCryptoHandshake) { … }
TEST_P(QuicSessionTestServer, OnStreamFrameFinStaticStreamId) { … }
TEST_P(QuicSessionTestServer, OnStreamFrameInvalidStreamId) { … }
TEST_P(QuicSessionTestServer, OnRstStreamInvalidStreamId) { … }
TEST_P(QuicSessionTestServer, HandshakeUnblocksFlowControlBlockedStream) { … }
TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingRstOutOfOrder) { … }
TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingFinAndLocalReset) { … }
TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingFinAfterRst) { … }
TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingRstAfterRst) { … }
TEST_P(QuicSessionTestServer, InvalidStreamFlowControlWindowInHandshake) { … }
TEST_P(QuicSessionTestServer, CustomFlowControlWindow) { … }
TEST_P(QuicSessionTestServer, FlowControlWithInvalidFinalOffset) { … }
TEST_P(QuicSessionTestServer, TooManyUnfinishedStreamsCauseServerRejectStream) { … }
TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpenedOutgoing) { … }
TEST_P(QuicSessionTestServer, NoPendingStreams) { … }
TEST_P(QuicSessionTestServer, PendingStreams) { … }
TEST_P(QuicSessionTestServer, BufferAllIncomingStreams) { … }
TEST_P(QuicSessionTestServer, RstPendingStreams) { … }
TEST_P(QuicSessionTestServer, OnFinPendingStreamsReadUnidirectional) { … }
TEST_P(QuicSessionTestServer, OnFinPendingStreamsBidirectional) { … }
TEST_P(QuicSessionTestServer, UnidirectionalPendingStreamOnWindowUpdate) { … }
TEST_P(QuicSessionTestServer, BidirectionalPendingStreamOnWindowUpdate) { … }
TEST_P(QuicSessionTestServer, UnidirectionalPendingStreamOnStopSending) { … }
TEST_P(QuicSessionTestServer, BidirectionalPendingStreamOnStopSending) { … }
TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpened) { … }
class QuicSessionTestClient : public QuicSessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSessionTestClient, AvailableBidirectionalStreamsClient) { … }
TEST_P(QuicSessionTestClient, DonotSendRetireCIDFrameWhenConnectionClosed) { … }
TEST_P(QuicSessionTestClient, NewStreamCreationResumesMultiPortProbing) { … }
TEST_P(QuicSessionTestClient, InvalidSessionFlowControlWindowInHandshake) { … }
TEST_P(QuicSessionTestClient, InvalidBidiStreamLimitInHandshake) { … }
TEST_P(QuicSessionTestClient, InvalidUniStreamLimitInHandshake) { … }
TEST_P(QuicSessionTestClient, InvalidStreamFlowControlWindowInHandshake) { … }
TEST_P(QuicSessionTestClient, OnMaxStreamFrame) { … }
TEST_P(QuicSessionTestClient, AvailableUnidirectionalStreamsClient) { … }
TEST_P(QuicSessionTestClient, RecordFinAfterReadSideClosed) { … }
TEST_P(QuicSessionTestClient, IncomingStreamWithClientInitiatedStreamId) { … }
TEST_P(QuicSessionTestClient, MinAckDelaySetOnTheClientQuicConfig) { … }
TEST_P(QuicSessionTestClient, FailedToCreateStreamIfTooCloseToIdleTimeout) { … }
TEST_P(QuicSessionTestServer, ZombieStreams) { … }
TEST_P(QuicSessionTestServer, RstStreamReceivedAfterRstStreamSent) { … }
TEST_P(QuicSessionTestServer, TestZombieStreams) { … }
TEST_P(QuicSessionTestServer, OnStreamFrameLost) { … }
TEST_P(QuicSessionTestServer, DonotRetransmitDataOfClosedStreams) { … }
TEST_P(QuicSessionTestServer, RetransmitFrames) { … }
TEST_P(QuicSessionTestServer, RetransmitLostDataCausesConnectionClose) { … }
TEST_P(QuicSessionTestServer, SendMessage) { … }
TEST_P(QuicSessionTestServer, LocallyResetZombieStreams) { … }
TEST_P(QuicSessionTestServer, CleanUpClosedStreamsAlarm) { … }
TEST_P(QuicSessionTestServer, WriteUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, ReceivedDataOnWriteUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, ReadUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, WriteOrBufferDataOnReadUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, WritevDataOnReadUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, WriteMemSlicesOnReadUnidirectionalStream) { … }
TEST_P(QuicSessionTestServer, NewStreamIdBelowLimit) { … }
TEST_P(QuicSessionTestServer, NewStreamIdAtLimit) { … }
TEST_P(QuicSessionTestServer, NewStreamIdAboveLimit) { … }
TEST_P(QuicSessionTestServer, OnStopSendingInvalidStreamId) { … }
TEST_P(QuicSessionTestServer, OnStopSendingReadUnidirectional) { … }
TEST_P(QuicSessionTestServer, OnStopSendingStaticStreams) { … }
TEST_P(QuicSessionTestServer, OnStopSendingForWriteClosedStream) { … }
TEST_P(QuicSessionTestServer, OnStopSendingClosedStream) { … }
TEST_P(QuicSessionTestServer, OnStopSendingInputNonExistentLocalStream) { … }
TEST_P(QuicSessionTestServer, OnStopSendingNewStream) { … }
TEST_P(QuicSessionTestServer, OnStopSendingInputValidStream) { … }
TEST_P(QuicSessionTestServer, WriteBufferedCryptoFrames) { … }
TEST_P(QuicSessionTestServer, StreamFrameReceivedAfterFin) { … }
TEST_P(QuicSessionTestServer, ResetForIETFStreamTypes) { … }
TEST_P(QuicSessionTestServer, DecryptionKeyAvailableBeforeEncryptionKey) { … }
TEST_P(QuicSessionTestServer, IncomingStreamWithServerInitiatedStreamId) { … }
TEST_P(QuicSessionTestServer, BlockedFrameCausesWriteError) { … }
TEST_P(QuicSessionTestServer, BufferedCryptoFrameCausesWriteError) { … }
TEST_P(QuicSessionTestServer, DonotPtoStreamDataBeforeHandshakeConfirmed) { … }
TEST_P(QuicSessionTestServer, SetStatelessResetTokenToSend) { … }
TEST_P(QuicSessionTestServer,
SetServerPreferredAddressAccordingToAddressFamily) { … }
TEST_P(QuicSessionTestServer,
SetDNatServerPreferredAddressAccordingToAddressFamily) { … }
TEST_P(QuicSessionTestServer, NoServerPreferredAddressIfAddressFamilyMismatch) { … }
TEST_P(QuicSessionTestServer, OpenStreamLimitPerEventLoop) { … }
class QuicSessionTestClientUnconfigured : public QuicSessionTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicSessionTestClientUnconfigured, StreamInitiallyBlockedThenUnblocked) { … }
}
}
}