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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
530 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) { | 530 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) { |
531 static_assert(arraysize(kSupportedQuicVersions) == 5u, | 531 static_assert(arraysize(kSupportedQuicVersions) == 5u, |
532 "Supported versions out of sync"); | 532 "Supported versions out of sync"); |
533 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; | 533 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; |
534 FLAGS_quic_enable_version_39 = true; | 534 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true; |
535 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 535 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
536 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); | 536 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); |
537 QuicConnectionId connection_id = 1; | 537 QuicConnectionId connection_id = 1; |
538 | 538 |
539 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) | 539 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) |
540 .Times(0); | 540 .Times(0); |
541 ProcessPacket(client_address, connection_id, true, | 541 ProcessPacket(client_address, connection_id, true, |
542 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(), | 542 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(), |
543 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); | 543 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); |
544 ++connection_id; | 544 ++connection_id; |
(...skipping 19 matching lines...) Expand all Loading... |
564 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 564 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
565 ProcessUdpPacket(_, _, _)) | 565 ProcessUdpPacket(_, _, _)) |
566 .WillOnce(testing::WithArgs<2>( | 566 .WillOnce(testing::WithArgs<2>( |
567 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, | 567 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, |
568 base::Unretained(this), connection_id)))); | 568 base::Unretained(this), connection_id)))); |
569 ProcessPacket(client_address, connection_id, true, QuicVersionMax(), | 569 ProcessPacket(client_address, connection_id, true, QuicVersionMax(), |
570 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, | 570 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, |
571 PACKET_6BYTE_PACKET_NUMBER, 1); | 571 PACKET_6BYTE_PACKET_NUMBER, 1); |
572 | 572 |
573 // Turn off version 39. | 573 // Turn off version 39. |
574 FLAGS_quic_enable_version_39 = false; | 574 FLAGS_quic_reloadable_flag_quic_enable_version_39 = false; |
575 ++connection_id; | 575 ++connection_id; |
576 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) | 576 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) |
577 .Times(0); | 577 .Times(0); |
578 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39, | 578 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39, |
579 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, | 579 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, |
580 PACKET_6BYTE_PACKET_NUMBER, 1); | 580 PACKET_6BYTE_PACKET_NUMBER, 1); |
581 | 581 |
582 // Turn on version 39. | 582 // Turn on version 39. |
583 FLAGS_quic_enable_version_39 = true; | 583 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true; |
584 ++connection_id; | 584 ++connection_id; |
585 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) | 585 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) |
586 .WillOnce(testing::Return(CreateSession( | 586 .WillOnce(testing::Return(CreateSession( |
587 dispatcher_.get(), config_, connection_id, client_address, | 587 dispatcher_.get(), config_, connection_id, client_address, |
588 &mock_helper_, &mock_alarm_factory_, &crypto_config_, | 588 &mock_helper_, &mock_alarm_factory_, &crypto_config_, |
589 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))); | 589 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))); |
590 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 590 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
591 ProcessUdpPacket(_, _, _)) | 591 ProcessUdpPacket(_, _, _)) |
592 .WillOnce(testing::WithArgs<2>( | 592 .WillOnce(testing::WithArgs<2>( |
593 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, | 593 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, |
(...skipping 1443 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 |