Index: net/quic/quic_connection_test.cc |
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc |
index 0673c26b5a6b9376b3e09d4c936cf9fb7a236192..4e857190dfdf189669eee1cc0a001602a495dcf3 100644 |
--- a/net/quic/quic_connection_test.cc |
+++ b/net/quic/quic_connection_test.cc |
@@ -464,16 +464,14 @@ class TestConnection : public QuicConnection { |
void SendAck() { QuicConnectionPeer::SendAck(this); } |
- void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { |
- QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); |
+ void SetSendAlgorithm(QuicPathId path_id, |
+ SendAlgorithmInterface* send_algorithm) { |
+ QuicConnectionPeer::SetSendAlgorithm(this, path_id, send_algorithm); |
} |
- void SetLossAlgorithm(LossDetectionInterface* loss_algorithm) { |
- // TODO(fayang): connection tests should use MockSentPacketManager. |
- QuicSentPacketManagerPeer::SetLossAlgorithm( |
- static_cast<QuicSentPacketManager*>( |
- QuicConnectionPeer::GetSentPacketManager(this)), |
- loss_algorithm); |
+ void SetLossAlgorithm(QuicPathId path_id, |
+ LossDetectionInterface* loss_algorithm) { |
+ QuicConnectionPeer::SetLossAlgorithm(this, path_id, loss_algorithm); |
} |
void SendPacket(EncryptionLevel level, |
@@ -604,9 +602,15 @@ class TestConnection : public QuicConnection { |
QuicConnectionPeer::GetMtuDiscoveryAlarm(this)); |
} |
- void DisableTailLossProbe() { |
+ void SetMaxTailLossProbes(QuicPathId path_id, size_t max_tail_loss_probes) { |
QuicSentPacketManagerPeer::SetMaxTailLossProbes( |
- QuicConnectionPeer::GetSentPacketManager(this), 0); |
+ QuicConnectionPeer::GetSentPacketManager(this, path_id), |
+ max_tail_loss_probes); |
+ } |
+ |
+ QuicByteCount GetBytesInFlight(QuicPathId path_id) { |
+ return QuicSentPacketManagerPeer::GetBytesInFlight( |
+ QuicConnectionPeer::GetSentPacketManager(this, path_id)); |
} |
using QuicConnection::SelectMutualVersion; |
@@ -681,7 +685,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { |
version()), |
creator_(QuicConnectionPeer::GetPacketCreator(&connection_)), |
generator_(QuicConnectionPeer::GetPacketGenerator(&connection_)), |
- manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)), |
+ manager_(QuicConnectionPeer::GetSentPacketManager(&connection_, |
+ kDefaultPathId)), |
frame1_(1, false, 0, StringPiece(data1)), |
frame2_(1, false, 3, StringPiece(data2)), |
packet_number_length_(PACKET_6BYTE_PACKET_NUMBER), |
@@ -690,8 +695,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { |
AckResponse::kDefer); |
FLAGS_quic_always_log_bugs_for_tests = true; |
connection_.set_visitor(&visitor_); |
- connection_.SetSendAlgorithm(send_algorithm_); |
- connection_.SetLossAlgorithm(loss_algorithm_); |
+ connection_.SetSendAlgorithm(kDefaultPathId, send_algorithm_); |
+ connection_.SetLossAlgorithm(kDefaultPathId, loss_algorithm_); |
framer_.set_received_entropy_calculator(&entropy_calculator_); |
peer_framer_.set_received_entropy_calculator(&peer_entropy_calculator_); |
EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) |
@@ -1055,7 +1060,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { |
TestConnection connection_; |
QuicPacketCreator* creator_; |
QuicPacketGenerator* generator_; |
- QuicSentPacketManager* manager_; |
+ QuicSentPacketManagerInterface* manager_; |
StrictMock<MockQuicConnectionVisitor> visitor_; |
QuicStreamFrame frame1_; |
@@ -2076,7 +2081,7 @@ TEST_P(QuicConnectionTest, DoNotRetransmitForResetStreamOnRTO) { |
} |
TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnRTO) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
QuicStreamId stream_id = 2; |
QuicPacketNumber last_packet; |
@@ -2276,7 +2281,7 @@ TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) { |
} |
TEST_P(QuicConnectionTest, QueueAfterTwoRTOs) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
for (int i = 0; i < 10; ++i) { |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
@@ -2492,7 +2497,7 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) { |
} |
TEST_P(QuicConnectionTest, TLP) { |
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(manager_, 1); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 1); |
SendStreamDataToPeer(3, "foo", 0, !kFin, nullptr); |
EXPECT_EQ(1u, stop_waiting()->least_unacked); |
@@ -2512,7 +2517,7 @@ TEST_P(QuicConnectionTest, TLP) { |
} |
TEST_P(QuicConnectionTest, RTO) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
QuicTime default_retransmission_time = |
clock_.ApproximateNow() + DefaultRetransmissionTime(); |
@@ -2532,7 +2537,7 @@ TEST_P(QuicConnectionTest, RTO) { |
} |
TEST_P(QuicConnectionTest, RTOWithSameEncryptionLevel) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
QuicTime default_retransmission_time = |
clock_.ApproximateNow() + DefaultRetransmissionTime(); |
@@ -2758,7 +2763,7 @@ TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) { |
} |
TEST_P(QuicConnectionTest, TestRetransmitOrder) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
QuicByteCount first_packet_size; |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
@@ -2803,7 +2808,7 @@ TEST_P(QuicConnectionTest, SetRTOAfterWritingToSocket) { |
} |
TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
@@ -2843,7 +2848,7 @@ TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) { |
} |
TEST_P(QuicConnectionTest, TestQueued) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
EXPECT_EQ(0u, connection_.NumQueuedPackets()); |
BlockOnNextWrite(); |
@@ -3055,7 +3060,7 @@ TEST_P(QuicConnectionTest, MtuDiscoveryEnabled) { |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&probe_ack); |
EXPECT_EQ(kMtuDiscoveryTargetPacketSizeHigh, connection_.max_packet_length()); |
- EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_)); |
+ EXPECT_EQ(0u, connection_.GetBytesInFlight(kDefaultPathId)); |
// Send more packets, and ensure that none of them sets the alarm. |
for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) { |
@@ -3172,7 +3177,7 @@ TEST_P(QuicConnectionTest, MtuDiscoveryWriterLimited) { |
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
ProcessAckPacket(&probe_ack); |
EXPECT_EQ(mtu_limit, connection_.max_packet_length()); |
- EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_)); |
+ EXPECT_EQ(0u, connection_.GetBytesInFlight(kDefaultPathId)); |
// Send more packets, and ensure that none of them sets the alarm. |
for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) { |
@@ -3420,7 +3425,7 @@ TEST_P(QuicConnectionTest, TimeoutAfterReceiveNotSendWhenUnacked) { |
} |
TEST_P(QuicConnectionTest, TimeoutAfter5RTOs) { |
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(manager_, 2); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 2); |
EXPECT_TRUE(connection_.connected()); |
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
QuicConfig config; |
@@ -4469,7 +4474,7 @@ TEST_P(QuicConnectionTest, BadVersionNegotiation) { |
} |
TEST_P(QuicConnectionTest, CheckSendStats) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
connection_.SendStreamDataWithString(3, "first", 0, !kFin, nullptr); |
@@ -4683,7 +4688,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { |
// out and was retransmitted, even though the retransmission has a |
// different packet number. |
TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) { |
- connection_.DisableTailLossProbe(); |
+ connection_.SetMaxTailLossProbes(kDefaultPathId, 0); |
// Create a listener which we expect to be called. |
scoped_refptr<MockAckListener> listener(new StrictMock<MockAckListener>); |
@@ -4940,10 +4945,10 @@ TEST_P(QuicConnectionTest, OnPathDegrading) { |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
.WillOnce(DoAll(SaveArg<3>(&packet_size), Return(true))); |
connection_.SendStreamDataWithString(3, "packet", 0, !kFin, nullptr); |
- size_t num_timeouts = |
- kMinTimeoutsBeforePathDegrading + |
- QuicSentPacketManagerPeer::GetMaxTailLossProbes( |
- QuicConnectionPeer::GetSentPacketManager(&connection_)); |
+ size_t num_timeouts = kMinTimeoutsBeforePathDegrading + |
+ QuicSentPacketManagerPeer::GetMaxTailLossProbes( |
+ QuicConnectionPeer::GetSentPacketManager( |
+ &connection_, kDefaultPathId)); |
for (size_t i = 1; i < num_timeouts; ++i) { |
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10 * i)); |
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, packet_size, _)); |