We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / net / tools / quic / quic_time_wait_list_manager_test.cc
blob7c451a3a2b8e9fc5d6679a96276f282c9a023f75
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_time_wait_list_manager.h"
7 #include <errno.h>
9 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/null_encrypter.h"
11 #include "net/quic/crypto/quic_decrypter.h"
12 #include "net/quic/crypto/quic_encrypter.h"
13 #include "net/quic/quic_connection_helper.h"
14 #include "net/quic/quic_data_reader.h"
15 #include "net/quic/quic_flags.h"
16 #include "net/quic/quic_framer.h"
17 #include "net/quic/quic_packet_writer.h"
18 #include "net/quic/quic_protocol.h"
19 #include "net/quic/quic_utils.h"
20 #include "net/quic/test_tools/quic_test_utils.h"
21 #include "net/tools/quic/quic_epoll_connection_helper.h"
22 #include "net/tools/quic/test_tools/mock_epoll_server.h"
23 #include "net/tools/quic/test_tools/quic_test_utils.h"
24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h"
27 using net::test::BuildUnsizedDataPacket;
28 using net::test::NoOpFramerVisitor;
29 using net::test::QuicVersionMax;
30 using net::test::QuicVersionMin;
31 using net::test::ValueRestore;
32 using testing::Args;
33 using testing::Assign;
34 using testing::DoAll;
35 using testing::Matcher;
36 using testing::MatcherInterface;
37 using testing::NiceMock;
38 using testing::Return;
39 using testing::ReturnPointee;
40 using testing::SetArgPointee;
41 using testing::StrictMock;
42 using testing::Truly;
43 using testing::_;
45 namespace net {
46 namespace tools {
47 namespace test {
49 class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor {
50 public:
51 FramerVisitorCapturingPublicReset() {}
52 ~FramerVisitorCapturingPublicReset() override {}
54 void OnPublicResetPacket(const QuicPublicResetPacket& public_reset) override {
55 public_reset_packet_ = public_reset;
58 const QuicPublicResetPacket public_reset_packet() {
59 return public_reset_packet_;
62 private:
63 QuicPublicResetPacket public_reset_packet_;
66 class QuicTimeWaitListManagerPeer {
67 public:
68 static bool ShouldSendResponse(QuicTimeWaitListManager* manager,
69 int received_packet_count) {
70 return manager->ShouldSendResponse(received_packet_count);
73 static QuicTime::Delta time_wait_period(QuicTimeWaitListManager* manager) {
74 return manager->time_wait_period_;
77 static QuicVersion GetQuicVersionFromConnectionId(
78 QuicTimeWaitListManager* manager,
79 QuicConnectionId connection_id) {
80 return manager->GetQuicVersionFromConnectionId(connection_id);
84 namespace {
86 class MockFakeTimeEpollServer : public FakeTimeEpollServer {
87 public:
88 MOCK_METHOD2(RegisterAlarm, void(int64 timeout_in_us,
89 EpollAlarmCallbackInterface* alarm));
92 class QuicTimeWaitListManagerTest : public ::testing::Test {
93 protected:
94 QuicTimeWaitListManagerTest()
95 : helper_(&epoll_server_),
96 time_wait_list_manager_(&writer_,
97 &visitor_,
98 &helper_,
99 QuicSupportedVersions()),
100 framer_(QuicSupportedVersions(),
101 QuicTime::Zero(),
102 Perspective::IS_SERVER),
103 connection_id_(45),
104 client_address_(net::test::TestPeerIPAddress(), kTestPort),
105 writer_is_blocked_(false) {}
107 ~QuicTimeWaitListManagerTest() override {}
109 void SetUp() override {
110 EXPECT_CALL(writer_, IsWriteBlocked())
111 .WillRepeatedly(ReturnPointee(&writer_is_blocked_));
112 EXPECT_CALL(writer_, IsWriteBlockedDataBuffered())
113 .WillRepeatedly(Return(false));
116 void AddConnectionId(QuicConnectionId connection_id) {
117 AddConnectionId(connection_id, QuicVersionMax(), nullptr);
120 void AddConnectionId(QuicConnectionId connection_id,
121 QuicVersion version,
122 QuicEncryptedPacket* packet) {
123 time_wait_list_manager_.AddConnectionIdToTimeWait(
124 connection_id, version, packet);
127 bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) {
128 return time_wait_list_manager_.IsConnectionIdInTimeWait(connection_id);
131 void ProcessPacket(QuicConnectionId connection_id,
132 QuicPacketSequenceNumber sequence_number) {
133 QuicEncryptedPacket packet(nullptr, 0);
134 time_wait_list_manager_.ProcessPacket(server_address_,
135 client_address_,
136 connection_id,
137 sequence_number,
138 packet);
141 QuicEncryptedPacket* ConstructEncryptedPacket(
142 EncryptionLevel level,
143 QuicConnectionId connection_id,
144 QuicPacketSequenceNumber sequence_number) {
145 QuicPacketHeader header;
146 header.public_header.connection_id = connection_id;
147 header.public_header.connection_id_length = PACKET_8BYTE_CONNECTION_ID;
148 header.public_header.version_flag = false;
149 header.public_header.reset_flag = false;
150 header.public_header.sequence_number_length = PACKET_6BYTE_SEQUENCE_NUMBER;
151 header.packet_sequence_number = sequence_number;
152 header.entropy_flag = false;
153 header.entropy_hash = 0;
154 header.fec_flag = false;
155 header.is_in_fec_group = NOT_IN_FEC_GROUP;
156 header.fec_group = 0;
157 QuicStreamFrame stream_frame(1, false, 0, MakeIOVector("data"));
158 QuicFrame frame(&stream_frame);
159 QuicFrames frames;
160 frames.push_back(frame);
161 scoped_ptr<QuicPacket> packet(
162 BuildUnsizedDataPacket(&framer_, header, frames));
163 EXPECT_TRUE(packet != nullptr);
164 QuicEncryptedPacket* encrypted = framer_.EncryptPacket(ENCRYPTION_NONE,
165 sequence_number,
166 *packet);
167 EXPECT_TRUE(encrypted != nullptr);
168 return encrypted;
171 NiceMock<MockFakeTimeEpollServer> epoll_server_;
172 QuicEpollConnectionHelper helper_;
173 StrictMock<MockPacketWriter> writer_;
174 StrictMock<MockQuicServerSessionVisitor> visitor_;
175 QuicTimeWaitListManager time_wait_list_manager_;
176 QuicFramer framer_;
177 QuicConnectionId connection_id_;
178 IPEndPoint server_address_;
179 IPEndPoint client_address_;
180 bool writer_is_blocked_;
183 class ValidatePublicResetPacketPredicate
184 : public MatcherInterface<const std::tr1::tuple<const char*, int> > {
185 public:
186 explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id,
187 QuicPacketSequenceNumber number)
188 : connection_id_(connection_id), sequence_number_(number) {
191 virtual bool MatchAndExplain(
192 const std::tr1::tuple<const char*, int> packet_buffer,
193 testing::MatchResultListener* /* listener */) const override {
194 FramerVisitorCapturingPublicReset visitor;
195 QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(),
196 Perspective::IS_CLIENT);
197 framer.set_visitor(&visitor);
198 QuicEncryptedPacket encrypted(std::tr1::get<0>(packet_buffer),
199 std::tr1::get<1>(packet_buffer));
200 framer.ProcessPacket(encrypted);
201 QuicPublicResetPacket packet = visitor.public_reset_packet();
202 return connection_id_ == packet.public_header.connection_id &&
203 packet.public_header.reset_flag && !packet.public_header.version_flag &&
204 sequence_number_ == packet.rejected_sequence_number &&
205 net::test::TestPeerIPAddress() == packet.client_address.address() &&
206 kTestPort == packet.client_address.port();
209 virtual void DescribeTo(::std::ostream* os) const override {}
211 virtual void DescribeNegationTo(::std::ostream* os) const override {}
213 private:
214 QuicConnectionId connection_id_;
215 QuicPacketSequenceNumber sequence_number_;
219 Matcher<const std::tr1::tuple<const char*, int> > PublicResetPacketEq(
220 QuicConnectionId connection_id,
221 QuicPacketSequenceNumber sequence_number) {
222 return MakeMatcher(new ValidatePublicResetPacketPredicate(connection_id,
223 sequence_number));
226 TEST_F(QuicTimeWaitListManagerTest, CheckConnectionIdInTimeWait) {
227 EXPECT_FALSE(IsConnectionIdInTimeWait(connection_id_));
228 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
229 AddConnectionId(connection_id_);
230 EXPECT_EQ(1u, time_wait_list_manager_.num_connections());
231 EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_));
234 TEST_F(QuicTimeWaitListManagerTest, SendConnectionClose) {
235 const size_t kConnectionCloseLength = 100;
236 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
237 AddConnectionId(
238 connection_id_,
239 QuicVersionMax(),
240 new QuicEncryptedPacket(
241 new char[kConnectionCloseLength], kConnectionCloseLength, true));
242 const int kRandomSequenceNumber = 1;
243 EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength,
244 server_address_.address(),
245 client_address_))
246 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1)));
248 ProcessPacket(connection_id_, kRandomSequenceNumber);
251 TEST_F(QuicTimeWaitListManagerTest, SendPublicReset) {
252 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
253 AddConnectionId(connection_id_);
254 const int kRandomSequenceNumber = 1;
255 EXPECT_CALL(writer_, WritePacket(_, _,
256 server_address_.address(),
257 client_address_))
258 .With(Args<0, 1>(PublicResetPacketEq(connection_id_,
259 kRandomSequenceNumber)))
260 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
262 ProcessPacket(connection_id_, kRandomSequenceNumber);
265 TEST_F(QuicTimeWaitListManagerTest, SendPublicResetWithExponentialBackOff) {
266 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
267 AddConnectionId(connection_id_);
268 EXPECT_EQ(1u, time_wait_list_manager_.num_connections());
269 for (int sequence_number = 1; sequence_number < 101; ++sequence_number) {
270 if ((sequence_number & (sequence_number - 1)) == 0) {
271 EXPECT_CALL(writer_, WritePacket(_, _, _, _))
272 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1)));
274 ProcessPacket(connection_id_, sequence_number);
275 // Send public reset with exponential back off.
276 if ((sequence_number & (sequence_number - 1)) == 0) {
277 EXPECT_TRUE(QuicTimeWaitListManagerPeer::ShouldSendResponse(
278 &time_wait_list_manager_, sequence_number));
279 } else {
280 EXPECT_FALSE(QuicTimeWaitListManagerPeer::ShouldSendResponse(
281 &time_wait_list_manager_, sequence_number));
286 TEST_F(QuicTimeWaitListManagerTest, CleanUpOldConnectionIds) {
287 const size_t kConnectionIdCount = 100;
288 const size_t kOldConnectionIdCount = 31;
290 // Add connection_ids such that their expiry time is time_wait_period_.
291 epoll_server_.set_now_in_usec(0);
292 for (size_t connection_id = 1; connection_id <= kOldConnectionIdCount;
293 ++connection_id) {
294 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id));
295 AddConnectionId(connection_id);
297 EXPECT_EQ(kOldConnectionIdCount, time_wait_list_manager_.num_connections());
299 // Add remaining connection_ids such that their add time is
300 // 2 * time_wait_period_.
301 const QuicTime::Delta time_wait_period =
302 QuicTimeWaitListManagerPeer::time_wait_period(&time_wait_list_manager_);
303 epoll_server_.set_now_in_usec(time_wait_period.ToMicroseconds());
304 for (size_t connection_id = kOldConnectionIdCount + 1;
305 connection_id <= kConnectionIdCount; ++connection_id) {
306 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id));
307 AddConnectionId(connection_id);
309 EXPECT_EQ(kConnectionIdCount, time_wait_list_manager_.num_connections());
311 QuicTime::Delta offset = QuicTime::Delta::FromMicroseconds(39);
312 // Now set the current time as time_wait_period + offset usecs.
313 epoll_server_.set_now_in_usec(time_wait_period.Add(offset).ToMicroseconds());
314 // After all the old connection_ids are cleaned up, check the next alarm
315 // interval.
316 int64 next_alarm_time = epoll_server_.ApproximateNowInUsec() +
317 time_wait_period.Subtract(offset).ToMicroseconds();
318 EXPECT_CALL(epoll_server_, RegisterAlarm(next_alarm_time, _));
320 for (size_t connection_id = 1; connection_id <= kConnectionIdCount;
321 ++connection_id) {
322 if (connection_id <= kOldConnectionIdCount) {
323 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(connection_id));
326 time_wait_list_manager_.CleanUpOldConnectionIds();
327 for (size_t connection_id = 1; connection_id <= kConnectionIdCount;
328 ++connection_id) {
329 EXPECT_EQ(connection_id > kOldConnectionIdCount,
330 IsConnectionIdInTimeWait(connection_id))
331 << "kOldConnectionIdCount: " << kOldConnectionIdCount
332 << " connection_id: " << connection_id;
334 EXPECT_EQ(kConnectionIdCount - kOldConnectionIdCount,
335 time_wait_list_manager_.num_connections());
338 TEST_F(QuicTimeWaitListManagerTest, SendQueuedPackets) {
339 QuicConnectionId connection_id = 1;
340 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id));
341 AddConnectionId(connection_id);
342 QuicPacketSequenceNumber sequence_number = 234;
343 scoped_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket(
344 ENCRYPTION_NONE, connection_id, sequence_number));
345 // Let first write through.
346 EXPECT_CALL(writer_, WritePacket(_, _,
347 server_address_.address(),
348 client_address_))
349 .With(Args<0, 1>(PublicResetPacketEq(connection_id,
350 sequence_number)))
351 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, packet->length())));
352 ProcessPacket(connection_id, sequence_number);
354 // write block for the next packet.
355 EXPECT_CALL(writer_, WritePacket(_, _,
356 server_address_.address(),
357 client_address_))
358 .With(Args<0, 1>(PublicResetPacketEq(connection_id,
359 sequence_number)))
360 .WillOnce(DoAll(
361 Assign(&writer_is_blocked_, true),
362 Return(WriteResult(WRITE_STATUS_BLOCKED, EAGAIN))));
363 EXPECT_CALL(visitor_, OnWriteBlocked(&time_wait_list_manager_));
364 ProcessPacket(connection_id, sequence_number);
365 // 3rd packet. No public reset should be sent;
366 ProcessPacket(connection_id, sequence_number);
368 // write packet should not be called since we are write blocked but the
369 // should be queued.
370 QuicConnectionId other_connection_id = 2;
371 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(other_connection_id));
372 AddConnectionId(other_connection_id);
373 QuicPacketSequenceNumber other_sequence_number = 23423;
374 scoped_ptr<QuicEncryptedPacket> other_packet(
375 ConstructEncryptedPacket(
376 ENCRYPTION_NONE, other_connection_id, other_sequence_number));
377 EXPECT_CALL(writer_, WritePacket(_, _, _, _))
378 .Times(0);
379 EXPECT_CALL(visitor_, OnWriteBlocked(&time_wait_list_manager_));
380 ProcessPacket(other_connection_id, other_sequence_number);
381 EXPECT_EQ(2u, time_wait_list_manager_.num_connections());
383 // Now expect all the write blocked public reset packets to be sent again.
384 writer_is_blocked_ = false;
385 EXPECT_CALL(writer_, WritePacket(_, _,
386 server_address_.address(),
387 client_address_))
388 .With(Args<0, 1>(PublicResetPacketEq(connection_id,
389 sequence_number)))
390 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, packet->length())));
391 EXPECT_CALL(writer_, WritePacket(_, _,
392 server_address_.address(),
393 client_address_))
394 .With(Args<0, 1>(PublicResetPacketEq(other_connection_id,
395 other_sequence_number)))
396 .WillOnce(Return(WriteResult(WRITE_STATUS_OK,
397 other_packet->length())));
398 time_wait_list_manager_.OnCanWrite();
401 TEST_F(QuicTimeWaitListManagerTest, GetQuicVersionFromMap) {
402 const int kConnectionId1 = 123;
403 const int kConnectionId2 = 456;
404 const int kConnectionId3 = 789;
406 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(kConnectionId1));
407 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(kConnectionId2));
408 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(kConnectionId3));
409 AddConnectionId(kConnectionId1, QuicVersionMin(), nullptr);
410 AddConnectionId(kConnectionId2, QuicVersionMax(), nullptr);
411 AddConnectionId(kConnectionId3, QuicVersionMax(), nullptr);
413 EXPECT_EQ(QuicVersionMin(),
414 QuicTimeWaitListManagerPeer::GetQuicVersionFromConnectionId(
415 &time_wait_list_manager_, kConnectionId1));
416 EXPECT_EQ(QuicVersionMax(),
417 QuicTimeWaitListManagerPeer::GetQuicVersionFromConnectionId(
418 &time_wait_list_manager_, kConnectionId2));
419 EXPECT_EQ(QuicVersionMax(),
420 QuicTimeWaitListManagerPeer::GetQuicVersionFromConnectionId(
421 &time_wait_list_manager_, kConnectionId3));
424 TEST_F(QuicTimeWaitListManagerTest, AddConnectionIdTwice) {
425 // Add connection_ids such that their expiry time is time_wait_period_.
426 epoll_server_.set_now_in_usec(0);
427 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
428 AddConnectionId(connection_id_);
429 EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_));
430 const size_t kConnectionCloseLength = 100;
431 AddConnectionId(
432 connection_id_,
433 QuicVersionMax(),
434 new QuicEncryptedPacket(
435 new char[kConnectionCloseLength], kConnectionCloseLength, true));
436 EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_));
437 EXPECT_EQ(1u, time_wait_list_manager_.num_connections());
439 EXPECT_CALL(writer_, WritePacket(_,
440 kConnectionCloseLength,
441 server_address_.address(),
442 client_address_))
443 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1)));
445 const int kRandomSequenceNumber = 1;
446 ProcessPacket(connection_id_, kRandomSequenceNumber);
448 const QuicTime::Delta time_wait_period =
449 QuicTimeWaitListManagerPeer::time_wait_period(&time_wait_list_manager_);
451 QuicTime::Delta offset = QuicTime::Delta::FromMicroseconds(39);
452 // Now set the current time as time_wait_period + offset usecs.
453 epoll_server_.set_now_in_usec(time_wait_period.Add(offset).ToMicroseconds());
454 // After the connection_ids are cleaned up, check the next alarm interval.
455 int64 next_alarm_time = epoll_server_.ApproximateNowInUsec() +
456 time_wait_period.ToMicroseconds();
458 EXPECT_CALL(epoll_server_, RegisterAlarm(next_alarm_time, _));
459 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(connection_id_));
460 time_wait_list_manager_.CleanUpOldConnectionIds();
461 EXPECT_FALSE(IsConnectionIdInTimeWait(connection_id_));
462 EXPECT_EQ(0u, time_wait_list_manager_.num_connections());
465 TEST_F(QuicTimeWaitListManagerTest, ConnectionIdsOrderedByTime) {
466 // Simple randomization: the values of connection_ids are swapped based on the
467 // current seconds on the clock. If the container is broken, the test will be
468 // 50% flaky.
469 int odd_second = static_cast<int>(epoll_server_.ApproximateNowInUsec()) % 2;
470 EXPECT_TRUE(odd_second == 0 || odd_second == 1);
471 const QuicConnectionId connection_id1 = odd_second;
472 const QuicConnectionId connection_id2 = 1 - odd_second;
474 // 1 will hash lower than 2, but we add it later. They should come out in the
475 // add order, not hash order.
476 epoll_server_.set_now_in_usec(0);
477 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id1));
478 AddConnectionId(connection_id1);
479 epoll_server_.set_now_in_usec(10);
480 EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id2));
481 AddConnectionId(connection_id2);
482 EXPECT_EQ(2u, time_wait_list_manager_.num_connections());
484 const QuicTime::Delta time_wait_period =
485 QuicTimeWaitListManagerPeer::time_wait_period(&time_wait_list_manager_);
486 epoll_server_.set_now_in_usec(time_wait_period.ToMicroseconds() + 1);
488 EXPECT_CALL(epoll_server_, RegisterAlarm(_, _));
490 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(connection_id1));
491 time_wait_list_manager_.CleanUpOldConnectionIds();
492 EXPECT_FALSE(IsConnectionIdInTimeWait(connection_id1));
493 EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id2));
494 EXPECT_EQ(1u, time_wait_list_manager_.num_connections());
497 TEST_F(QuicTimeWaitListManagerTest, MaxConnectionsTest) {
498 // Basically, shut off time-based eviction.
499 FLAGS_quic_time_wait_list_seconds = 10000000000;
500 FLAGS_quic_time_wait_list_max_connections = 5;
502 QuicConnectionId current_connection_id = 0;
503 // Add exactly the maximum number of connections
504 for (int64 i = 0; i < FLAGS_quic_time_wait_list_max_connections; ++i) {
505 ++current_connection_id;
506 EXPECT_FALSE(IsConnectionIdInTimeWait(current_connection_id));
507 EXPECT_CALL(visitor_,
508 OnConnectionAddedToTimeWaitList(current_connection_id));
509 AddConnectionId(current_connection_id);
510 EXPECT_EQ(current_connection_id, time_wait_list_manager_.num_connections());
511 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id));
514 // Now keep adding. Since we're already at the max, every new connection-id
515 // will evict the oldest one.
516 for (int64 i = 0; i < FLAGS_quic_time_wait_list_max_connections; ++i) {
517 ++current_connection_id;
518 const QuicConnectionId id_to_evict =
519 current_connection_id - FLAGS_quic_time_wait_list_max_connections;
520 EXPECT_TRUE(IsConnectionIdInTimeWait(id_to_evict));
521 EXPECT_FALSE(IsConnectionIdInTimeWait(current_connection_id));
522 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(id_to_evict));
523 EXPECT_CALL(visitor_,
524 OnConnectionAddedToTimeWaitList(current_connection_id));
525 AddConnectionId(current_connection_id);
526 EXPECT_EQ(static_cast<size_t>(FLAGS_quic_time_wait_list_max_connections),
527 time_wait_list_manager_.num_connections());
528 EXPECT_FALSE(IsConnectionIdInTimeWait(id_to_evict));
529 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id));
533 } // namespace
534 } // namespace test
535 } // namespace tools
536 } // namespace net