Index: net/quic/quic_connection_test.cc |
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc |
index 9f9eff37ee77ca44139c91fc2659aa1916ca979a..2e99e4dca2f90b14045b9ff81253ad01675b19b7 100644 |
--- a/net/quic/quic_connection_test.cc |
+++ b/net/quic/quic_connection_test.cc |
@@ -729,13 +729,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { |
EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) |
.WillRepeatedly(Return(QuicTime::Zero())); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .Times(AnyNumber()); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillRepeatedly(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)).Times(AnyNumber()); |
// TODO(ianswett): Fix QuicConnectionTests so they don't attempt to write |
// non-crypto stream data at ENCRYPTION_NONE. |
FLAGS_quic_never_write_unencrypted_data = false; |
@@ -1375,12 +1369,7 @@ TEST_P(QuicConnectionTest, TruncatedAck) { |
lost_packets.insert(i * 2); |
} |
} |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(entropy_calculator_, EntropyHash(511)) |
.WillOnce(Return(static_cast<QuicPacketEntropyHash>(0))); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
@@ -1393,12 +1382,7 @@ TEST_P(QuicConnectionTest, TruncatedAck) { |
// Removing one missing packet allows us to ack 192 and one more range, but |
// 192 has already been declared lost, so it doesn't register as an ack. |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&frame); |
EXPECT_EQ(num_packets, manager_->largest_observed()); |
@@ -1475,17 +1459,10 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) { |
QuicAckFrame frame = InitAckFrame(original); |
NackPacket(original, &frame); |
// First nack triggers early retransmit. |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
QuicPacketNumber retransmission; |
EXPECT_CALL(*send_algorithm_, |
@@ -1497,12 +1474,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) { |
QuicAckFrame frame2 = InitAckFrame(retransmission); |
NackPacket(original, &frame2); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
ProcessAckPacket(&frame2); |
// Now if the peer sends an ack which still reports the retransmitted packet |
@@ -1516,12 +1488,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) { |
EXPECT_EQ(1u, writer_->stream_frames().size()); |
// No more packet loss for the rest of the test. |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)).Times(AnyNumber()); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillRepeatedly(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)).Times(AnyNumber()); |
ProcessAckPacket(&frame2); |
EXPECT_CALL(*send_algorithm_, |
OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)); |
@@ -1998,17 +1965,10 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnRetransmissionTimeout) { |
QuicAckFrame ack = InitAckFrame(3); |
NackPacket(1, &ack); |
NackPacket(2, &ack); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&ack); |
@@ -2064,19 +2024,11 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) { |
QuicAckFrame ack = InitAckFrame(6); |
NackPacket(2, &ack); |
NackPacket(3, &ack); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
- lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(2); |
- lost_packets.insert(3); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
+ lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, |
OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)) |
@@ -2093,12 +2045,7 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) { |
QuicAckFrame ack2 = InitAckFrame(7); |
NackPacket(2, &ack2); |
NackPacket(3, &ack2); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&ack2); |
EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_)); |
@@ -2489,17 +2436,10 @@ TEST_P(QuicConnectionTest, RetransmitOnNack) { |
// Lose a packet and ensure it triggers retransmission. |
QuicAckFrame nack_two = InitAckFrame(3); |
NackPacket(2, &nack_two); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(2); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, |
OnPacketSent(_, _, _, second_packet_size - kQuicVersionSize, _)) |
@@ -2563,14 +2503,7 @@ TEST_P(QuicConnectionTest, DoNotRetransmitForResetStreamOnNack) { |
QuicAckFrame nack_two = InitAckFrame(last_packet); |
NackPacket(last_packet - 1, &nack_two); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(last_packet - 1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
ProcessAckPacket(&nack_two); |
@@ -2591,17 +2524,10 @@ TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnNack) { |
QuicAckFrame nack_two = InitAckFrame(last_packet); |
NackPacket(last_packet - 1, &nack_two); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(last_packet - 1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
if (version() > QUIC_VERSION_28) { |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
@@ -2666,12 +2592,7 @@ TEST_P(QuicConnectionTest, DoNotSendPendingRetransmissionForResetStream) { |
PacketNumberSet lost_packets; |
lost_packets.insert(last_packet - 1); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
ProcessAckPacket(&ack); |
@@ -2700,17 +2621,10 @@ TEST_P(QuicConnectionTest, SendPendingRetransmissionForQuicRstStreamNoError) { |
QuicAckFrame ack = InitAckFrame(last_packet); |
NackPacket(last_packet - 1, &ack); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(last_packet - 1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(last_packet - 1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
ProcessAckPacket(&ack); |
@@ -2752,28 +2666,16 @@ TEST_P(QuicConnectionTest, DiscardRetransmit) { |
// write blocked, so the packet will be queued. |
BlockOnNextWrite(); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(2); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&nack_two); |
EXPECT_EQ(1u, connection_.NumQueuedPackets()); |
// Now, ack the previous transmission. |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
QuicAckFrame ack_all = InitAckFrame(3); |
ProcessAckPacket(&ack_all); |
@@ -2800,17 +2702,10 @@ TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) { |
QuicAckFrame frame = InitAckFrame(1); |
NackPacket(largest_observed, &frame); |
// The first nack should retransmit the largest observed packet. |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, |
OnPacketSent(_, _, _, packet_size - kQuicVersionSize, _)); |
@@ -2930,21 +2825,12 @@ TEST_P(QuicConnectionTest, NoLimitPacketsPerNack) { |
} |
// 14 packets have been NACK'd and lost. |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- for (int i = 1; i < 15; ++i) { |
- lost_packets.push_back(std::make_pair(i, kMaxPacketSize)); |
- } |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- for (int i = 1; i < 15; ++i) { |
- lost_packets.insert(i); |
- } |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ for (int i = 1; i < 15; ++i) { |
+ lost_packets.push_back(std::make_pair(i, kMaxPacketSize)); |
} |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(14); |
ProcessAckPacket(&nack); |
@@ -4608,17 +4494,10 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
// Ack the second packet, which will retransmit the first packet. |
QuicAckFrame ack = InitAckFrame(2); |
NackPacket(1, &ack); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&ack); |
EXPECT_EQ(1u, writer_->frame_count()); |
@@ -4629,12 +4508,7 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
// and see if there is more data to send. |
ack = InitAckFrame(3); |
NackPacket(1, &ack); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&ack); |
@@ -4646,12 +4520,7 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
// Send the same ack, but send both data and an ack together. |
ack = InitAckFrame(3); |
NackPacket(1, &ack); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(visitor_, OnCanWrite()) |
.WillOnce(IgnoreResult(InvokeWithoutArgs( |
&connection_, &TestConnection::EnsureWritableAndSendStreamData5))); |
@@ -5014,19 +4883,11 @@ TEST_P(QuicConnectionTest, CheckSendStats) { |
QuicAckFrame nack_three = InitAckFrame(4); |
NackPacket(3, &nack_three); |
NackPacket(1, &nack_three); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- lost_packets.insert(3); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ lost_packets.push_back(std::make_pair(3, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(visitor_, OnCanWrite()); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
@@ -5214,17 +5075,10 @@ TEST_P(QuicConnectionTest, AckNotifierFailToTriggerCallback) { |
// which we registered to be notified about. |
QuicAckFrame frame = InitAckFrame(3); |
NackPacket(1, &frame); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(1); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&frame); |
} |
@@ -5246,29 +5100,17 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { |
// Now we receive ACK for packets 1, 3, and 4 and lose 2. |
QuicAckFrame frame = InitAckFrame(4); |
NackPacket(2, &frame); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(2); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
ProcessAckPacket(&frame); |
// Now we get an ACK for packet 5 (retransmitted packet 2), which should |
// trigger the callback. |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
QuicAckFrame second_ack_frame = InitAckFrame(5); |
ProcessAckPacket(&second_ack_frame); |
@@ -5329,40 +5171,23 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckOfNackedPacket) { |
NackPacket(2, &frame); |
EXPECT_CALL(*listener, OnPacketRetransmitted(_)); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- SendAlgorithmInterface::CongestionVector lost_packets; |
- lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
- .WillOnce(SetArgPointee<3>(lost_packets)); |
- } else { |
- PacketNumberSet lost_packets; |
- lost_packets.insert(2); |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(lost_packets)); |
- } |
+ SendAlgorithmInterface::CongestionVector lost_packets; |
+ lost_packets.push_back(std::make_pair(2, kMaxPacketSize)); |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
+ .WillOnce(SetArgPointee<3>(lost_packets)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
ProcessAckPacket(&frame); |
// Now we get an ACK for packet 2, which was previously nacked. |
EXPECT_CALL(*listener, OnPacketAcked(3, _)); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
QuicAckFrame second_ack_frame = InitAckFrame(4); |
ProcessAckPacket(&second_ack_frame); |
// Verify that the listener is not notified again when the |
// retransmit is acked. |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
QuicAckFrame third_ack_frame = InitAckFrame(5); |
ProcessAckPacket(&third_ack_frame); |
@@ -5602,12 +5427,7 @@ TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) { |
// Process an ack and the send alarm will be set to the new 2ms delay. |
QuicAckFrame ack = InitAckFrame(1); |
- if (FLAGS_quic_general_loss_algorithm) { |
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
- } else { |
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
- .WillOnce(Return(PacketNumberSet())); |
- } |
+ EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) |
.WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(2))); |