Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 1660533002: Landing Recent QUIC changes until 01/26/2016 18:14 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 EXPECT_EQ(7u, manager_.NextPendingRetransmission().packet_number); 952 EXPECT_EQ(7u, manager_.NextPendingRetransmission().packet_number);
953 RetransmitNextPacket(9); 953 RetransmitNextPacket(9);
954 954
955 EXPECT_TRUE(manager_.HasPendingRetransmissions()); 955 EXPECT_TRUE(manager_.HasPendingRetransmissions());
956 // Send 3 more data packets and ensure the least unacked is raised. 956 // Send 3 more data packets and ensure the least unacked is raised.
957 RetransmitNextPacket(10); 957 RetransmitNextPacket(10);
958 RetransmitNextPacket(11); 958 RetransmitNextPacket(11);
959 RetransmitNextPacket(12); 959 RetransmitNextPacket(12);
960 EXPECT_FALSE(manager_.HasPendingRetransmissions()); 960 EXPECT_FALSE(manager_.HasPendingRetransmissions());
961 961
962 if (!FLAGS_quic_track_single_retransmission) {
963 EXPECT_EQ(8u, manager_.GetLeastUnacked());
964 return;
965 }
966 EXPECT_EQ(1u, manager_.GetLeastUnacked()); 962 EXPECT_EQ(1u, manager_.GetLeastUnacked());
967 // Least unacked isn't raised until an ack is received, so ack the 963 // Least unacked isn't raised until an ack is received, so ack the
968 // crypto packets. 964 // crypto packets.
969 QuicPacketNumber acked[] = {8, 9}; 965 QuicPacketNumber acked[] = {8, 9};
970 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); 966 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0);
971 QuicAckFrame ack_frame; 967 QuicAckFrame ack_frame;
972 ack_frame.largest_observed = 9; 968 ack_frame.largest_observed = 9;
973 for (QuicPacketNumber i = 1; i < 8; ++i) { 969 for (QuicPacketNumber i = 1; i < 8; ++i) {
974 ack_frame.missing_packets.Add(i); 970 ack_frame.missing_packets.Add(i);
975 } 971 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm); 1396 QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm);
1401 1397
1402 EXPECT_CALL(*loss_algorithm, GetLossTimeout()) 1398 EXPECT_CALL(*loss_algorithm, GetLossTimeout())
1403 .WillRepeatedly(Return(QuicTime::Zero())); 1399 .WillRepeatedly(Return(QuicTime::Zero()));
1404 SendDataPacket(1); 1400 SendDataPacket(1);
1405 SendDataPacket(2); 1401 SendDataPacket(2);
1406 1402
1407 // Handle an ack which causes the loss algorithm to be evaluated and 1403 // Handle an ack which causes the loss algorithm to be evaluated and
1408 // set the loss timeout. 1404 // set the loss timeout.
1409 ExpectAck(2); 1405 ExpectAck(2);
1410 if (FLAGS_quic_general_loss_algorithm) { 1406 EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _));
1411 EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _));
1412 } else {
1413 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _))
1414 .WillOnce(Return(PacketNumberSet()));
1415 }
1416 QuicAckFrame ack_frame; 1407 QuicAckFrame ack_frame;
1417 ack_frame.largest_observed = 2; 1408 ack_frame.largest_observed = 2;
1418 ack_frame.missing_packets.Add(1); 1409 ack_frame.missing_packets.Add(1);
1419 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1410 manager_.OnIncomingAck(ack_frame, clock_.Now());
1420 1411
1421 QuicTime timeout(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(10))); 1412 QuicTime timeout(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(10)));
1422 EXPECT_CALL(*loss_algorithm, GetLossTimeout()) 1413 EXPECT_CALL(*loss_algorithm, GetLossTimeout())
1423 .WillRepeatedly(Return(timeout)); 1414 .WillRepeatedly(Return(timeout));
1424 EXPECT_EQ(timeout, manager_.GetRetransmissionTime()); 1415 EXPECT_EQ(timeout, manager_.GetRetransmissionTime());
1425 1416
1426 // Fire the retransmission timeout and ensure the loss detection algorithm 1417 // Fire the retransmission timeout and ensure the loss detection algorithm
1427 // is invoked. 1418 // is invoked.
1428 if (FLAGS_quic_general_loss_algorithm) { 1419 EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _));
1429 EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _));
1430 } else {
1431 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _))
1432 .WillOnce(Return(PacketNumberSet()));
1433 }
1434 manager_.OnRetransmissionTimeout(); 1420 manager_.OnRetransmissionTimeout();
1435 } 1421 }
1436 1422
1437 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { 1423 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
1438 EXPECT_EQ(kNack, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_) 1424 EXPECT_EQ(kNack, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_)
1439 ->GetLossDetectionType()); 1425 ->GetLossDetectionType());
1440 1426
1441 QuicConfig config; 1427 QuicConfig config;
1442 QuicTagVector options; 1428 QuicTagVector options;
1443 options.push_back(kTIME); 1429 options.push_back(kTIME);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 1696
1711 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); 1697 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false));
1712 manager_.ResumeConnectionState(cached_network_params, false); 1698 manager_.ResumeConnectionState(cached_network_params, false);
1713 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1699 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1714 static_cast<uint64_t>(manager_.GetRttStats()->initial_rtt_us())); 1700 static_cast<uint64_t>(manager_.GetRttStats()->initial_rtt_us()));
1715 } 1701 }
1716 1702
1717 } // namespace 1703 } // namespace
1718 } // namespace test 1704 } // namespace test
1719 } // namespace net 1705 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698