| 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/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
| 9 #include "net/quic/test_tools/quic_config_peer.h" | 9 #include "net/quic/test_tools/quic_config_peer.h" |
| 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| (...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 | 1637 |
| 1638 EXPECT_EQ(kMinSocketReceiveBuffer, | 1638 EXPECT_EQ(kMinSocketReceiveBuffer, |
| 1639 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1639 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
| 1640 | 1640 |
| 1641 // Ensure the smaller send window only allows 16 packets to be sent. | 1641 // Ensure the smaller send window only allows 16 packets to be sent. |
| 1642 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { | 1642 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { |
| 1643 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) | 1643 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) |
| 1644 .WillOnce(Return(QuicTime::Delta::Zero())); | 1644 .WillOnce(Return(QuicTime::Delta::Zero())); |
| 1645 EXPECT_EQ(QuicTime::Delta::Zero(), | 1645 EXPECT_EQ(QuicTime::Delta::Zero(), |
| 1646 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); | 1646 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); |
| 1647 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, | 1647 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1024, |
| 1648 1024, HAS_RETRANSMITTABLE_DATA)) | 1648 HAS_RETRANSMITTABLE_DATA)) |
| 1649 .WillOnce(Return(true)); | 1649 .WillOnce(Return(true)); |
| 1650 SerializedPacket packet(CreatePacket(i, true)); | 1650 SerializedPacket packet(CreatePacket(i, true)); |
| 1651 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, | 1651 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, NOT_RETRANSMISSION, |
| 1652 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); | 1652 HAS_RETRANSMITTABLE_DATA); |
| 1653 } | 1653 } |
| 1654 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) | 1654 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) |
| 1655 .WillOnce(Return(QuicTime::Delta::Infinite())); | 1655 .WillOnce(Return(QuicTime::Delta::Infinite())); |
| 1656 EXPECT_EQ(QuicTime::Delta::Infinite(), | 1656 EXPECT_EQ(QuicTime::Delta::Infinite(), |
| 1657 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); | 1657 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) { | 1660 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) { |
| 1661 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1661 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
| 1662 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1662 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 | 1705 |
| 1706 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); | 1706 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); |
| 1707 manager_.ResumeConnectionState(cached_network_params, false); | 1707 manager_.ResumeConnectionState(cached_network_params, false); |
| 1708 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1708 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
| 1709 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1709 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
| 1710 } | 1710 } |
| 1711 | 1711 |
| 1712 } // namespace | 1712 } // namespace |
| 1713 } // namespace test | 1713 } // namespace test |
| 1714 } // namespace net | 1714 } // namespace net |
| OLD | NEW |