Index: net/tools/quic/quic_time_wait_list_manager_test.cc |
diff --git a/net/tools/quic/quic_time_wait_list_manager_test.cc b/net/tools/quic/quic_time_wait_list_manager_test.cc |
index 96d74d0debcd994539b442c6c8d5386a43743cfd..f76c51c0ea835b1ccb62c24268c75a141e36fcf4 100644 |
--- a/net/tools/quic/quic_time_wait_list_manager_test.cc |
+++ b/net/tools/quic/quic_time_wait_list_manager_test.cc |
@@ -114,11 +114,9 @@ class QuicTimeWaitListManagerTest : public ::testing::Test { |
return time_wait_list_manager_.IsConnectionIdInTimeWait(connection_id); |
} |
- void ProcessPacket(QuicConnectionId connection_id, |
- QuicPacketNumber packet_number) { |
- QuicEncryptedPacket packet(nullptr, 0); |
+ void ProcessPacket(QuicConnectionId connection_id) { |
time_wait_list_manager_.ProcessPacket(server_address_, client_address_, |
- connection_id, packet_number, packet); |
+ connection_id); |
} |
QuicEncryptedPacket* ConstructEncryptedPacket( |
@@ -144,9 +142,8 @@ class QuicTimeWaitListManagerTest : public ::testing::Test { |
class ValidatePublicResetPacketPredicate |
: public MatcherInterface<const std::tr1::tuple<const char*, int>> { |
public: |
- explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id, |
- QuicPacketNumber number) |
- : connection_id_(connection_id), packet_number_(number) {} |
+ explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id) |
+ : connection_id_(connection_id) {} |
bool MatchAndExplain( |
const std::tr1::tuple<const char*, int> packet_buffer, |
@@ -163,7 +160,6 @@ class ValidatePublicResetPacketPredicate |
packet.public_header.connection_id) && |
packet.public_header.reset_flag && |
!packet.public_header.version_flag && |
- packet_number_ == packet.rejected_packet_number && |
net::test::TestPeerIPAddress() == packet.client_address.host() && |
kTestPort == packet.client_address.port(); |
} |
@@ -174,14 +170,11 @@ class ValidatePublicResetPacketPredicate |
private: |
QuicConnectionId connection_id_; |
- QuicPacketNumber packet_number_; |
}; |
Matcher<const std::tr1::tuple<const char*, int>> PublicResetPacketEq( |
- QuicConnectionId connection_id, |
- QuicPacketNumber packet_number) { |
- return MakeMatcher( |
- new ValidatePublicResetPacketPredicate(connection_id, packet_number)); |
+ QuicConnectionId connection_id) { |
+ return MakeMatcher(new ValidatePublicResetPacketPredicate(connection_id)); |
} |
TEST_F(QuicTimeWaitListManagerTest, CheckConnectionIdInTimeWait) { |
@@ -223,12 +216,11 @@ TEST_F(QuicTimeWaitListManagerTest, SendConnectionClose) { |
AddConnectionId(connection_id_, QuicVersionMax(), |
/*connection_rejected_statelessly=*/false, |
&termination_packets); |
- const int kRandomSequenceNumber = 1; |
EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength, |
server_address_.host(), client_address_, _)) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1))); |
- ProcessPacket(connection_id_, kRandomSequenceNumber); |
+ ProcessPacket(connection_id_); |
} |
TEST_F(QuicTimeWaitListManagerTest, SendTwoConnectionCloses) { |
@@ -244,25 +236,23 @@ TEST_F(QuicTimeWaitListManagerTest, SendTwoConnectionCloses) { |
AddConnectionId(connection_id_, QuicVersionMax(), |
/*connection_rejected_statelessly=*/false, |
&termination_packets); |
- const int kRandomSequenceNumber = 1; |
EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength, |
server_address_.host(), client_address_, _)) |
.Times(2) |
.WillRepeatedly(Return(WriteResult(WRITE_STATUS_OK, 1))); |
- ProcessPacket(connection_id_, kRandomSequenceNumber); |
+ ProcessPacket(connection_id_); |
} |
TEST_F(QuicTimeWaitListManagerTest, SendPublicReset) { |
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
AddConnectionId(connection_id_); |
- const int kRandomSequenceNumber = 1; |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
- .With(Args<0, 1>(PublicResetPacketEq(connection_id_, 0))) |
+ .With(Args<0, 1>(PublicResetPacketEq(connection_id_))) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
- ProcessPacket(connection_id_, kRandomSequenceNumber); |
+ ProcessPacket(connection_id_); |
} |
TEST_F(QuicTimeWaitListManagerTest, SendPublicResetWithExponentialBackOff) { |
@@ -274,7 +264,7 @@ TEST_F(QuicTimeWaitListManagerTest, SendPublicResetWithExponentialBackOff) { |
EXPECT_CALL(writer_, WritePacket(_, _, _, _, _)) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1))); |
} |
- ProcessPacket(connection_id_, packet_number); |
+ ProcessPacket(connection_id_); |
// Send public reset with exponential back off. |
if ((packet_number & (packet_number - 1)) == 0) { |
EXPECT_TRUE(QuicTimeWaitListManagerPeer::ShouldSendResponse( |
@@ -289,13 +279,12 @@ TEST_F(QuicTimeWaitListManagerTest, SendPublicResetWithExponentialBackOff) { |
TEST_F(QuicTimeWaitListManagerTest, NoPublicResetForStatelessConnections) { |
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
AddStatelessConnectionId(connection_id_); |
- const int kRandomSequenceNumber = 1; |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1))); |
- ProcessPacket(connection_id_, kRandomSequenceNumber); |
+ ProcessPacket(connection_id_); |
} |
TEST_F(QuicTimeWaitListManagerTest, CleanUpOldConnectionIds) { |
@@ -354,20 +343,20 @@ TEST_F(QuicTimeWaitListManagerTest, SendQueuedPackets) { |
// Let first write through. |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
- .With(Args<0, 1>(PublicResetPacketEq(connection_id, 0))) |
+ .With(Args<0, 1>(PublicResetPacketEq(connection_id))) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, packet->length()))); |
- ProcessPacket(connection_id, packet_number); |
+ ProcessPacket(connection_id); |
// write block for the next packet. |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
- .With(Args<0, 1>(PublicResetPacketEq(connection_id, 0))) |
+ .With(Args<0, 1>(PublicResetPacketEq(connection_id))) |
.WillOnce(DoAll(Assign(&writer_is_blocked_, true), |
Return(WriteResult(WRITE_STATUS_BLOCKED, EAGAIN)))); |
EXPECT_CALL(visitor_, OnWriteBlocked(&time_wait_list_manager_)); |
- ProcessPacket(connection_id, packet_number); |
+ ProcessPacket(connection_id); |
// 3rd packet. No public reset should be sent; |
- ProcessPacket(connection_id, packet_number); |
+ ProcessPacket(connection_id); |
// write packet should not be called since we are write blocked but the |
// should be queued. |
@@ -379,18 +368,18 @@ TEST_F(QuicTimeWaitListManagerTest, SendQueuedPackets) { |
ConstructEncryptedPacket(other_connection_id, other_packet_number)); |
EXPECT_CALL(writer_, WritePacket(_, _, _, _, _)).Times(0); |
EXPECT_CALL(visitor_, OnWriteBlocked(&time_wait_list_manager_)); |
- ProcessPacket(other_connection_id, other_packet_number); |
+ ProcessPacket(other_connection_id); |
EXPECT_EQ(2u, time_wait_list_manager_.num_connections()); |
// Now expect all the write blocked public reset packets to be sent again. |
writer_is_blocked_ = false; |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
- .With(Args<0, 1>(PublicResetPacketEq(connection_id, 0))) |
+ .With(Args<0, 1>(PublicResetPacketEq(connection_id))) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, packet->length()))); |
EXPECT_CALL(writer_, |
WritePacket(_, _, server_address_.host(), client_address_, _)) |
- .With(Args<0, 1>(PublicResetPacketEq(other_connection_id, 0))) |
+ .With(Args<0, 1>(PublicResetPacketEq(other_connection_id))) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, other_packet->length()))); |
time_wait_list_manager_.OnCanWrite(); |
} |
@@ -442,8 +431,7 @@ TEST_F(QuicTimeWaitListManagerTest, AddConnectionIdTwice) { |
server_address_.host(), client_address_, _)) |
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1))); |
- const int kRandomSequenceNumber = 1; |
- ProcessPacket(connection_id_, kRandomSequenceNumber); |
+ ProcessPacket(connection_id_); |
const QuicTime::Delta time_wait_period = |
QuicTimeWaitListManagerPeer::time_wait_period(&time_wait_list_manager_); |