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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); | 95 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); |
96 manager_.SetNetworkChangeVisitor(network_change_visitor_.get()); | 96 manager_.SetNetworkChangeVisitor(network_change_visitor_.get()); |
97 | 97 |
98 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) | 98 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) |
99 .Times(AnyNumber()); | 99 .Times(AnyNumber()); |
100 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) | 100 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) |
101 .Times(AnyNumber()) | 101 .Times(AnyNumber()) |
102 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 102 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
103 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); | 103 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); |
104 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); | 104 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); |
| 105 EXPECT_CALL(*network_change_visitor_, OnPathMtuIncreased(1000)) |
| 106 .Times(AnyNumber()); |
105 } | 107 } |
106 | 108 |
107 ~QuicSentPacketManagerTest() override { | 109 ~QuicSentPacketManagerTest() override { |
108 STLDeleteElements(&packets_); | 110 STLDeleteElements(&packets_); |
109 } | 111 } |
110 | 112 |
111 QuicByteCount BytesInFlight() { | 113 QuicByteCount BytesInFlight() { |
112 return QuicSentPacketManagerPeer::GetBytesInFlight(&manager_); | 114 return QuicSentPacketManagerPeer::GetBytesInFlight(&manager_); |
113 } | 115 } |
114 void VerifyUnackedPackets(QuicPacketNumber* packets, size_t num_packets) { | 116 void VerifyUnackedPackets(QuicPacketNumber* packets, size_t num_packets) { |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, 2); | 1771 QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, 2); |
1770 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); | 1772 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); |
1771 | 1773 |
1772 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE); | 1774 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE); |
1773 | 1775 |
1774 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us()); | 1776 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us()); |
1775 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount()); | 1777 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount()); |
1776 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); | 1778 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); |
1777 } | 1779 } |
1778 | 1780 |
| 1781 TEST_P(QuicSentPacketManagerTest, PathMtuIncreased) { |
| 1782 FLAGS_quic_no_mtu_discovery_ack_listener = true; |
| 1783 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), 1, _, _)) |
| 1784 .Times(1) |
| 1785 .WillOnce(Return(true)); |
| 1786 SerializedPacket packet(kDefaultPathId, 1, PACKET_6BYTE_PACKET_NUMBER, |
| 1787 nullptr, kDefaultLength + 100, 0u, false, false); |
| 1788 manager_.OnPacketSent(&packet, kInvalidPathId, 0, clock_.Now(), |
| 1789 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); |
| 1790 |
| 1791 // Ack the large packet and expect the path MTU to increase. |
| 1792 ExpectAck(1); |
| 1793 EXPECT_CALL(*network_change_visitor_, |
| 1794 OnPathMtuIncreased(kDefaultLength + 100)); |
| 1795 QuicAckFrame ack_frame = InitAckFrame(1); |
| 1796 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1797 } |
| 1798 |
1779 } // namespace | 1799 } // namespace |
1780 } // namespace test | 1800 } // namespace test |
1781 } // namespace net | 1801 } // namespace net |
OLD | NEW |