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" |
11 #include "net/quic/congestion_control/receive_algorithm_interface.h" | 11 #include "net/quic/congestion_control/receive_algorithm_interface.h" |
12 #include "net/quic/congestion_control/send_algorithm_interface.h" | 12 #include "net/quic/congestion_control/send_algorithm_interface.h" |
13 #include "net/quic/crypto/null_encrypter.h" | 13 #include "net/quic/crypto/null_encrypter.h" |
14 #include "net/quic/crypto/quic_decrypter.h" | 14 #include "net/quic/crypto/quic_decrypter.h" |
15 #include "net/quic/crypto/quic_encrypter.h" | 15 #include "net/quic/crypto/quic_encrypter.h" |
16 #include "net/quic/crypto/quic_random.h" | |
17 #include "net/quic/quic_protocol.h" | 16 #include "net/quic/quic_protocol.h" |
18 #include "net/quic/quic_sent_packet_manager.h" | 17 #include "net/quic/quic_sent_packet_manager.h" |
19 #include "net/quic/quic_utils.h" | 18 #include "net/quic/quic_utils.h" |
20 #include "net/quic/test_tools/mock_clock.h" | 19 #include "net/quic/test_tools/mock_clock.h" |
21 #include "net/quic/test_tools/mock_random.h" | 20 #include "net/quic/test_tools/mock_random.h" |
22 #include "net/quic/test_tools/quic_connection_peer.h" | 21 #include "net/quic/test_tools/quic_connection_peer.h" |
23 #include "net/quic/test_tools/quic_framer_peer.h" | 22 #include "net/quic/test_tools/quic_framer_peer.h" |
24 #include "net/quic/test_tools/quic_packet_creator_peer.h" | 23 #include "net/quic/test_tools/quic_packet_creator_peer.h" |
25 #include "net/quic/test_tools/quic_test_utils.h" | 24 #include "net/quic/test_tools/quic_test_utils.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 TestConnectionHelper::TestAlarm* GetAckAlarm() { | 465 TestConnectionHelper::TestAlarm* GetAckAlarm() { |
467 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 466 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
468 QuicConnectionPeer::GetAckAlarm(this)); | 467 QuicConnectionPeer::GetAckAlarm(this)); |
469 } | 468 } |
470 | 469 |
471 TestConnectionHelper::TestAlarm* GetRetransmissionAlarm() { | 470 TestConnectionHelper::TestAlarm* GetRetransmissionAlarm() { |
472 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 471 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
473 QuicConnectionPeer::GetRetransmissionAlarm(this)); | 472 QuicConnectionPeer::GetRetransmissionAlarm(this)); |
474 } | 473 } |
475 | 474 |
476 TestConnectionHelper::TestAlarm* GetAbandonFecAlarm() { | |
477 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | |
478 QuicConnectionPeer::GetAbandonFecAlarm(this)); | |
479 } | |
480 | |
481 TestConnectionHelper::TestAlarm* GetSendAlarm() { | 475 TestConnectionHelper::TestAlarm* GetSendAlarm() { |
482 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 476 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
483 QuicConnectionPeer::GetSendAlarm(this)); | 477 QuicConnectionPeer::GetSendAlarm(this)); |
484 } | 478 } |
485 | 479 |
486 TestConnectionHelper::TestAlarm* GetResumeWritesAlarm() { | 480 TestConnectionHelper::TestAlarm* GetResumeWritesAlarm() { |
487 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 481 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
488 QuicConnectionPeer::GetResumeWritesAlarm(this)); | 482 QuicConnectionPeer::GetResumeWritesAlarm(this)); |
489 } | 483 } |
490 | 484 |
491 TestConnectionHelper::TestAlarm* GetTimeoutAlarm() { | 485 TestConnectionHelper::TestAlarm* GetTimeoutAlarm() { |
492 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 486 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
493 QuicConnectionPeer::GetTimeoutAlarm(this)); | 487 QuicConnectionPeer::GetTimeoutAlarm(this)); |
494 } | 488 } |
495 | 489 |
496 using QuicConnection::SelectMutualVersion; | 490 using QuicConnection::SelectMutualVersion; |
497 | 491 |
498 private: | 492 private: |
499 TestConnectionHelper* helper_; | 493 TestConnectionHelper* helper_; |
500 TestPacketWriter* writer_; | 494 TestPacketWriter* writer_; |
501 | 495 |
502 DISALLOW_COPY_AND_ASSIGN(TestConnection); | 496 DISALLOW_COPY_AND_ASSIGN(TestConnection); |
503 }; | 497 }; |
504 | 498 |
505 class QuicConnectionTest : public ::testing::TestWithParam<bool> { | 499 class QuicConnectionTest : public ::testing::TestWithParam<bool> { |
506 protected: | 500 protected: |
507 QuicConnectionTest() | 501 QuicConnectionTest() |
508 : guid_(42), | 502 : guid_(42), |
509 framer_(QuicSupportedVersions(), QuicTime::Zero(), false), | 503 framer_(QuicSupportedVersions(), QuicTime::Zero(), false), |
510 creator_(guid_, &framer_, QuicRandom::GetInstance(), false), | 504 creator_(guid_, &framer_, &random_generator_, false), |
511 send_algorithm_(new StrictMock<MockSendAlgorithm>), | 505 send_algorithm_(new StrictMock<MockSendAlgorithm>), |
512 helper_(new TestConnectionHelper(&clock_, &random_generator_)), | 506 helper_(new TestConnectionHelper(&clock_, &random_generator_)), |
513 writer_(new TestPacketWriter()), | 507 writer_(new TestPacketWriter()), |
514 connection_(guid_, IPEndPoint(), helper_.get(), writer_.get(), false), | 508 connection_(guid_, IPEndPoint(), helper_.get(), writer_.get(), false), |
515 frame1_(1, false, 0, MakeIOVector(data1)), | 509 frame1_(1, false, 0, MakeIOVector(data1)), |
516 frame2_(1, false, 3, MakeIOVector(data2)), | 510 frame2_(1, false, 3, MakeIOVector(data2)), |
517 accept_packet_(true) { | 511 accept_packet_(true) { |
518 connection_.set_visitor(&visitor_); | 512 connection_.set_visitor(&visitor_); |
519 connection_.SetSendAlgorithm(send_algorithm_); | 513 connection_.SetSendAlgorithm(send_algorithm_); |
520 framer_.set_received_entropy_calculator(&entropy_calculator_); | 514 framer_.set_received_entropy_calculator(&entropy_calculator_); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 QuicPacketSequenceNumber num_packets = 256 * 2 + 1; | 907 QuicPacketSequenceNumber num_packets = 256 * 2 + 1; |
914 for (QuicPacketSequenceNumber i = 0; i < num_packets; ++i) { | 908 for (QuicPacketSequenceNumber i = 0; i < num_packets; ++i) { |
915 SendStreamDataToPeer(1, "foo", i * 3, !kFin, NULL); | 909 SendStreamDataToPeer(1, "foo", i * 3, !kFin, NULL); |
916 } | 910 } |
917 | 911 |
918 QuicAckFrame frame(num_packets, QuicTime::Zero(), 1); | 912 QuicAckFrame frame(num_packets, QuicTime::Zero(), 1); |
919 // Create an ack with 256 nacks, none adjacent to one another. | 913 // Create an ack with 256 nacks, none adjacent to one another. |
920 for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) { | 914 for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) { |
921 frame.received_info.missing_packets.insert(i * 2); | 915 frame.received_info.missing_packets.insert(i * 2); |
922 } | 916 } |
| 917 frame.received_info.entropy_hash = 0; |
923 EXPECT_CALL(entropy_calculator_, | 918 EXPECT_CALL(entropy_calculator_, |
924 EntropyHash(511)).WillOnce(testing::Return(0)); | 919 EntropyHash(511)).WillOnce(testing::Return(0)); |
925 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(256); | 920 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(256); |
926 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(10); | 921 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(10); |
927 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(10); | 922 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(10); |
928 ProcessAckPacket(&frame); | 923 ProcessAckPacket(&frame); |
929 | 924 |
930 QuicReceivedPacketManager* received_packet_manager = | 925 QuicReceivedPacketManager* received_packet_manager = |
931 QuicConnectionPeer::GetReceivedPacketManager(&connection_); | 926 QuicConnectionPeer::GetReceivedPacketManager(&connection_); |
932 // A truncated ack will not have the true largest observed. | 927 // A truncated ack will not have the true largest observed. |
933 EXPECT_GT(num_packets, | 928 EXPECT_GT(num_packets, |
934 received_packet_manager->peer_largest_observed_packet()); | 929 received_packet_manager->peer_largest_observed_packet()); |
935 | 930 |
936 frame.received_info.missing_packets.erase(192); | 931 frame.received_info.missing_packets.erase(192); |
| 932 frame.received_info.entropy_hash = 2; |
937 | 933 |
938 // Removing one missing packet allows us to ack 192 and one more range. | 934 // Removing one missing packet allows us to ack 192 and one more range. |
939 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2); | 935 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2); |
940 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(10); | 936 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(10); |
941 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(10); | 937 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(10); |
942 ProcessAckPacket(&frame); | 938 ProcessAckPacket(&frame); |
943 EXPECT_EQ(num_packets, | 939 EXPECT_EQ(num_packets, |
944 received_packet_manager->peer_largest_observed_packet()); | 940 received_packet_manager->peer_largest_observed_packet()); |
945 } | 941 } |
946 | 942 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 | 1013 |
1018 ProcessAckPacket(&frame2); | 1014 ProcessAckPacket(&frame2); |
1019 // Now if the peer sends an ack which still reports the retransmitted packet | 1015 // Now if the peer sends an ack which still reports the retransmitted packet |
1020 // as missing, then that will count as a packet which instigates an ack. | 1016 // as missing, then that will count as a packet which instigates an ack. |
1021 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)); | 1017 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)); |
1022 ProcessAckPacket(&frame2); | 1018 ProcessAckPacket(&frame2); |
1023 ProcessAckPacket(&frame2); | 1019 ProcessAckPacket(&frame2); |
1024 | 1020 |
1025 // But an ack with no missing packets will not send an ack. | 1021 // But an ack with no missing packets will not send an ack. |
1026 frame2.received_info.missing_packets.clear(); | 1022 frame2.received_info.missing_packets.clear(); |
| 1023 frame2.received_info.entropy_hash = |
| 1024 QuicConnectionPeer::GetSentEntropyHash(&connection_, retransmission); |
1027 ProcessAckPacket(&frame2); | 1025 ProcessAckPacket(&frame2); |
1028 ProcessAckPacket(&frame2); | 1026 ProcessAckPacket(&frame2); |
1029 } | 1027 } |
1030 | 1028 |
1031 TEST_F(QuicConnectionTest, LeastUnackedLower) { | 1029 TEST_F(QuicConnectionTest, LeastUnackedLower) { |
1032 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1030 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1033 | 1031 |
1034 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL); | 1032 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL); |
1035 SendStreamDataToPeer(1, "bar", 3, !kFin, NULL); | 1033 SendStreamDataToPeer(1, "bar", 3, !kFin, NULL); |
1036 SendStreamDataToPeer(1, "eep", 6, !kFin, NULL); | 1034 SendStreamDataToPeer(1, "eep", 6, !kFin, NULL); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 TEST_F(QuicConnectionTest, AbandonFECFromCongestionWindow) { | 1287 TEST_F(QuicConnectionTest, AbandonFECFromCongestionWindow) { |
1290 connection_.options()->max_packets_per_fec_group = 1; | 1288 connection_.options()->max_packets_per_fec_group = 1; |
1291 // 1 Data and 1 FEC packet. | 1289 // 1 Data and 1 FEC packet. |
1292 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 1290 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
1293 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 1291 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
1294 | 1292 |
1295 const QuicTime::Delta retransmission_time = | 1293 const QuicTime::Delta retransmission_time = |
1296 QuicTime::Delta::FromMilliseconds(5000); | 1294 QuicTime::Delta::FromMilliseconds(5000); |
1297 clock_.AdvanceTime(retransmission_time); | 1295 clock_.AdvanceTime(retransmission_time); |
1298 | 1296 |
1299 // Abandon FEC packet. | 1297 // Abandon FEC packet and data packet. |
1300 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(1); | 1298 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2); |
| 1299 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); |
| 1300 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
1301 EXPECT_CALL(visitor_, OnCanWrite()); | 1301 EXPECT_CALL(visitor_, OnCanWrite()); |
1302 connection_.OnAbandonFecTimeout(); | 1302 connection_.OnRetransmissionTimeout(); |
1303 } | 1303 } |
1304 | 1304 |
1305 TEST_F(QuicConnectionTest, DontAbandonAckedFEC) { | 1305 TEST_F(QuicConnectionTest, DontAbandonAckedFEC) { |
1306 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1306 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1307 connection_.options()->max_packets_per_fec_group = 1; | 1307 connection_.options()->max_packets_per_fec_group = 1; |
1308 | 1308 |
1309 // 1 Data and 1 FEC packet. | 1309 // 1 Data and 1 FEC packet. |
1310 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6); | 1310 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6); |
1311 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 1311 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
1312 // Send some more data afterwards to ensure early retransmit doesn't trigger. | 1312 // Send some more data afterwards to ensure early retransmit doesn't trigger. |
(...skipping 10 matching lines...) Expand all Loading... |
1323 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); | 1323 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
1324 | 1324 |
1325 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); | 1325 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); |
1326 | 1326 |
1327 ProcessAckPacket(&ack_fec); | 1327 ProcessAckPacket(&ack_fec); |
1328 | 1328 |
1329 clock_.AdvanceTime(DefaultRetransmissionTime()); | 1329 clock_.AdvanceTime(DefaultRetransmissionTime()); |
1330 | 1330 |
1331 // Don't abandon the acked FEC packet, but it will abandon 2 the subsequent | 1331 // Don't abandon the acked FEC packet, but it will abandon 2 the subsequent |
1332 // FEC packets. | 1332 // FEC packets. |
1333 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2); | 1333 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(5); |
1334 connection_.GetAbandonFecAlarm()->Fire(); | 1334 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); |
| 1335 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(3); |
| 1336 connection_.GetRetransmissionAlarm()->Fire(); |
| 1337 } |
| 1338 |
| 1339 TEST_F(QuicConnectionTest, DontAbandonAllFEC) { |
| 1340 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 1341 connection_.options()->max_packets_per_fec_group = 1; |
| 1342 |
| 1343 // 1 Data and 1 FEC packet. |
| 1344 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6); |
| 1345 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
| 1346 // Send some more data afterwards to ensure early retransmit doesn't trigger. |
| 1347 connection_.SendStreamDataWithString(1, "foo", 3, !kFin, NULL); |
| 1348 // Advance the time so not all the FEC packets are abandoned. |
| 1349 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1)); |
| 1350 connection_.SendStreamDataWithString(1, "foo", 6, !kFin, NULL); |
| 1351 |
| 1352 QuicAckFrame ack_fec(5, QuicTime::Zero(), 1); |
| 1353 // Ack all data packets, but no fec packets. |
| 1354 ack_fec.received_info.missing_packets.insert(2); |
| 1355 ack_fec.received_info.missing_packets.insert(4); |
| 1356 ack_fec.received_info.entropy_hash = |
| 1357 QuicConnectionPeer::GetSentEntropyHash(&connection_, 5) ^ |
| 1358 QuicConnectionPeer::GetSentEntropyHash(&connection_, 4) ^ |
| 1359 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^ |
| 1360 QuicConnectionPeer::GetSentEntropyHash(&connection_, 2) ^ |
| 1361 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
| 1362 |
| 1363 // Lose the first FEC packet and ack the three data packets. |
| 1364 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(3); |
| 1365 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
| 1366 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); |
| 1367 ProcessAckPacket(&ack_fec); |
| 1368 |
| 1369 clock_.AdvanceTime(DefaultRetransmissionTime().Subtract( |
| 1370 QuicTime::Delta::FromMilliseconds(1))); |
| 1371 |
| 1372 // Don't abandon the acked FEC packet, but it will abandon 1 of the subsequent |
| 1373 // FEC packets. |
| 1374 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(4, _)); |
| 1375 connection_.GetRetransmissionAlarm()->Fire(); |
| 1376 |
| 1377 // Ensure the connection's alarm is still set, in order to abandon the third |
| 1378 // FEC packet. |
| 1379 EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet()); |
1335 } | 1380 } |
1336 | 1381 |
1337 TEST_F(QuicConnectionTest, FramePacking) { | 1382 TEST_F(QuicConnectionTest, FramePacking) { |
1338 // Block the connection. | 1383 // Block the connection. |
1339 connection_.GetSendAlarm()->Set( | 1384 connection_.GetSendAlarm()->Set( |
1340 clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(1))); | 1385 clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(1))); |
1341 | 1386 |
1342 // Send an ack and two stream frames in 1 packet by queueing them. | 1387 // Send an ack and two stream frames in 1 packet by queueing them. |
1343 connection_.SendAck(); | 1388 connection_.SendAck(); |
1344 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll( | 1389 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll( |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); | 1691 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
1647 // The first nack should trigger a fast retransmission, but we'll be | 1692 // The first nack should trigger a fast retransmission, but we'll be |
1648 // write blocked, so the packet will be queued. | 1693 // write blocked, so the packet will be queued. |
1649 writer_->set_blocked(true); | 1694 writer_->set_blocked(true); |
1650 | 1695 |
1651 ProcessAckPacket(&nack_two); | 1696 ProcessAckPacket(&nack_two); |
1652 EXPECT_EQ(1u, connection_.NumQueuedPackets()); | 1697 EXPECT_EQ(1u, connection_.NumQueuedPackets()); |
1653 | 1698 |
1654 // Now, ack the previous transmission. | 1699 // Now, ack the previous transmission. |
1655 QuicAckFrame ack_all(3, QuicTime::Zero(), 0); | 1700 QuicAckFrame ack_all(3, QuicTime::Zero(), 0); |
1656 nack_two.received_info.entropy_hash = | 1701 ack_all.received_info.entropy_hash = |
1657 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3); | 1702 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3); |
1658 ProcessAckPacket(&ack_all); | 1703 ProcessAckPacket(&ack_all); |
1659 | 1704 |
1660 // Unblock the socket and attempt to send the queued packets. However, | 1705 // Unblock the socket and attempt to send the queued packets. However, |
1661 // since the previous transmission has been acked, we will not | 1706 // since the previous transmission has been acked, we will not |
1662 // send the retransmission. | 1707 // send the retransmission. |
1663 EXPECT_CALL(*send_algorithm_, | 1708 EXPECT_CALL(*send_algorithm_, |
1664 OnPacketSent(_, _, _, _, _)).Times(0); | 1709 OnPacketSent(_, _, _, _, _)).Times(0); |
1665 | 1710 |
1666 writer_->set_blocked(false); | 1711 writer_->set_blocked(false); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 EXPECT_EQ(5u, last_packet); | 1833 EXPECT_EQ(5u, last_packet); |
1789 SendStreamDataToPeer(3, "foo", 3, !kFin, &last_packet); // Packet 6 | 1834 SendStreamDataToPeer(3, "foo", 3, !kFin, &last_packet); // Packet 6 |
1790 EXPECT_EQ(6u, last_packet); | 1835 EXPECT_EQ(6u, last_packet); |
1791 | 1836 |
1792 // Client will ack packets 1, 2, [!3], 4, 5. | 1837 // Client will ack packets 1, 2, [!3], 4, 5. |
1793 QuicAckFrame frame1(5, QuicTime::Zero(), 0); | 1838 QuicAckFrame frame1(5, QuicTime::Zero(), 0); |
1794 frame1.received_info.missing_packets.insert(3); | 1839 frame1.received_info.missing_packets.insert(3); |
1795 frame1.received_info.entropy_hash = | 1840 frame1.received_info.entropy_hash = |
1796 QuicConnectionPeer::GetSentEntropyHash(&connection_, 5) ^ | 1841 QuicConnectionPeer::GetSentEntropyHash(&connection_, 5) ^ |
1797 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^ | 1842 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^ |
1798 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); | 1843 QuicConnectionPeer::GetSentEntropyHash(&connection_, 2); |
1799 | 1844 |
1800 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1845 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1801 | 1846 |
1802 ProcessAckPacket(&frame1); | 1847 ProcessAckPacket(&frame1); |
1803 | 1848 |
1804 // Now the client implicitly acks 3, and explicitly acks 6. | 1849 // Now the client implicitly acks 3, and explicitly acks 6. |
1805 QuicAckFrame frame2(6, QuicTime::Zero(), 0); | 1850 QuicAckFrame frame2(6, QuicTime::Zero(), 0); |
1806 frame2.received_info.entropy_hash = | 1851 frame2.received_info.entropy_hash = |
1807 QuicConnectionPeer::GetSentEntropyHash(&connection_, 6); | 1852 QuicConnectionPeer::GetSentEntropyHash(&connection_, 6); |
1808 | 1853 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 | 1970 |
1926 connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(0x02)); | 1971 connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(0x02)); |
1927 connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); | 1972 connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); |
1928 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL); | 1973 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL); |
1929 EXPECT_EQ(0x02020202u, final_bytes_of_last_packet()); | 1974 EXPECT_EQ(0x02020202u, final_bytes_of_last_packet()); |
1930 | 1975 |
1931 EXPECT_EQ(default_retransmission_time, | 1976 EXPECT_EQ(default_retransmission_time, |
1932 connection_.GetRetransmissionAlarm()->deadline()); | 1977 connection_.GetRetransmissionAlarm()->deadline()); |
1933 { | 1978 { |
1934 InSequence s; | 1979 InSequence s; |
1935 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); | |
1936 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)); | 1980 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)); |
1937 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); | 1981 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
| 1982 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); |
1938 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, 3, _, RTO_RETRANSMISSION, _)); | 1983 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, 3, _, RTO_RETRANSMISSION, _)); |
1939 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, 4, _, RTO_RETRANSMISSION, _)); | 1984 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, 4, _, RTO_RETRANSMISSION, _)); |
1940 } | 1985 } |
1941 | 1986 |
1942 // Simulate the retransmission alarm firing. | 1987 // Simulate the retransmission alarm firing. |
1943 clock_.AdvanceTime(DefaultRetransmissionTime()); | 1988 clock_.AdvanceTime(DefaultRetransmissionTime()); |
1944 connection_.GetRetransmissionAlarm()->Fire(); | 1989 connection_.GetRetransmissionAlarm()->Fire(); |
1945 | 1990 |
1946 // Packet should have been sent with ENCRYPTION_NONE. | 1991 // Packet should have been sent with ENCRYPTION_NONE. |
1947 EXPECT_EQ(0x01010101u, final_bytes_of_previous_packet()); | 1992 EXPECT_EQ(0x01010101u, final_bytes_of_previous_packet()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 // Ack packets might generate some other packets, which are not | 2168 // Ack packets might generate some other packets, which are not |
2124 // retransmissions. (More ack packets). | 2169 // retransmissions. (More ack packets). |
2125 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) | 2170 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) |
2126 .Times(AnyNumber()); | 2171 .Times(AnyNumber()); |
2127 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NACK_RETRANSMISSION, _)) | 2172 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NACK_RETRANSMISSION, _)) |
2128 .WillOnce(DoAll(SaveArg<1>(&nack_sequence_number), Return(true))); | 2173 .WillOnce(DoAll(SaveArg<1>(&nack_sequence_number), Return(true))); |
2129 QuicAckFrame ack(rto_sequence_number, QuicTime::Zero(), 0); | 2174 QuicAckFrame ack(rto_sequence_number, QuicTime::Zero(), 0); |
2130 // Ack the retransmitted packet. | 2175 // Ack the retransmitted packet. |
2131 ack.received_info.missing_packets.insert(original_sequence_number); | 2176 ack.received_info.missing_packets.insert(original_sequence_number); |
2132 ack.received_info.missing_packets.insert(rto_sequence_number); | 2177 ack.received_info.missing_packets.insert(rto_sequence_number); |
2133 ack.received_info.entropy_hash = QuicConnectionPeer::GetSentEntropyHash( | 2178 ack.received_info.entropy_hash = |
2134 &connection_, rto_sequence_number - 1); | 2179 QuicConnectionPeer::GetSentEntropyHash(&connection_, |
| 2180 rto_sequence_number - 1) ^ |
| 2181 QuicConnectionPeer::GetSentEntropyHash(&connection_, |
| 2182 original_sequence_number); |
2135 for (int i = 0; i < 3; i++) { | 2183 for (int i = 0; i < 3; i++) { |
2136 ProcessAckPacket(&ack); | 2184 ProcessAckPacket(&ack); |
2137 } | 2185 } |
2138 ASSERT_NE(0u, nack_sequence_number); | 2186 ASSERT_NE(0u, nack_sequence_number); |
2139 EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission( | 2187 EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission( |
2140 &connection_, rto_sequence_number)); | 2188 &connection_, rto_sequence_number)); |
2141 ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission( | 2189 ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission( |
2142 &connection_, nack_sequence_number)); | 2190 &connection_, nack_sequence_number)); |
2143 EXPECT_TRUE(QuicConnectionPeer::IsRetransmission( | 2191 EXPECT_TRUE(QuicConnectionPeer::IsRetransmission( |
2144 &connection_, nack_sequence_number)); | 2192 &connection_, nack_sequence_number)); |
(...skipping 18 matching lines...) Expand all Loading... |
2163 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 2211 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
2164 connection_.SendStreamDataWithString(2, "bar", 0, !kFin, NULL); | 2212 connection_.SendStreamDataWithString(2, "bar", 0, !kFin, NULL); |
2165 QuicAlarm* retransmission_alarm = connection_.GetRetransmissionAlarm(); | 2213 QuicAlarm* retransmission_alarm = connection_.GetRetransmissionAlarm(); |
2166 EXPECT_TRUE(retransmission_alarm->IsSet()); | 2214 EXPECT_TRUE(retransmission_alarm->IsSet()); |
2167 | 2215 |
2168 // Advance the time right before the RTO, then receive an ack for the first | 2216 // Advance the time right before the RTO, then receive an ack for the first |
2169 // packet to delay the RTO. | 2217 // packet to delay the RTO. |
2170 clock_.AdvanceTime(DefaultRetransmissionTime()); | 2218 clock_.AdvanceTime(DefaultRetransmissionTime()); |
2171 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); | 2219 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); |
2172 QuicAckFrame ack(1, QuicTime::Zero(), 0); | 2220 QuicAckFrame ack(1, QuicTime::Zero(), 0); |
| 2221 ack.received_info.entropy_hash = |
| 2222 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
2173 ProcessAckPacket(&ack); | 2223 ProcessAckPacket(&ack); |
2174 EXPECT_TRUE(retransmission_alarm->IsSet()); | 2224 EXPECT_TRUE(retransmission_alarm->IsSet()); |
2175 | 2225 |
2176 // Move forward past the original RTO and ensure the RTO is still pending. | 2226 // Move forward past the original RTO and ensure the RTO is still pending. |
2177 clock_.AdvanceTime(DefaultRetransmissionTime()); | 2227 clock_.AdvanceTime(DefaultRetransmissionTime()); |
2178 | 2228 |
2179 // Ensure the second packet gets retransmitted when it finally fires. | 2229 // Ensure the second packet gets retransmitted when it finally fires. |
2180 EXPECT_TRUE(retransmission_alarm->IsSet()); | 2230 EXPECT_TRUE(retransmission_alarm->IsSet()); |
2181 EXPECT_GE(retransmission_alarm->deadline(), clock_.ApproximateNow()); | 2231 EXPECT_GE(retransmission_alarm->deadline(), clock_.ApproximateNow()); |
2182 clock_.AdvanceTime(DefaultRetransmissionTime()); | 2232 clock_.AdvanceTime(DefaultRetransmissionTime()); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 // Create a delegate which we expect to be called. | 3187 // Create a delegate which we expect to be called. |
3138 MockAckNotifierDelegate delegate; | 3188 MockAckNotifierDelegate delegate; |
3139 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; | 3189 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; |
3140 | 3190 |
3141 // Send some data, which will register the delegate to be notified. | 3191 // Send some data, which will register the delegate to be notified. |
3142 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); | 3192 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); |
3143 | 3193 |
3144 // Process an ACK from the server which should trigger the callback. | 3194 // Process an ACK from the server which should trigger the callback. |
3145 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); | 3195 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); |
3146 QuicAckFrame frame(1, QuicTime::Zero(), 0); | 3196 QuicAckFrame frame(1, QuicTime::Zero(), 0); |
| 3197 frame.received_info.entropy_hash = |
| 3198 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
3147 ProcessAckPacket(&frame); | 3199 ProcessAckPacket(&frame); |
3148 } | 3200 } |
3149 | 3201 |
3150 TEST_F(QuicConnectionTest, AckNotifierFailToTriggerCallback) { | 3202 TEST_F(QuicConnectionTest, AckNotifierFailToTriggerCallback) { |
3151 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3203 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3152 | 3204 |
3153 // Create a delegate which we don't expect to be called. | 3205 // Create a delegate which we don't expect to be called. |
3154 MockAckNotifierDelegate delegate; | 3206 MockAckNotifierDelegate delegate; |
3155 EXPECT_CALL(delegate, OnAckNotification()).Times(0);; | 3207 EXPECT_CALL(delegate, OnAckNotification()).Times(0);; |
3156 | 3208 |
3157 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2); | 3209 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2); |
3158 | 3210 |
3159 // Send some data, which will register the delegate to be notified. This will | 3211 // Send some data, which will register the delegate to be notified. This will |
3160 // not be ACKed and so the delegate should never be called. | 3212 // not be ACKed and so the delegate should never be called. |
3161 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); | 3213 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); |
3162 | 3214 |
3163 // Send some other data which we will ACK. | 3215 // Send some other data which we will ACK. |
3164 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 3216 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
3165 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, NULL); | 3217 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, NULL); |
3166 | 3218 |
3167 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 | 3219 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 |
3168 // which we registered to be notified about. | 3220 // which we registered to be notified about. |
3169 QuicAckFrame frame(3, QuicTime::Zero(), 0); | 3221 QuicAckFrame frame(3, QuicTime::Zero(), 0); |
3170 frame.received_info.missing_packets.insert(1); | 3222 frame.received_info.missing_packets.insert(1); |
| 3223 frame.received_info.entropy_hash = |
| 3224 QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^ |
| 3225 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
3171 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)); | 3226 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)); |
3172 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)); | 3227 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)); |
3173 ProcessAckPacket(&frame); | 3228 ProcessAckPacket(&frame); |
3174 } | 3229 } |
3175 | 3230 |
3176 TEST_F(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { | 3231 TEST_F(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { |
3177 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3232 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3178 | 3233 |
3179 // Create a delegate which we expect to be called. | 3234 // Create a delegate which we expect to be called. |
3180 MockAckNotifierDelegate delegate; | 3235 MockAckNotifierDelegate delegate; |
3181 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; | 3236 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; |
3182 | 3237 |
3183 // In total expect ACKs for all 4 packets. | 3238 // In total expect ACKs for all 4 packets. |
3184 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(4); | 3239 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(4); |
3185 | 3240 |
3186 // Send four packets, and register to be notified on ACK of packet 2. | 3241 // Send four packets, and register to be notified on ACK of packet 2. |
3187 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 3242 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
3188 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, &delegate); | 3243 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, &delegate); |
3189 connection_.SendStreamDataWithString(1, "baz", 0, !kFin, NULL); | 3244 connection_.SendStreamDataWithString(1, "baz", 0, !kFin, NULL); |
3190 connection_.SendStreamDataWithString(1, "qux", 0, !kFin, NULL); | 3245 connection_.SendStreamDataWithString(1, "qux", 0, !kFin, NULL); |
3191 | 3246 |
3192 // Now we receive ACK for packets 1, 3, and 4, which invokes fast retransmit. | 3247 // Now we receive ACK for packets 1, 3, and 4, which invokes fast retransmit. |
3193 QuicAckFrame frame(4, QuicTime::Zero(), 0); | 3248 QuicAckFrame frame(4, QuicTime::Zero(), 0); |
3194 frame.received_info.missing_packets.insert(2); | 3249 frame.received_info.missing_packets.insert(2); |
| 3250 frame.received_info.entropy_hash = |
| 3251 QuicConnectionPeer::GetSentEntropyHash(&connection_, 4) ^ |
| 3252 QuicConnectionPeer::GetSentEntropyHash(&connection_, 2) ^ |
| 3253 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
3195 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); | 3254 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); |
3196 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); | 3255 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
3197 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 3256 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
3198 ProcessAckPacket(&frame); | 3257 ProcessAckPacket(&frame); |
3199 | 3258 |
3200 // Now we get an ACK for packet 5 (retransmitted packet 2), which should | 3259 // Now we get an ACK for packet 5 (retransmitted packet 2), which should |
3201 // trigger the callback. | 3260 // trigger the callback. |
3202 QuicAckFrame second_ack_frame(5, QuicTime::Zero(), 0); | 3261 QuicAckFrame second_ack_frame(5, QuicTime::Zero(), 0); |
| 3262 second_ack_frame.received_info.entropy_hash = |
| 3263 QuicConnectionPeer::GetSentEntropyHash(&connection_, 5); |
3203 ProcessAckPacket(&second_ack_frame); | 3264 ProcessAckPacket(&second_ack_frame); |
3204 } | 3265 } |
3205 | 3266 |
3206 // TODO(rjshade): Add a similar test that FEC recovery on peer (and resulting | 3267 // TODO(rjshade): Add a similar test that FEC recovery on peer (and resulting |
3207 // ACK) triggers notification on our end. | 3268 // ACK) triggers notification on our end. |
3208 TEST_F(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) { | 3269 TEST_F(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) { |
3209 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3270 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3210 EXPECT_CALL(visitor_, OnCanWrite()).Times(1).WillOnce(Return(true)); | 3271 EXPECT_CALL(visitor_, OnCanWrite()).Times(1).WillOnce(Return(true)); |
3211 | 3272 |
3212 // Create a delegate which we expect to be called. | 3273 // Create a delegate which we expect to be called. |
3213 MockAckNotifierDelegate delegate; | 3274 MockAckNotifierDelegate delegate; |
3214 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; | 3275 EXPECT_CALL(delegate, OnAckNotification()).Times(1);; |
3215 | 3276 |
3216 // Expect ACKs for 1 packet. | 3277 // Expect ACKs for 1 packet. |
3217 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); | 3278 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1); |
3218 | 3279 |
3219 // Send one packet, and register to be notified on ACK. | 3280 // Send one packet, and register to be notified on ACK. |
3220 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); | 3281 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate); |
3221 | 3282 |
3222 // Ack packet gets dropped, but we receive an FEC packet that covers it. | 3283 // Ack packet gets dropped, but we receive an FEC packet that covers it. |
3223 // Should recover the Ack packet and trigger the notification callback. | 3284 // Should recover the Ack packet and trigger the notification callback. |
3224 QuicFrames frames; | 3285 QuicFrames frames; |
3225 | 3286 |
3226 QuicAckFrame ack_frame(1, QuicTime::Zero(), 0); | 3287 QuicAckFrame ack_frame(1, QuicTime::Zero(), 0); |
| 3288 ack_frame.received_info.entropy_hash = |
| 3289 QuicConnectionPeer::GetSentEntropyHash(&connection_, 1); |
3227 frames.push_back(QuicFrame(&ack_frame)); | 3290 frames.push_back(QuicFrame(&ack_frame)); |
3228 | 3291 |
3229 // Dummy stream frame to satisfy expectations set elsewhere. | 3292 // Dummy stream frame to satisfy expectations set elsewhere. |
3230 frames.push_back(QuicFrame(&frame1_)); | 3293 frames.push_back(QuicFrame(&frame1_)); |
3231 | 3294 |
3232 QuicPacketHeader ack_header; | 3295 QuicPacketHeader ack_header; |
3233 ack_header.public_header.guid = guid_; | 3296 ack_header.public_header.guid = guid_; |
3234 ack_header.public_header.reset_flag = false; | 3297 ack_header.public_header.reset_flag = false; |
3235 ack_header.public_header.version_flag = false; | 3298 ack_header.public_header.version_flag = false; |
3236 ack_header.entropy_flag = !kEntropyFlag; | 3299 ack_header.entropy_flag = !kEntropyFlag; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 true); | 3379 true); |
3317 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), | 3380 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), |
3318 false); | 3381 false); |
3319 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3382 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); |
3320 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3383 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
3321 } | 3384 } |
3322 | 3385 |
3323 } // namespace | 3386 } // namespace |
3324 } // namespace test | 3387 } // namespace test |
3325 } // namespace net | 3388 } // namespace net |
OLD | NEW |