diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 02:21:42 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 02:21:42 +0000 |
commit | 6ae6e3487233a3564815ceac05c548890e937b5d (patch) | |
tree | 5020a68d4c8729f084016ed001b8845c38b03e7d /net/quic/quic_sent_packet_manager_test.cc | |
parent | df17af527036da14d6a3f292c79f3b811ff53f6d (diff) | |
download | chromium_src-6ae6e3487233a3564815ceac05c548890e937b5d.zip chromium_src-6ae6e3487233a3564815ceac05c548890e937b5d.tar.gz chromium_src-6ae6e3487233a3564815ceac05c548890e937b5d.tar.bz2 |
Land Recent QUIC Changes.
Remove QUIC's accummulated_number_of_lost_packets from the TCP and
InterArrival congestion feedback frames.
This is part of the migration to version 15, and removes a field which
was intended to be used by FEC, but never set to a non-zero value
previously due to a bug in the code.
Merge internal change: 60948757
https://codereview.chromium.org/155723002/
Add stats for lost and spuriously retransmitted packets to
QuicConnectionStats.
Merge internal change: 60932905
https://codereview.chromium.org/149793004/
The MOCK_METHODx usages removed in this CL try to mock either a
non-virtual or not existing method and are thus never called.
Please look carefully at each deletion. Instead of deleting, the right
fix might be:
- Fix spelling or signature to actually overwrite a method in the base
class
- Make the method in the base class virtual
- This is a currently unused mock intended to mock a non-virtual method
via template injection and it should be left alone
Merge internal change: 60910454
https://codereview.chromium.org/153093006/
Cleanup: Remove inclusion of base/scoped_ptr.h in files which don't use
scoped_ptr. Testing ensures that these inclusions don't have transitive
dependencies.
Merge internal change: 60858913
https://codereview.chromium.org/155683002/
Change QUIC's GetRetransmissionDelay() to exponentially back off from
the minimum value, instead of using the minimum multiple times.
Merge internal change: 60782771
https://codereview.chromium.org/155673002/
QUIC_VERSION_14 introduced. Add byte_offset to RST_STREAM_FRAME, add
version checks for WINDOW_UPDATE and BLOCKED frames. None of these
additions used yet.
Merge internal change: 60780039
https://codereview.chromium.org/155623003/
(minor) QUIC: Initialize members in QUIC frame constructors.
Merge internal change: 60677390
https://codereview.chromium.org/150663004/
Add WINDOW_UPDATE and BLOCKED frames to QUIC. Not yet used.
Adds the frame types, and matching framer methods for reading/writing
them. The framer visitor methods to handle the new frames just return
true and ignore them for now.
Merge internal change: 60646513
https://codereview.chromium.org/130463004/
QUIC cleanup to remove the helper which provided
GetNextPacketSequenceNumber to QuicSentPacketManager and instead let the
connection use that information directly.
Merge internal change: 60587367
https://codereview.chromium.org/132503007/
R=rch@chromium.org
Review URL: https://codereview.chromium.org/149113005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/quic_sent_packet_manager_test.cc')
-rw-r--r-- | net/quic/quic_sent_packet_manager_test.cc | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc index ee6f949..bf5e031 100644 --- a/net/quic/quic_sent_packet_manager_test.cc +++ b/net/quic/quic_sent_packet_manager_test.cc @@ -19,15 +19,10 @@ namespace net { namespace test { namespace { -class MockHelper : public QuicSentPacketManager::HelperInterface { - public: - MOCK_METHOD0(GetNextPacketSequenceNumber, QuicPacketSequenceNumber()); -}; - class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> { protected: QuicSentPacketManagerTest() - : manager_(true, &helper_, &clock_, kFixRate), + : manager_(true, &clock_, &stats_, kFixRate), send_algorithm_(new StrictMock<MockSendAlgorithm>) { QuicSentPacketManagerPeer::SetSendAlgorithm(&manager_, send_algorithm_); // Disable tail loss probes for most tests. @@ -36,7 +31,7 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> { clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); } - ~QuicSentPacketManagerTest() { + virtual ~QuicSentPacketManagerTest() { STLDeleteElements(&packets_); } @@ -170,10 +165,10 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> { pending.transmission_type, HAS_RETRANSMITTABLE_DATA); } - testing::StrictMock<MockHelper> helper_; QuicSentPacketManager manager_; vector<QuicPacket*> packets_; MockClock clock_; + QuicConnectionStats stats_; MockSendAlgorithm* send_algorithm_; }; @@ -239,6 +234,7 @@ TEST_F(QuicSentPacketManagerTest, RetransmitThenAckBeforeSend) { // No unacked packets remain. VerifyUnackedPackets(NULL, 0); VerifyRetransmittablePackets(NULL, 0); + EXPECT_EQ(0u, stats_.packets_spuriously_retransmitted); } TEST_F(QuicSentPacketManagerTest, RetransmitThenAckPrevious) { @@ -263,6 +259,7 @@ TEST_F(QuicSentPacketManagerTest, RetransmitThenAckPrevious) { // Verify that the retransmission alarm would not fire, // since there is no retransmittable data outstanding. EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime()); + EXPECT_EQ(1u, stats_.packets_spuriously_retransmitted); } TEST_F(QuicSentPacketManagerTest, RetransmitThenAckPreviousThenNackRetransmit) { @@ -386,6 +383,7 @@ TEST_F(QuicSentPacketManagerTest, RetransmitTwiceThenAckFirst) { VerifyUnackedPackets(NULL, 0); EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); + EXPECT_EQ(1u, stats_.packets_spuriously_retransmitted); } TEST_F(QuicSentPacketManagerTest, TruncatedAck) { @@ -460,8 +458,7 @@ TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) { } TEST_F(QuicSentPacketManagerTest, GetLeastUnackedSentPacket) { - EXPECT_CALL(helper_, GetNextPacketSequenceNumber()).WillOnce(Return(1u)); - EXPECT_EQ(1u, manager_.GetLeastUnackedSentPacket()); + EXPECT_EQ(0u, manager_.GetLeastUnackedSentPacket()); } TEST_F(QuicSentPacketManagerTest, GetLeastUnackedSentPacketUnacked) { @@ -483,8 +480,7 @@ TEST_F(QuicSentPacketManagerTest, GetLeastUnackedSentPacketDiscardUnacked) { manager_.OnSerializedPacket(serialized_packet); manager_.DiscardUnackedPacket(1u); - EXPECT_CALL(helper_, GetNextPacketSequenceNumber()).WillOnce(Return(2u)); - EXPECT_EQ(2u, manager_.GetLeastUnackedSentPacket()); + EXPECT_EQ(0u, manager_.GetLeastUnackedSentPacket()); } TEST_F(QuicSentPacketManagerTest, GetLeastUnackedPacketAndDiscard) { @@ -576,6 +572,7 @@ TEST_F(QuicSentPacketManagerTest, NackRetransmit1Packet) { QuicSentPacketManagerPeer::GetPendingRetransmissionCount(&manager_)); EXPECT_EQ(i, QuicSentPacketManagerPeer::GetNackCount(&manager_, 1)); } + EXPECT_EQ(1u, stats_.packets_lost); } // A stretch ack is an ack that covers more than 1 packet of previously @@ -601,6 +598,7 @@ TEST_F(QuicSentPacketManagerTest, NackRetransmit1PacketWith1StretchAck) { EXPECT_EQ( 1u, QuicSentPacketManagerPeer::GetPendingRetransmissionCount(&manager_)); EXPECT_EQ(3u, QuicSentPacketManagerPeer::GetNackCount(&manager_, 1)); + EXPECT_EQ(1u, stats_.packets_lost); } // Ack a packet 3 packets ahead, causing a retransmit. @@ -627,6 +625,7 @@ TEST_F(QuicSentPacketManagerTest, NackRetransmit1PacketSingleAck) { EXPECT_EQ( 1u, QuicSentPacketManagerPeer::GetPendingRetransmissionCount(&manager_)); EXPECT_EQ(3u, QuicSentPacketManagerPeer::GetNackCount(&manager_, 1)); + EXPECT_EQ(1u, stats_.packets_lost); } TEST_F(QuicSentPacketManagerTest, EarlyRetransmit1Packet) { @@ -650,6 +649,7 @@ TEST_F(QuicSentPacketManagerTest, EarlyRetransmit1Packet) { EXPECT_EQ( 1u, QuicSentPacketManagerPeer::GetPendingRetransmissionCount(&manager_)); EXPECT_EQ(1u, QuicSentPacketManagerPeer::GetNackCount(&manager_, 1)); + EXPECT_EQ(1u, stats_.packets_lost); } TEST_F(QuicSentPacketManagerTest, EarlyRetransmitAllPackets) { @@ -676,6 +676,7 @@ TEST_F(QuicSentPacketManagerTest, EarlyRetransmitAllPackets) { EXPECT_EQ( 4u, QuicSentPacketManagerPeer::GetPendingRetransmissionCount(&manager_)); EXPECT_EQ(4u, QuicSentPacketManagerPeer::GetNackCount(&manager_, 1)); + EXPECT_EQ(4u, stats_.packets_lost); } TEST_F(QuicSentPacketManagerTest, NackRetransmit2Packets) { @@ -887,6 +888,8 @@ TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeout) { EXPECT_FALSE(manager_.HasPendingRetransmissions()); EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); + EXPECT_EQ(2u, stats_.tlp_count); + EXPECT_EQ(0u, stats_.rto_count); } TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) { @@ -915,6 +918,8 @@ TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) { EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); manager_.OnRetransmissionTimeout(); EXPECT_TRUE(manager_.HasPendingRetransmissions()); + EXPECT_EQ(2u, stats_.tlp_count); + EXPECT_EQ(1u, stats_.rto_count); } TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeout) { @@ -1137,11 +1142,21 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeRTO) { } TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) { + SendDataPacket(1); EXPECT_CALL(*send_algorithm_, RetransmissionDelay()) - .WillOnce(Return(QuicTime::Delta::FromMilliseconds(1))); + .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1))); + QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(200); - EXPECT_EQ(QuicTime::Delta::FromMilliseconds(200), - QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); + // If the delay is smaller than the min, ensure it exponentially backs off + // from the min. + for (int i = 0; i < 5; ++i) { + EXPECT_EQ(delay, + QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); + delay = delay.Add(delay); + EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); + manager_.OnRetransmissionTimeout(); + RetransmitNextPacket(i + 2); + } } TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMax) { |