OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 // Don't send missing packet 2. | 2217 // Don't send missing packet 2. |
2218 ProcessFecPacket(6, 1, false, kEntropyFlag, NULL); | 2218 ProcessFecPacket(6, 1, false, kEntropyFlag, NULL); |
2219 ProcessFecProtectedPacket(3, false, kEntropyFlag); | 2219 ProcessFecProtectedPacket(3, false, kEntropyFlag); |
2220 ProcessFecProtectedPacket(4, false, kEntropyFlag); | 2220 ProcessFecProtectedPacket(4, false, kEntropyFlag); |
2221 ProcessFecProtectedPacket(5, true, !kEntropyFlag); | 2221 ProcessFecProtectedPacket(5, true, !kEntropyFlag); |
2222 // Ensure entropy is not revived for the missing packet. | 2222 // Ensure entropy is not revived for the missing packet. |
2223 EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2)); | 2223 EXPECT_EQ(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 2)); |
2224 EXPECT_NE(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 3)); | 2224 EXPECT_NE(0u, QuicConnectionPeer::ReceivedEntropyHash(&connection_, 3)); |
2225 } | 2225 } |
2226 | 2226 |
| 2227 TEST_P(QuicConnectionTest, TLP) { |
| 2228 QuicSentPacketManagerPeer::SetMaxTailLossProbes( |
| 2229 QuicConnectionPeer::GetSentPacketManager(&connection_), 1); |
| 2230 |
| 2231 SendStreamDataToPeer(3, "foo", 0, !kFin, NULL); |
| 2232 EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked); |
| 2233 QuicTime retransmission_time = |
| 2234 connection_.GetRetransmissionAlarm()->deadline(); |
| 2235 EXPECT_NE(QuicTime::Zero(), retransmission_time); |
| 2236 |
| 2237 EXPECT_EQ(1u, writer_->header().packet_sequence_number); |
| 2238 // Simulate the retransmission alarm firing and sending a tlp, |
| 2239 // so send algorithm's OnRetransmissionTimeout is not called. |
| 2240 clock_.AdvanceTime(retransmission_time.Subtract(clock_.Now())); |
| 2241 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 2u, _, _)); |
| 2242 connection_.GetRetransmissionAlarm()->Fire(); |
| 2243 EXPECT_EQ(2u, writer_->header().packet_sequence_number); |
| 2244 // We do not raise the high water mark yet. |
| 2245 EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked); |
| 2246 } |
| 2247 |
2227 TEST_P(QuicConnectionTest, RTO) { | 2248 TEST_P(QuicConnectionTest, RTO) { |
2228 QuicTime default_retransmission_time = clock_.ApproximateNow().Add( | 2249 QuicTime default_retransmission_time = clock_.ApproximateNow().Add( |
2229 DefaultRetransmissionTime()); | 2250 DefaultRetransmissionTime()); |
2230 SendStreamDataToPeer(3, "foo", 0, !kFin, NULL); | 2251 SendStreamDataToPeer(3, "foo", 0, !kFin, NULL); |
2231 EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked); | 2252 EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked); |
2232 | 2253 |
2233 EXPECT_EQ(1u, writer_->header().packet_sequence_number); | 2254 EXPECT_EQ(1u, writer_->header().packet_sequence_number); |
2234 EXPECT_EQ(default_retransmission_time, | 2255 EXPECT_EQ(default_retransmission_time, |
2235 connection_.GetRetransmissionAlarm()->deadline()); | 2256 connection_.GetRetransmissionAlarm()->deadline()); |
2236 // Simulate the retransmission alarm firing. | 2257 // Simulate the retransmission alarm firing. |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3967 QuicBlockedFrame blocked; | 3988 QuicBlockedFrame blocked; |
3968 blocked.stream_id = 3; | 3989 blocked.stream_id = 3; |
3969 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3990 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3970 ProcessFramePacket(QuicFrame(&blocked)); | 3991 ProcessFramePacket(QuicFrame(&blocked)); |
3971 EXPECT_TRUE(ack_alarm->IsSet()); | 3992 EXPECT_TRUE(ack_alarm->IsSet()); |
3972 } | 3993 } |
3973 | 3994 |
3974 } // namespace | 3995 } // namespace |
3975 } // namespace test | 3996 } // namespace test |
3976 } // namespace net | 3997 } // namespace net |
OLD | NEW |