OLD | NEW |
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 442 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
443 ProcessUdpPacket(_, _, _)) | 443 ProcessUdpPacket(_, _, _)) |
444 .WillOnce( | 444 .WillOnce( |
445 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 445 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
446 &MockQuicConnection::ReallyProcessUdpPacket)); | 446 &MockQuicConnection::ReallyProcessUdpPacket)); |
447 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received); | 447 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received); |
448 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); | 448 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); |
449 | 449 |
450 // Dispatcher forwards subsequent packets for this connection_id to the time | 450 // Dispatcher forwards subsequent packets for this connection_id to the time |
451 // wait list manager. | 451 // wait list manager. |
452 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) | 452 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id)) |
453 .Times(1); | 453 .Times(1); |
454 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 454 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
455 .Times(0); | 455 .Times(0); |
456 ProcessPacket(client_address, connection_id, true, "data"); | 456 ProcessPacket(client_address, connection_id, true, "data"); |
457 } | 457 } |
458 | 458 |
459 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) { | 459 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) { |
460 CreateTimeWaitListManager(); | 460 CreateTimeWaitListManager(); |
461 | 461 |
462 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 462 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
463 QuicConnectionId connection_id = 1; | 463 QuicConnectionId connection_id = 1; |
464 // 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 |
465 // list manager. | 465 // list manager. |
466 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 466 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
467 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) | 467 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id)) |
468 .Times(1); | 468 .Times(1); |
469 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 469 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
470 .Times(1); | 470 .Times(1); |
471 ProcessPacket(client_address, connection_id, false, SerializeCHLO()); | 471 ProcessPacket(client_address, connection_id, false, SerializeCHLO()); |
472 } | 472 } |
473 | 473 |
474 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { | 474 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { |
475 CreateTimeWaitListManager(); | 475 CreateTimeWaitListManager(); |
476 | 476 |
477 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0); | 477 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0); |
478 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); | 478 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); |
479 | 479 |
480 // dispatcher_ should drop this packet. | 480 // dispatcher_ should drop this packet. |
481 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0); | 481 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0); |
482 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _)).Times(0); | 482 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _)).Times(0); |
483 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 483 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
484 .Times(0); | 484 .Times(0); |
485 ProcessPacket(client_address, 1, true, SerializeCHLO()); | 485 ProcessPacket(client_address, 1, true, SerializeCHLO()); |
486 } | 486 } |
487 | 487 |
488 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) { | 488 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) { |
489 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 489 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
490 QuicConnectionId connection_id = 1; | 490 QuicConnectionId connection_id = 1; |
491 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); | 491 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); |
492 | 492 |
(...skipping 16 matching lines...) Expand all Loading... |
509 } | 509 } |
510 | 510 |
511 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) { | 511 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) { |
512 CreateTimeWaitListManager(); | 512 CreateTimeWaitListManager(); |
513 | 513 |
514 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 514 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
515 QuicConnectionId connection_id = 1; | 515 QuicConnectionId connection_id = 1; |
516 // 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 |
517 // list manager. | 517 // list manager. |
518 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 518 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
519 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) | 519 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id)) |
520 .Times(1); | 520 .Times(1); |
521 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 521 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
522 .Times(1); | 522 .Times(1); |
523 // 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 |
524 // connection. | 524 // connection. |
525 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), | 525 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), |
526 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, | 526 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, |
527 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); | 527 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); |
528 } | 528 } |
529 | 529 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject", | 742 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject", |
743 ConnectionCloseBehavior::SILENT_CLOSE); | 743 ConnectionCloseBehavior::SILENT_CLOSE); |
744 } | 744 } |
745 | 745 |
746 // 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, |
747 // the existing connection_id will go on the time-wait list. | 747 // the existing connection_id will go on the time-wait list. |
748 EXPECT_EQ(ExpectStatelessReject(), | 748 EXPECT_EQ(ExpectStatelessReject(), |
749 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); | 749 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); |
750 if (ExpectStatelessReject()) { | 750 if (ExpectStatelessReject()) { |
751 // The second packet will be processed on the time-wait list. | 751 // The second packet will be processed on the time-wait list. |
752 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) | 752 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id)) |
753 .Times(1); | 753 .Times(1); |
754 } else { | 754 } else { |
755 // The second packet will trigger a packet-validation | 755 // The second packet will trigger a packet-validation |
756 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 756 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
757 ProcessUdpPacket(_, _, _)) | 757 ProcessUdpPacket(_, _, _)) |
758 .Times(1) | 758 .Times(1) |
759 .WillOnce(testing::WithArgs<2>( | 759 .WillOnce(testing::WithArgs<2>( |
760 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, | 760 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, |
761 base::Unretained(this), connection_id)))); | 761 base::Unretained(this), connection_id)))); |
762 } | 762 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 853 |
854 // Packets with truncated connection IDs should be dropped. | 854 // Packets with truncated connection IDs should be dropped. |
855 TEST_F(QuicDispatcherTestStrayPacketConnectionId, | 855 TEST_F(QuicDispatcherTestStrayPacketConnectionId, |
856 StrayPacketTruncatedConnectionId) { | 856 StrayPacketTruncatedConnectionId) { |
857 CreateTimeWaitListManager(); | 857 CreateTimeWaitListManager(); |
858 | 858 |
859 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 859 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
860 QuicConnectionId connection_id = 1; | 860 QuicConnectionId connection_id = 1; |
861 // Dispatcher drops this packet. | 861 // Dispatcher drops this packet. |
862 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 862 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
863 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) | 863 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id)) |
864 .Times(0); | 864 .Times(0); |
865 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 865 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
866 .Times(0); | 866 .Times(0); |
867 ProcessPacket(client_address, connection_id, true, "data", | 867 ProcessPacket(client_address, connection_id, true, "data", |
868 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); | 868 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); |
869 } | 869 } |
870 | 870 |
871 class BlockingWriter : public QuicPacketWriterWrapper { | 871 class BlockingWriter : public QuicPacketWriterWrapper { |
872 public: | 872 public: |
873 BlockingWriter() : write_blocked_(false) {} | 873 BlockingWriter() : write_blocked_(false) {} |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 | 1338 |
1339 mock_helper_.AdvanceTime( | 1339 mock_helper_.AdvanceTime( |
1340 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)); | 1340 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)); |
1341 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store); | 1341 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store); |
1342 // Cancel alarm as if it had been fired. | 1342 // Cancel alarm as if it had been fired. |
1343 alarm->Cancel(); | 1343 alarm->Cancel(); |
1344 store->OnExpirationTimeout(); | 1344 store->OnExpirationTimeout(); |
1345 // 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 |
1346 // list. | 1346 // list. |
1347 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 1347 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
1348 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _)); | 1348 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id)); |
1349 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO()); | 1349 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO()); |
1350 } | 1350 } |
1351 | 1351 |
1352 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { | 1352 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { |
1353 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; |
1354 // Process more than (|kMaxNumSessionsToCreate| + | 1354 // Process more than (|kMaxNumSessionsToCreate| + |
1355 // |kDefaultMaxConnectionsInStore|) CHLOs, | 1355 // |kDefaultMaxConnectionsInStore|) CHLOs, |
1356 // the first |kMaxNumSessionsToCreate| should create connections immediately, | 1356 // the first |kMaxNumSessionsToCreate| should create connections immediately, |
1357 // the next |kDefaultMaxConnectionsInStore| should be buffered, | 1357 // the next |kDefaultMaxConnectionsInStore| should be buffered, |
1358 // the rest should be dropped. | 1358 // the rest should be dropped. |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 | 1696 |
1697 QuicConnectionId conn_id = 1; | 1697 QuicConnectionId conn_id = 1; |
1698 | 1698 |
1699 testing::MockFunction<void(int check_point)> check; | 1699 testing::MockFunction<void(int check_point)> check; |
1700 { | 1700 { |
1701 InSequence s; | 1701 InSequence s; |
1702 EXPECT_CALL(check, Call(1)); | 1702 EXPECT_CALL(check, Call(1)); |
1703 EXPECT_CALL(*time_wait_list_manager_, | 1703 EXPECT_CALL(*time_wait_list_manager_, |
1704 AddConnectionIdToTimeWait(conn_id, _, true, _)); | 1704 AddConnectionIdToTimeWait(conn_id, _, true, _)); |
1705 EXPECT_CALL(*time_wait_list_manager_, | 1705 EXPECT_CALL(*time_wait_list_manager_, |
1706 ProcessPacket(_, client_addr_, conn_id, _)); | 1706 ProcessPacket(_, client_addr_, conn_id)); |
1707 | 1707 |
1708 EXPECT_CALL(check, Call(2)); | 1708 EXPECT_CALL(check, Call(2)); |
1709 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) | 1709 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) |
1710 .Times(0); | 1710 .Times(0); |
1711 EXPECT_CALL(*time_wait_list_manager_, | 1711 EXPECT_CALL(*time_wait_list_manager_, |
1712 ProcessPacket(_, client_addr_, conn_id, _)); | 1712 ProcessPacket(_, client_addr_, conn_id)); |
1713 } | 1713 } |
1714 | 1714 |
1715 // Send a CHLO that the StatelessRejector will reject. | 1715 // Send a CHLO that the StatelessRejector will reject. |
1716 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO()); | 1716 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO()); |
1717 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1717 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1718 | 1718 |
1719 // Complete the ProofSource::GetProof call and verify that the connection and | 1719 // Complete the ProofSource::GetProof call and verify that the connection and |
1720 // packet are processed by the time wait list manager. | 1720 // packet are processed by the time wait list manager. |
1721 check.Call(1); | 1721 check.Call(1); |
1722 GetFakeProofSource()->InvokePendingCallback(0); | 1722 GetFakeProofSource()->InvokePendingCallback(0); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 testing::MockFunction<void(int check_point)> check; | 1818 testing::MockFunction<void(int check_point)> check; |
1819 { | 1819 { |
1820 InSequence s; | 1820 InSequence s; |
1821 | 1821 |
1822 EXPECT_CALL(check, Call(1)); | 1822 EXPECT_CALL(check, Call(1)); |
1823 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_)) | 1823 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_)) |
1824 .Times(0); | 1824 .Times(0); |
1825 EXPECT_CALL(*time_wait_list_manager_, | 1825 EXPECT_CALL(*time_wait_list_manager_, |
1826 AddConnectionIdToTimeWait(conn_id_2, _, true, _)); | 1826 AddConnectionIdToTimeWait(conn_id_2, _, true, _)); |
1827 EXPECT_CALL(*time_wait_list_manager_, | 1827 EXPECT_CALL(*time_wait_list_manager_, |
1828 ProcessPacket(_, client_addr_, conn_id_2, _)); | 1828 ProcessPacket(_, client_addr_, conn_id_2)); |
1829 | 1829 |
1830 EXPECT_CALL(check, Call(2)); | 1830 EXPECT_CALL(check, Call(2)); |
1831 EXPECT_CALL(*time_wait_list_manager_, | 1831 EXPECT_CALL(*time_wait_list_manager_, |
1832 ProcessPacket(_, client_addr_, conn_id_2, _)); | 1832 ProcessPacket(_, client_addr_, conn_id_2)); |
1833 | 1833 |
1834 EXPECT_CALL(check, Call(3)); | 1834 EXPECT_CALL(check, Call(3)); |
1835 EXPECT_CALL(*dispatcher_, | 1835 EXPECT_CALL(*dispatcher_, |
1836 ShouldCreateOrBufferPacketForConnection(conn_id_1)); | 1836 ShouldCreateOrBufferPacketForConnection(conn_id_1)); |
1837 | 1837 |
1838 EXPECT_CALL(check, Call(4)); | 1838 EXPECT_CALL(check, Call(4)); |
1839 EXPECT_CALL(*time_wait_list_manager_, | 1839 EXPECT_CALL(*time_wait_list_manager_, |
1840 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); | 1840 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); |
1841 EXPECT_CALL(*time_wait_list_manager_, | 1841 EXPECT_CALL(*time_wait_list_manager_, |
1842 ProcessPacket(_, client_addr_, conn_id_1, _)); | 1842 ProcessPacket(_, client_addr_, conn_id_1)); |
1843 } | 1843 } |
1844 | 1844 |
1845 // Send a CHLO that the StatelessRejector will reject. | 1845 // Send a CHLO that the StatelessRejector will reject. |
1846 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1846 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
1847 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1847 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1848 | 1848 |
1849 // Send another CHLO that the StatelessRejector will reject. | 1849 // Send another CHLO that the StatelessRejector will reject. |
1850 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO()); | 1850 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO()); |
1851 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2); | 1851 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2); |
1852 | 1852 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 EXPECT_CALL(check, Call(1)); | 1891 EXPECT_CALL(check, Call(1)); |
1892 EXPECT_CALL(*dispatcher_, | 1892 EXPECT_CALL(*dispatcher_, |
1893 ShouldCreateOrBufferPacketForConnection(conn_id_1)); | 1893 ShouldCreateOrBufferPacketForConnection(conn_id_1)); |
1894 | 1894 |
1895 EXPECT_CALL(check, Call(2)); | 1895 EXPECT_CALL(check, Call(2)); |
1896 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_)) | 1896 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_)) |
1897 .Times(0); | 1897 .Times(0); |
1898 EXPECT_CALL(*time_wait_list_manager_, | 1898 EXPECT_CALL(*time_wait_list_manager_, |
1899 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); | 1899 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); |
1900 EXPECT_CALL(*time_wait_list_manager_, | 1900 EXPECT_CALL(*time_wait_list_manager_, |
1901 ProcessPacket(_, client_addr_, conn_id_1, _)); | 1901 ProcessPacket(_, client_addr_, conn_id_1)); |
1902 } | 1902 } |
1903 | 1903 |
1904 // Send a CHLO that the StatelessRejector will reject. | 1904 // Send a CHLO that the StatelessRejector will reject. |
1905 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1905 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
1906 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1906 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1907 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1)); | 1907 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1)); |
1908 | 1908 |
1909 // Send an identical CHLO which should get buffered. | 1909 // Send an identical CHLO which should get buffered. |
1910 check.Call(1); | 1910 check.Call(1); |
1911 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1911 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
(...skipping 19 matching lines...) Expand all Loading... |
1931 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock()); | 1931 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock()); |
1932 | 1932 |
1933 testing::MockFunction<void(int check_point)> check; | 1933 testing::MockFunction<void(int check_point)> check; |
1934 { | 1934 { |
1935 InSequence s; | 1935 InSequence s; |
1936 EXPECT_CALL(check, Call(1)); | 1936 EXPECT_CALL(check, Call(1)); |
1937 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); | 1937 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); |
1938 | 1938 |
1939 EXPECT_CALL(check, Call(2)); | 1939 EXPECT_CALL(check, Call(2)); |
1940 EXPECT_CALL(*time_wait_list_manager_, | 1940 EXPECT_CALL(*time_wait_list_manager_, |
1941 ProcessPacket(_, client_addr_, conn_id, _)); | 1941 ProcessPacket(_, client_addr_, conn_id)); |
1942 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) | 1942 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) |
1943 .Times(0); | 1943 .Times(0); |
1944 } | 1944 } |
1945 | 1945 |
1946 // Send a CHLO that the StatelessRejector will accept. | 1946 // Send a CHLO that the StatelessRejector will accept. |
1947 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO()); | 1947 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO()); |
1948 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1948 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1949 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); | 1949 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); |
1950 | 1950 |
1951 // 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 Loading... |
2037 check.Call(2); | 2037 check.Call(2); |
2038 GetFakeProofSource()->InvokePendingCallback(0); | 2038 GetFakeProofSource()->InvokePendingCallback(0); |
2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); | 2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); |
2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); | 2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); |
2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
2042 } | 2042 } |
2043 | 2043 |
2044 } // namespace | 2044 } // namespace |
2045 } // namespace test | 2045 } // namespace test |
2046 } // namespace net | 2046 } // namespace net |
OLD | NEW |