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

Unified Diff: net/tools/quic/quic_time_wait_list_manager_test.cc

Issue 1424653008: Make QUIC stateless rejects work in the face of packet loss by storing the SREJ packet(s) in the Qu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106432163
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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(_,
« no previous file with comments | « net/tools/quic/quic_time_wait_list_manager.cc ('k') | net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698