| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Disable tail loss probes for most tests. | 28 // Disable tail loss probes for most tests. |
| 29 QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 0); | 29 QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 0); |
| 30 // Advance the time 1s so the send times are never QuicTime::Zero. | 30 // Advance the time 1s so the send times are never QuicTime::Zero. |
| 31 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); | 31 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual ~QuicSentPacketManagerTest() { | 34 virtual ~QuicSentPacketManagerTest() { |
| 35 STLDeleteElements(&packets_); | 35 STLDeleteElements(&packets_); |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void SetUp() { |
| 39 // Ack handling requests a smoothed rtt for loss detection. |
| 40 EXPECT_CALL(*send_algorithm_, SmoothedRtt()) |
| 41 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1))); |
| 42 } |
| 43 |
| 38 void VerifyUnackedPackets(QuicPacketSequenceNumber* packets, | 44 void VerifyUnackedPackets(QuicPacketSequenceNumber* packets, |
| 39 size_t num_packets) { | 45 size_t num_packets) { |
| 40 if (num_packets == 0) { | 46 if (num_packets == 0) { |
| 41 EXPECT_FALSE(manager_.HasUnackedPackets()); | 47 EXPECT_FALSE(manager_.HasUnackedPackets()); |
| 42 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetNumRetransmittablePackets( | 48 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetNumRetransmittablePackets( |
| 43 &manager_)); | 49 &manager_)); |
| 44 return; | 50 return; |
| 45 } | 51 } |
| 46 | 52 |
| 47 EXPECT_TRUE(manager_.HasUnackedPackets()); | 53 EXPECT_TRUE(manager_.HasUnackedPackets()); |
| (...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 delay = delay.Add(delay); | 1278 delay = delay.Add(delay); |
| 1273 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1279 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
| 1274 manager_.OnRetransmissionTimeout(); | 1280 manager_.OnRetransmissionTimeout(); |
| 1275 RetransmitNextPacket(i + 2); | 1281 RetransmitNextPacket(i + 2); |
| 1276 } | 1282 } |
| 1277 } | 1283 } |
| 1278 | 1284 |
| 1279 } // namespace | 1285 } // namespace |
| 1280 } // namespace test | 1286 } // namespace test |
| 1281 } // namespace net | 1287 } // namespace net |
| OLD | NEW |