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

Side by Side Diff: net/tools/quic/quic_time_wait_list_manager_test.cc

Issue 968233004: Land Recent QUIC Changes until 03/02/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/tools/quic/quic_time_wait_list_manager.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698