#include "quiche/quic/core/quic_sent_packet_manager.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/base/macros.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/frames/quic_ack_frequency_frame.h"
#include "quiche/quic/core/quic_time.h"
#include "quiche/quic/core/quic_types.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/quic_config_peer.h"
#include "quiche/quic/test_tools/quic_sent_packet_manager_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
_;
AnyNumber;
Invoke;
InvokeWithoutArgs;
IsEmpty;
Not;
Pointwise;
Return;
StrictMock;
WithArgs;
namespace quic {
namespace test {
namespace {
const uint32_t kDefaultLength = …;
const QuicStreamId kStreamId = …;
const std::optional<QuicEcnCounts> kEmptyCounts = …;
MATCHER(PacketNumberEq, "") { … }
class MockDebugDelegate : public QuicSentPacketManager::DebugDelegate { … };
class QuicSentPacketManagerTest : public QuicTest { … };
TEST_F(QuicSentPacketManagerTest, IsUnacked) { … }
TEST_F(QuicSentPacketManagerTest, IsUnAckedRetransmit) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitThenAck) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitThenAckBeforeSend) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitThenStopRetransmittingBeforeSend) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitThenAckPrevious) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitThenAckPreviousThenNackRetransmit) { … }
TEST_F(QuicSentPacketManagerTest,
DISABLED_RetransmitTwiceThenAckPreviousBeforeSend) { … }
TEST_F(QuicSentPacketManagerTest, RetransmitTwiceThenAckFirst) { … }
TEST_F(QuicSentPacketManagerTest, AckOriginalTransmission) { … }
TEST_F(QuicSentPacketManagerTest, GetLeastUnacked) { … }
TEST_F(QuicSentPacketManagerTest, GetLeastUnackedUnacked) { … }
TEST_F(QuicSentPacketManagerTest, AckAckAndUpdateRtt) { … }
TEST_F(QuicSentPacketManagerTest, Rtt) { … }
TEST_F(QuicSentPacketManagerTest, RttWithInvalidDelta) { … }
TEST_F(QuicSentPacketManagerTest, RttWithInfiniteDelta) { … }
TEST_F(QuicSentPacketManagerTest, RttWithDeltaExceedingLimit) { … }
TEST_F(QuicSentPacketManagerTest, RttZeroDelta) { … }
TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeout) { … }
TEST_F(QuicSentPacketManagerTest, CryptoHandshakeSpuriousRetransmission) { … }
TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutUnsentDataPacket) { … }
TEST_F(QuicSentPacketManagerTest,
CryptoHandshakeRetransmissionThenNeuterAndAck) { … }
TEST_F(QuicSentPacketManagerTest, GetTransmissionTime) { … }
TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeCryptoHandshake) { … }
TEST_F(QuicSentPacketManagerTest,
GetConservativeTransmissionTimeCryptoHandshake) { … }
TEST_F(QuicSentPacketManagerTest, GetLossDelay) { … }
TEST_F(QuicSentPacketManagerTest, NegotiateIetfLossDetectionFromOptions) { … }
TEST_F(QuicSentPacketManagerTest,
NegotiateIetfLossDetectionOneFourthRttFromOptions) { … }
TEST_F(QuicSentPacketManagerTest,
NegotiateIetfLossDetectionAdaptiveReorderingThreshold) { … }
TEST_F(QuicSentPacketManagerTest,
NegotiateIetfLossDetectionAdaptiveReorderingThreshold2) { … }
TEST_F(QuicSentPacketManagerTest,
NegotiateIetfLossDetectionAdaptiveReorderingAndTimeThreshold) { … }
TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { … }
TEST_F(QuicSentPacketManagerTest, NegotiateClientCongestionControlFromOptions) { … }
TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { … }
TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) { … }
TEST_F(QuicSentPacketManagerTest, ConnectionMigrationUnspecifiedChange) { … }
TEST_F(QuicSentPacketManagerTest,
ConnectionMigrationUnspecifiedChangeResetSendAlgorithm) { … }
TEST_F(QuicSentPacketManagerTest, PathMtuIncreased) { … }
TEST_F(QuicSentPacketManagerTest, OnAckRangeSlowPath) { … }
TEST_F(QuicSentPacketManagerTest, TolerateReneging) { … }
TEST_F(QuicSentPacketManagerTest, MultiplePacketNumberSpaces) { … }
TEST_F(QuicSentPacketManagerTest, PacketsGetAckedInWrongPacketNumberSpace) { … }
TEST_F(QuicSentPacketManagerTest, PacketsGetAckedInWrongPacketNumberSpace2) { … }
TEST_F(QuicSentPacketManagerTest,
ToleratePacketsGetAckedInWrongPacketNumberSpace) { … }
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeout) { … }
TEST_F(QuicSentPacketManagerTest, SendOneProbePacket) { … }
TEST_F(QuicSentPacketManagerTest, DisableHandshakeModeClient) { … }
TEST_F(QuicSentPacketManagerTest, DisableHandshakeModeServer) { … }
TEST_F(QuicSentPacketManagerTest, PtoTimeoutRttVarMultiple) { … }
TEST_F(QuicSentPacketManagerTest, IW10ForUpAndDown) { … }
TEST_F(QuicSentPacketManagerTest, ClientMultiplePacketNumberSpacePtoTimeout) { … }
TEST_F(QuicSentPacketManagerTest, ServerMultiplePacketNumberSpacePtoTimeout) { … }
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutByLeftEdge) { … }
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutByLeftEdge2) { … }
TEST_F(QuicSentPacketManagerTest,
ComputingProbeTimeoutByLeftEdgeMultiplePacketNumberSpaces) { … }
TEST_F(QuicSentPacketManagerTest,
ComputingProbeTimeoutByLeftEdge2MultiplePacketNumberSpaces) { … }
TEST_F(QuicSentPacketManagerTest, SetHandshakeConfirmed) { … }
TEST_F(QuicSentPacketManagerTest, NeuterUnencryptedPackets) { … }
TEST_F(QuicSentPacketManagerTest, MarkInitialPacketsForRetransmission) { … }
TEST_F(QuicSentPacketManagerTest, NoPacketThresholdDetectionForRuntPackets) { … }
TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayDefaultPTO) { … }
TEST_F(QuicSentPacketManagerTest, ClientsIgnorePings) { … }
TEST_F(QuicSentPacketManagerTest, ExponentialBackoffWithNoRttMeasurement) { … }
TEST_F(QuicSentPacketManagerTest, PtoDelayWithTinyInitialRtt) { … }
TEST_F(QuicSentPacketManagerTest, HandshakeAckCausesInitialKeyDropping) { … }
TEST_F(QuicSentPacketManagerTest, ClearLastInflightPacketsSentTime) { … }
TEST_F(QuicSentPacketManagerTest, MaybeRetransmitInitialData) { … }
TEST_F(QuicSentPacketManagerTest, SendPathChallengeAndGetAck) { … }
SerializedPacket MakePacketWithAckFrequencyFrame(
int packet_number, int ack_frequency_sequence_number,
QuicTime::Delta max_ack_delay) { … }
TEST_F(QuicSentPacketManagerTest,
PeerMaxAckDelayUpdatedFromAckFrequencyFrameOneAtATime) { … }
TEST_F(QuicSentPacketManagerTest,
PeerMaxAckDelayUpdatedFromInOrderAckFrequencyFrames) { … }
TEST_F(QuicSentPacketManagerTest,
PeerMaxAckDelayUpdatedFromOutOfOrderAckedAckFrequencyFrames) { … }
TEST_F(QuicSentPacketManagerTest, ClearDataInMessageFrameAfterPacketSent) { … }
TEST_F(QuicSentPacketManagerTest, BuildAckFrequencyFrame) { … }
TEST_F(QuicSentPacketManagerTest, SmoothedRttIgnoreAckDelay) { … }
TEST_F(QuicSentPacketManagerTest, IgnorePeerMaxAckDelayDuringHandshake) { … }
TEST_F(QuicSentPacketManagerTest, BuildAckFrequencyFrameWithSRTT) { … }
TEST_F(QuicSentPacketManagerTest, SetInitialRtt) { … }
TEST_F(QuicSentPacketManagerTest, GetAvailableCongestionWindow) { … }
TEST_F(QuicSentPacketManagerTest, EcnCountsAreStored) { … }
TEST_F(QuicSentPacketManagerTest, EcnCountsReceived) { … }
TEST_F(QuicSentPacketManagerTest, PeerDecrementsEcnCounts) { … }
TEST_F(QuicSentPacketManagerTest, TooManyEcnCountsReported) { … }
TEST_F(QuicSentPacketManagerTest, PeerReportsWrongCodepoint) { … }
TEST_F(QuicSentPacketManagerTest, TooFewEcnCountsReported) { … }
TEST_F(QuicSentPacketManagerTest,
EcnCountsNotValidatedIfLargestAckedUnchanged) { … }
TEST_F(QuicSentPacketManagerTest, EcnAckedButNoMarksReported) { … }
}
}
}