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

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

Issue 2850573002: Landing Recent QUIC changes until 3:35 PM, Apr 26, 2017 UTC-4 (Closed)
Patch Set: Remove Disconnect from ~QuicTestClient Created 3 years, 7 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
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_time_wait_list_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 .WillOnce(testing::WithArgs<2>(Invoke(CreateFunctor( 421 .WillOnce(testing::WithArgs<2>(Invoke(CreateFunctor(
422 &QuicDispatcherTest::ValidatePacket, base::Unretained(this), 1)))); 422 &QuicDispatcherTest::ValidatePacket, base::Unretained(this), 1))));
423 423
424 ProcessPacket(client_address, connection_id, true, SerializeCHLO()); 424 ProcessPacket(client_address, connection_id, true, SerializeCHLO());
425 425
426 // Close the connection by sending public reset packet. 426 // Close the connection by sending public reset packet.
427 QuicPublicResetPacket packet; 427 QuicPublicResetPacket packet;
428 packet.public_header.connection_id = connection_id; 428 packet.public_header.connection_id = connection_id;
429 packet.public_header.reset_flag = true; 429 packet.public_header.reset_flag = true;
430 packet.public_header.version_flag = false; 430 packet.public_header.version_flag = false;
431 packet.rejected_packet_number = 19191;
432 packet.nonce_proof = 132232; 431 packet.nonce_proof = 132232;
433 std::unique_ptr<QuicEncryptedPacket> encrypted( 432 std::unique_ptr<QuicEncryptedPacket> encrypted(
434 QuicFramer::BuildPublicResetPacket(packet)); 433 QuicFramer::BuildPublicResetPacket(packet));
435 std::unique_ptr<QuicReceivedPacket> received(ConstructReceivedPacket( 434 std::unique_ptr<QuicReceivedPacket> received(ConstructReceivedPacket(
436 *encrypted, session1_->connection()->clock()->Now())); 435 *encrypted, session1_->connection()->clock()->Now()));
437 EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, _, 436 EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, _,
438 ConnectionCloseSource::FROM_PEER)) 437 ConnectionCloseSource::FROM_PEER))
439 .Times(1) 438 .Times(1)
440 .WillOnce(WithoutArgs(Invoke( 439 .WillOnce(WithoutArgs(Invoke(
441 reinterpret_cast<MockServerConnection*>(session1_->connection()), 440 reinterpret_cast<MockServerConnection*>(session1_->connection()),
442 &MockServerConnection::UnregisterOnConnectionClosed))); 441 &MockServerConnection::UnregisterOnConnectionClosed)));
443 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 442 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
444 ProcessUdpPacket(_, _, _)) 443 ProcessUdpPacket(_, _, _))
445 .WillOnce( 444 .WillOnce(
446 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()), 445 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()),
447 &MockQuicConnection::ReallyProcessUdpPacket)); 446 &MockQuicConnection::ReallyProcessUdpPacket));
448 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received); 447 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received);
449 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); 448 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
450 449
451 // Dispatcher forwards subsequent packets for this connection_id to the time 450 // Dispatcher forwards subsequent packets for this connection_id to the time
452 // wait list manager. 451 // wait list manager.
453 EXPECT_CALL(*time_wait_list_manager_, 452 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id))
454 ProcessPacket(_, _, connection_id, _, _))
455 .Times(1); 453 .Times(1);
456 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 454 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
457 .Times(0); 455 .Times(0);
458 ProcessPacket(client_address, connection_id, true, "data"); 456 ProcessPacket(client_address, connection_id, true, "data");
459 } 457 }
460 458
461 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) { 459 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) {
462 CreateTimeWaitListManager(); 460 CreateTimeWaitListManager();
463 461
464 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 462 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
465 QuicConnectionId connection_id = 1; 463 QuicConnectionId connection_id = 1;
466 // Dispatcher forwards all packets for this connection_id to the time wait 464 // Dispatcher forwards all packets for this connection_id to the time wait
467 // list manager. 465 // list manager.
468 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); 466 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0);
469 EXPECT_CALL(*time_wait_list_manager_, 467 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id))
470 ProcessPacket(_, _, connection_id, _, _))
471 .Times(1); 468 .Times(1);
472 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 469 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
473 .Times(1); 470 .Times(1);
474 ProcessPacket(client_address, connection_id, false, SerializeCHLO()); 471 ProcessPacket(client_address, connection_id, false, SerializeCHLO());
475 } 472 }
476 473
477 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { 474 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) {
478 CreateTimeWaitListManager(); 475 CreateTimeWaitListManager();
479 476
480 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0); 477 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0);
481 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); 478 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5);
482 479
483 // dispatcher_ should drop this packet. 480 // dispatcher_ should drop this packet.
484 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0); 481 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0);
485 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); 482 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _)).Times(0);
486 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 483 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
487 .Times(0); 484 .Times(0);
488 ProcessPacket(client_address, 1, true, SerializeCHLO()); 485 ProcessPacket(client_address, 1, true, SerializeCHLO());
489 } 486 }
490 487
491 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) { 488 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) {
492 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 489 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
493 QuicConnectionId connection_id = 1; 490 QuicConnectionId connection_id = 1;
494 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); 491 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5);
495 492
(...skipping 16 matching lines...) Expand all
512 } 509 }
513 510
514 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) { 511 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) {
515 CreateTimeWaitListManager(); 512 CreateTimeWaitListManager();
516 513
517 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 514 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
518 QuicConnectionId connection_id = 1; 515 QuicConnectionId connection_id = 1;
519 // Dispatcher forwards this packet for this connection_id to the time wait 516 // Dispatcher forwards this packet for this connection_id to the time wait
520 // list manager. 517 // list manager.
521 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); 518 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0);
522 EXPECT_CALL(*time_wait_list_manager_, 519 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id))
523 ProcessPacket(_, _, connection_id, _, _))
524 .Times(1); 520 .Times(1);
525 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 521 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
526 .Times(1); 522 .Times(1);
527 // A packet whose packet number is one to large to be allowed to start a 523 // A packet whose packet number is one to large to be allowed to start a
528 // connection. 524 // connection.
529 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), 525 ProcessPacket(client_address, connection_id, true, SerializeCHLO(),
530 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 526 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER,
531 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); 527 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1);
532 } 528 }
533 529
534 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) { 530 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) {
535 static_assert(arraysize(kSupportedQuicVersions) == 5u, 531 static_assert(arraysize(kSupportedQuicVersions) == 5u,
536 "Supported versions out of sync"); 532 "Supported versions out of sync");
537 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; 533 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true;
538 FLAGS_quic_enable_version_39 = true; 534 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true;
539 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 535 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
540 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); 536 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5);
541 QuicConnectionId connection_id = 1; 537 QuicConnectionId connection_id = 1;
542 538
543 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 539 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
544 .Times(0); 540 .Times(0);
545 ProcessPacket(client_address, connection_id, true, 541 ProcessPacket(client_address, connection_id, true,
546 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(), 542 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(),
547 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); 543 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1);
548 ++connection_id; 544 ++connection_id;
(...skipping 19 matching lines...) Expand all
568 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 564 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
569 ProcessUdpPacket(_, _, _)) 565 ProcessUdpPacket(_, _, _))
570 .WillOnce(testing::WithArgs<2>( 566 .WillOnce(testing::WithArgs<2>(
571 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, 567 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
572 base::Unretained(this), connection_id)))); 568 base::Unretained(this), connection_id))));
573 ProcessPacket(client_address, connection_id, true, QuicVersionMax(), 569 ProcessPacket(client_address, connection_id, true, QuicVersionMax(),
574 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, 570 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
575 PACKET_6BYTE_PACKET_NUMBER, 1); 571 PACKET_6BYTE_PACKET_NUMBER, 1);
576 572
577 // Turn off version 39. 573 // Turn off version 39.
578 FLAGS_quic_enable_version_39 = false; 574 FLAGS_quic_reloadable_flag_quic_enable_version_39 = false;
579 ++connection_id; 575 ++connection_id;
580 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 576 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
581 .Times(0); 577 .Times(0);
582 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39, 578 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39,
583 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, 579 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
584 PACKET_6BYTE_PACKET_NUMBER, 1); 580 PACKET_6BYTE_PACKET_NUMBER, 1);
585 581
586 // Turn on version 39. 582 // Turn on version 39.
587 FLAGS_quic_enable_version_39 = true; 583 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true;
588 ++connection_id; 584 ++connection_id;
589 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 585 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
590 .WillOnce(testing::Return(CreateSession( 586 .WillOnce(testing::Return(CreateSession(
591 dispatcher_.get(), config_, connection_id, client_address, 587 dispatcher_.get(), config_, connection_id, client_address,
592 &mock_helper_, &mock_alarm_factory_, &crypto_config_, 588 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
593 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))); 589 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
594 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 590 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
595 ProcessUdpPacket(_, _, _)) 591 ProcessUdpPacket(_, _, _))
596 .WillOnce(testing::WithArgs<2>( 592 .WillOnce(testing::WithArgs<2>(
597 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, 593 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject", 742 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject",
747 ConnectionCloseBehavior::SILENT_CLOSE); 743 ConnectionCloseBehavior::SILENT_CLOSE);
748 } 744 }
749 745
750 // Send a second packet and check the results. If this is a stateless reject, 746 // Send a second packet and check the results. If this is a stateless reject,
751 // the existing connection_id will go on the time-wait list. 747 // the existing connection_id will go on the time-wait list.
752 EXPECT_EQ(ExpectStatelessReject(), 748 EXPECT_EQ(ExpectStatelessReject(),
753 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); 749 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
754 if (ExpectStatelessReject()) { 750 if (ExpectStatelessReject()) {
755 // The second packet will be processed on the time-wait list. 751 // The second packet will be processed on the time-wait list.
756 EXPECT_CALL(*time_wait_list_manager_, 752 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id))
757 ProcessPacket(_, _, connection_id, _, _))
758 .Times(1); 753 .Times(1);
759 } else { 754 } else {
760 // The second packet will trigger a packet-validation 755 // The second packet will trigger a packet-validation
761 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 756 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
762 ProcessUdpPacket(_, _, _)) 757 ProcessUdpPacket(_, _, _))
763 .Times(1) 758 .Times(1)
764 .WillOnce(testing::WithArgs<2>( 759 .WillOnce(testing::WithArgs<2>(
765 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, 760 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
766 base::Unretained(this), connection_id)))); 761 base::Unretained(this), connection_id))));
767 } 762 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 853
859 // Packets with truncated connection IDs should be dropped. 854 // Packets with truncated connection IDs should be dropped.
860 TEST_F(QuicDispatcherTestStrayPacketConnectionId, 855 TEST_F(QuicDispatcherTestStrayPacketConnectionId,
861 StrayPacketTruncatedConnectionId) { 856 StrayPacketTruncatedConnectionId) {
862 CreateTimeWaitListManager(); 857 CreateTimeWaitListManager();
863 858
864 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 859 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
865 QuicConnectionId connection_id = 1; 860 QuicConnectionId connection_id = 1;
866 // Dispatcher drops this packet. 861 // Dispatcher drops this packet.
867 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); 862 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0);
868 EXPECT_CALL(*time_wait_list_manager_, 863 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id))
869 ProcessPacket(_, _, connection_id, _, _))
870 .Times(0); 864 .Times(0);
871 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 865 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
872 .Times(0); 866 .Times(0);
873 ProcessPacket(client_address, connection_id, true, "data", 867 ProcessPacket(client_address, connection_id, true, "data",
874 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); 868 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER);
875 } 869 }
876 870
877 class BlockingWriter : public QuicPacketWriterWrapper { 871 class BlockingWriter : public QuicPacketWriterWrapper {
878 public: 872 public:
879 BlockingWriter() : write_blocked_(false) {} 873 BlockingWriter() : write_blocked_(false) {}
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1338
1345 mock_helper_.AdvanceTime( 1339 mock_helper_.AdvanceTime(
1346 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)); 1340 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs));
1347 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store); 1341 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store);
1348 // Cancel alarm as if it had been fired. 1342 // Cancel alarm as if it had been fired.
1349 alarm->Cancel(); 1343 alarm->Cancel();
1350 store->OnExpirationTimeout(); 1344 store->OnExpirationTimeout();
1351 // New arrived CHLO will be dropped because this connection is in time wait 1345 // New arrived CHLO will be dropped because this connection is in time wait
1352 // list. 1346 // list.
1353 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 1347 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
1354 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _, _)); 1348 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id));
1355 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO()); 1349 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO());
1356 } 1350 }
1357 1351
1358 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { 1352 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) {
1359 FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; 1353 FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true;
1360 // Process more than (|kMaxNumSessionsToCreate| + 1354 // Process more than (|kMaxNumSessionsToCreate| +
1361 // |kDefaultMaxConnectionsInStore|) CHLOs, 1355 // |kDefaultMaxConnectionsInStore|) CHLOs,
1362 // the first |kMaxNumSessionsToCreate| should create connections immediately, 1356 // the first |kMaxNumSessionsToCreate| should create connections immediately,
1363 // the next |kDefaultMaxConnectionsInStore| should be buffered, 1357 // the next |kDefaultMaxConnectionsInStore| should be buffered,
1364 // the rest should be dropped. 1358 // the rest should be dropped.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 1696
1703 QuicConnectionId conn_id = 1; 1697 QuicConnectionId conn_id = 1;
1704 1698
1705 testing::MockFunction<void(int check_point)> check; 1699 testing::MockFunction<void(int check_point)> check;
1706 { 1700 {
1707 InSequence s; 1701 InSequence s;
1708 EXPECT_CALL(check, Call(1)); 1702 EXPECT_CALL(check, Call(1));
1709 EXPECT_CALL(*time_wait_list_manager_, 1703 EXPECT_CALL(*time_wait_list_manager_,
1710 AddConnectionIdToTimeWait(conn_id, _, true, _)); 1704 AddConnectionIdToTimeWait(conn_id, _, true, _));
1711 EXPECT_CALL(*time_wait_list_manager_, 1705 EXPECT_CALL(*time_wait_list_manager_,
1712 ProcessPacket(_, client_addr_, conn_id, _, _)); 1706 ProcessPacket(_, client_addr_, conn_id));
1713 1707
1714 EXPECT_CALL(check, Call(2)); 1708 EXPECT_CALL(check, Call(2));
1715 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) 1709 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_))
1716 .Times(0); 1710 .Times(0);
1717 EXPECT_CALL(*time_wait_list_manager_, 1711 EXPECT_CALL(*time_wait_list_manager_,
1718 ProcessPacket(_, client_addr_, conn_id, _, _)); 1712 ProcessPacket(_, client_addr_, conn_id));
1719 } 1713 }
1720 1714
1721 // Send a CHLO that the StatelessRejector will reject. 1715 // Send a CHLO that the StatelessRejector will reject.
1722 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO()); 1716 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO());
1723 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); 1717 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1);
1724 1718
1725 // Complete the ProofSource::GetProof call and verify that the connection and 1719 // Complete the ProofSource::GetProof call and verify that the connection and
1726 // packet are processed by the time wait list manager. 1720 // packet are processed by the time wait list manager.
1727 check.Call(1); 1721 check.Call(1);
1728 GetFakeProofSource()->InvokePendingCallback(0); 1722 GetFakeProofSource()->InvokePendingCallback(0);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 testing::MockFunction<void(int check_point)> check; 1818 testing::MockFunction<void(int check_point)> check;
1825 { 1819 {
1826 InSequence s; 1820 InSequence s;
1827 1821
1828 EXPECT_CALL(check, Call(1)); 1822 EXPECT_CALL(check, Call(1));
1829 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_)) 1823 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_))
1830 .Times(0); 1824 .Times(0);
1831 EXPECT_CALL(*time_wait_list_manager_, 1825 EXPECT_CALL(*time_wait_list_manager_,
1832 AddConnectionIdToTimeWait(conn_id_2, _, true, _)); 1826 AddConnectionIdToTimeWait(conn_id_2, _, true, _));
1833 EXPECT_CALL(*time_wait_list_manager_, 1827 EXPECT_CALL(*time_wait_list_manager_,
1834 ProcessPacket(_, client_addr_, conn_id_2, _, _)); 1828 ProcessPacket(_, client_addr_, conn_id_2));
1835 1829
1836 EXPECT_CALL(check, Call(2)); 1830 EXPECT_CALL(check, Call(2));
1837 EXPECT_CALL(*time_wait_list_manager_, 1831 EXPECT_CALL(*time_wait_list_manager_,
1838 ProcessPacket(_, client_addr_, conn_id_2, _, _)); 1832 ProcessPacket(_, client_addr_, conn_id_2));
1839 1833
1840 EXPECT_CALL(check, Call(3)); 1834 EXPECT_CALL(check, Call(3));
1841 EXPECT_CALL(*dispatcher_, 1835 EXPECT_CALL(*dispatcher_,
1842 ShouldCreateOrBufferPacketForConnection(conn_id_1)); 1836 ShouldCreateOrBufferPacketForConnection(conn_id_1));
1843 1837
1844 EXPECT_CALL(check, Call(4)); 1838 EXPECT_CALL(check, Call(4));
1845 EXPECT_CALL(*time_wait_list_manager_, 1839 EXPECT_CALL(*time_wait_list_manager_,
1846 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); 1840 AddConnectionIdToTimeWait(conn_id_1, _, true, _));
1847 EXPECT_CALL(*time_wait_list_manager_, 1841 EXPECT_CALL(*time_wait_list_manager_,
1848 ProcessPacket(_, client_addr_, conn_id_1, _, _)); 1842 ProcessPacket(_, client_addr_, conn_id_1));
1849 } 1843 }
1850 1844
1851 // Send a CHLO that the StatelessRejector will reject. 1845 // Send a CHLO that the StatelessRejector will reject.
1852 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); 1846 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO());
1853 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); 1847 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1);
1854 1848
1855 // Send another CHLO that the StatelessRejector will reject. 1849 // Send another CHLO that the StatelessRejector will reject.
1856 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO()); 1850 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO());
1857 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2); 1851 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2);
1858 1852
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 EXPECT_CALL(check, Call(1)); 1891 EXPECT_CALL(check, Call(1));
1898 EXPECT_CALL(*dispatcher_, 1892 EXPECT_CALL(*dispatcher_,
1899 ShouldCreateOrBufferPacketForConnection(conn_id_1)); 1893 ShouldCreateOrBufferPacketForConnection(conn_id_1));
1900 1894
1901 EXPECT_CALL(check, Call(2)); 1895 EXPECT_CALL(check, Call(2));
1902 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_)) 1896 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_))
1903 .Times(0); 1897 .Times(0);
1904 EXPECT_CALL(*time_wait_list_manager_, 1898 EXPECT_CALL(*time_wait_list_manager_,
1905 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); 1899 AddConnectionIdToTimeWait(conn_id_1, _, true, _));
1906 EXPECT_CALL(*time_wait_list_manager_, 1900 EXPECT_CALL(*time_wait_list_manager_,
1907 ProcessPacket(_, client_addr_, conn_id_1, _, _)); 1901 ProcessPacket(_, client_addr_, conn_id_1));
1908 } 1902 }
1909 1903
1910 // Send a CHLO that the StatelessRejector will reject. 1904 // Send a CHLO that the StatelessRejector will reject.
1911 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); 1905 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO());
1912 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); 1906 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1);
1913 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1)); 1907 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1));
1914 1908
1915 // Send an identical CHLO which should get buffered. 1909 // Send an identical CHLO which should get buffered.
1916 check.Call(1); 1910 check.Call(1);
1917 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); 1911 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO());
(...skipping 19 matching lines...) Expand all
1937 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock()); 1931 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock());
1938 1932
1939 testing::MockFunction<void(int check_point)> check; 1933 testing::MockFunction<void(int check_point)> check;
1940 { 1934 {
1941 InSequence s; 1935 InSequence s;
1942 EXPECT_CALL(check, Call(1)); 1936 EXPECT_CALL(check, Call(1));
1943 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); 1937 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id));
1944 1938
1945 EXPECT_CALL(check, Call(2)); 1939 EXPECT_CALL(check, Call(2));
1946 EXPECT_CALL(*time_wait_list_manager_, 1940 EXPECT_CALL(*time_wait_list_manager_,
1947 ProcessPacket(_, client_addr_, conn_id, _, _)); 1941 ProcessPacket(_, client_addr_, conn_id));
1948 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) 1942 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_))
1949 .Times(0); 1943 .Times(0);
1950 } 1944 }
1951 1945
1952 // Send a CHLO that the StatelessRejector will accept. 1946 // Send a CHLO that the StatelessRejector will accept.
1953 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO()); 1947 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO());
1954 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); 1948 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1);
1955 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 1949 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
1956 1950
1957 // Send a data packet that will get buffered 1951 // Send a data packet that will get buffered
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 check.Call(2); 2037 check.Call(2);
2044 GetFakeProofSource()->InvokePendingCallback(0); 2038 GetFakeProofSource()->InvokePendingCallback(0);
2045 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); 2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0);
2046 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
2047 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
2048 } 2042 }
2049 2043
2050 } // namespace 2044 } // namespace
2051 } // namespace test 2045 } // namespace test
2052 } // namespace net 2046 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_time_wait_list_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698