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 a8b73e126ad56f7476a8102b07f6aed8b9e95b8c..e5ae0b691e81e18226c0d7bb507059a96fbc6760 100644 |
--- a/net/tools/quic/quic_time_wait_list_manager_test.cc |
+++ b/net/tools/quic/quic_time_wait_list_manager_test.cc |
@@ -116,17 +116,19 @@ class QuicTimeWaitListManagerTest : public ::testing::Test { |
} |
void AddStatelessConnectionId(QuicConnectionId connection_id) { |
+ std::vector<QuicEncryptedPacket*> termination_packets; |
+ termination_packets.push_back(new QuicEncryptedPacket(nullptr, 0, false)); |
time_wait_list_manager_.AddConnectionIdToTimeWait( |
connection_id, QuicVersionMax(), |
- /*connection_rejected_statelessly=*/true, nullptr); |
+ /*connection_rejected_statelessly=*/true, &termination_packets); |
} |
void AddConnectionId(QuicConnectionId connection_id, |
QuicVersion version, |
bool connection_rejected_statelessly, |
- QuicEncryptedPacket* packet) { |
+ std::vector<QuicEncryptedPacket*>* packets) { |
time_wait_list_manager_.AddConnectionIdToTimeWait( |
- connection_id, version, connection_rejected_statelessly, packet); |
+ connection_id, version, connection_rejected_statelessly, packets); |
} |
bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) { |
@@ -219,10 +221,13 @@ TEST_F(QuicTimeWaitListManagerTest, CheckStatelessConnectionIdInTimeWait) { |
TEST_F(QuicTimeWaitListManagerTest, SendConnectionClose) { |
const size_t kConnectionCloseLength = 100; |
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
+ std::vector<QuicEncryptedPacket*> termination_packets; |
+ termination_packets.push_back( |
+ new QuicEncryptedPacket(new char[kConnectionCloseLength], |
+ kConnectionCloseLength, true)); |
AddConnectionId(connection_id_, QuicVersionMax(), |
/*connection_rejected_statelessly=*/false, |
- new QuicEncryptedPacket(new char[kConnectionCloseLength], |
- kConnectionCloseLength, true)); |
+ &termination_packets); |
const int kRandomSequenceNumber = 1; |
EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength, |
server_address_.address(), |
@@ -232,6 +237,28 @@ TEST_F(QuicTimeWaitListManagerTest, SendConnectionClose) { |
ProcessPacket(connection_id_, kRandomSequenceNumber); |
} |
+TEST_F(QuicTimeWaitListManagerTest, SendTwoConnectionCloses) { |
+ const size_t kConnectionCloseLength = 100; |
+ EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
+ std::vector<QuicEncryptedPacket*> termination_packets; |
+ termination_packets.push_back( |
+ new QuicEncryptedPacket(new char[kConnectionCloseLength], |
+ kConnectionCloseLength, true)); |
+ termination_packets.push_back( |
+ new QuicEncryptedPacket(new char[kConnectionCloseLength], |
+ kConnectionCloseLength, true)); |
+ AddConnectionId(connection_id_, QuicVersionMax(), |
+ /*connection_rejected_statelessly=*/false, |
+ &termination_packets); |
+ const int kRandomSequenceNumber = 1; |
+ EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength, |
+ server_address_.address(), |
+ client_address_)).Times(2) |
+ .WillRepeatedly(Return(WriteResult(WRITE_STATUS_OK, 1))); |
+ |
+ ProcessPacket(connection_id_, kRandomSequenceNumber); |
+} |
+ |
TEST_F(QuicTimeWaitListManagerTest, SendPublicReset) { |
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
AddConnectionId(connection_id_); |
@@ -271,6 +298,12 @@ TEST_F(QuicTimeWaitListManagerTest, NoPublicResetForStatelessConnections) { |
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_)); |
AddStatelessConnectionId(connection_id_); |
const int kRandomSequenceNumber = 1; |
+ |
+ EXPECT_CALL(writer_, WritePacket(_, _, |
+ server_address_.address(), |
+ client_address_)) |
+ .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1))); |
+ |
ProcessPacket(connection_id_, kRandomSequenceNumber); |
} |
@@ -412,11 +445,14 @@ TEST_F(QuicTimeWaitListManagerTest, AddConnectionIdTwice) { |
AddConnectionId(connection_id_); |
EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_)); |
const size_t kConnectionCloseLength = 100; |
+ std::vector<QuicEncryptedPacket*> termination_packets; |
+ termination_packets.push_back( |
+ new QuicEncryptedPacket(new char[kConnectionCloseLength], |
+ kConnectionCloseLength, true)); |
AddConnectionId(connection_id_, QuicVersionMax(), |
/*connection_rejected_statelessly=*/false, |
- new QuicEncryptedPacket(new char[kConnectionCloseLength], |
- kConnectionCloseLength, true)); |
- EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_)); |
+ &termination_packets); |
+ EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_)); |
EXPECT_EQ(1u, time_wait_list_manager_.num_connections()); |
EXPECT_CALL(writer_, WritePacket(_, |