| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_time_wait_list_manager.h" | 5 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "net/quic/crypto/crypto_protocol.h" | 9 #include "net/quic/crypto/crypto_protocol.h" |
| 10 #include "net/quic/crypto/null_encrypter.h" | 10 #include "net/quic/crypto/null_encrypter.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 EXPECT_CALL(epoll_server_, RegisterAlarm(_, _)); | 481 EXPECT_CALL(epoll_server_, RegisterAlarm(_, _)); |
| 482 | 482 |
| 483 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(kConnectionId1)); | 483 EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(kConnectionId1)); |
| 484 time_wait_list_manager_.CleanUpOldConnectionIds(); | 484 time_wait_list_manager_.CleanUpOldConnectionIds(); |
| 485 EXPECT_FALSE(IsConnectionIdInTimeWait(kConnectionId1)); | 485 EXPECT_FALSE(IsConnectionIdInTimeWait(kConnectionId1)); |
| 486 EXPECT_TRUE(IsConnectionIdInTimeWait(kConnectionId2)); | 486 EXPECT_TRUE(IsConnectionIdInTimeWait(kConnectionId2)); |
| 487 EXPECT_EQ(1u, time_wait_list_manager_.num_connections()); | 487 EXPECT_EQ(1u, time_wait_list_manager_.num_connections()); |
| 488 } | 488 } |
| 489 | 489 |
| 490 TEST_F(QuicTimeWaitListManagerTest, MaxConnectionsTest) { | 490 TEST_F(QuicTimeWaitListManagerTest, MaxConnectionsTest) { |
| 491 ValueRestore<bool> old_flag(&FLAGS_quic_limit_time_wait_list_size, true); | |
| 492 // Basically, shut off time-based eviction. | 491 // Basically, shut off time-based eviction. |
| 493 FLAGS_quic_time_wait_list_seconds = 10000000000; | 492 FLAGS_quic_time_wait_list_seconds = 10000000000; |
| 494 FLAGS_quic_time_wait_list_max_connections = 5; | 493 FLAGS_quic_time_wait_list_max_connections = 5; |
| 495 | 494 |
| 496 QuicConnectionId current_connection_id = 0; | 495 QuicConnectionId current_connection_id = 0; |
| 497 // Add exactly the maximum number of connections | 496 // Add exactly the maximum number of connections |
| 498 for (int64 i = 0; i < FLAGS_quic_time_wait_list_max_connections; ++i) { | 497 for (int64 i = 0; i < FLAGS_quic_time_wait_list_max_connections; ++i) { |
| 499 ++current_connection_id; | 498 ++current_connection_id; |
| 500 EXPECT_FALSE(IsConnectionIdInTimeWait(current_connection_id)); | 499 EXPECT_FALSE(IsConnectionIdInTimeWait(current_connection_id)); |
| 501 EXPECT_CALL(visitor_, | 500 EXPECT_CALL(visitor_, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 521 time_wait_list_manager_.num_connections()); | 520 time_wait_list_manager_.num_connections()); |
| 522 EXPECT_FALSE(IsConnectionIdInTimeWait(id_to_evict)); | 521 EXPECT_FALSE(IsConnectionIdInTimeWait(id_to_evict)); |
| 523 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id)); | 522 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id)); |
| 524 } | 523 } |
| 525 } | 524 } |
| 526 | 525 |
| 527 } // namespace | 526 } // namespace |
| 528 } // namespace test | 527 } // namespace test |
| 529 } // namespace tools | 528 } // namespace tools |
| 530 } // namespace net | 529 } // namespace net |
| OLD | NEW |