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

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

Issue 2875333002: Landing Recent QUIC changes until Mon May 8 21:42:46 2017 +0000 (Closed)
Patch Set: 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_simple_server_stream.cc » ('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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 522 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
523 .Times(1); 523 .Times(1);
524 // A packet whose packet number is one to large to be allowed to start a 524 // A packet whose packet number is one to large to be allowed to start a
525 // connection. 525 // connection.
526 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), 526 ProcessPacket(client_address, connection_id, true, SerializeCHLO(),
527 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 527 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER,
528 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); 528 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1);
529 } 529 }
530 530
531 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) { 531 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) {
532 static_assert(arraysize(kSupportedQuicVersions) == 5u, 532 static_assert(arraysize(kSupportedQuicVersions) == 6u,
533 "Supported versions out of sync"); 533 "Supported versions out of sync");
534 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; 534 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true;
535 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true; 535 FLAGS_quic_reloadable_flag_quic_enable_version_39 = true;
536 SetQuicFlag(&FLAGS_quic_enable_version_40, true);
536 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 537 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
537 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); 538 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5);
538 QuicConnectionId connection_id = 1; 539 QuicConnectionId connection_id = 1;
539 540
540 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 541 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
541 .Times(0); 542 .Times(0);
542 ProcessPacket(client_address, connection_id, true, 543 ProcessPacket(client_address, connection_id, true,
543 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(), 544 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(),
544 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); 545 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1);
545 ++connection_id; 546 ++connection_id;
(...skipping 17 matching lines...) Expand all
563 &mock_helper_, &mock_alarm_factory_, &crypto_config_, 564 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
564 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))); 565 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
565 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 566 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
566 ProcessUdpPacket(_, _, _)) 567 ProcessUdpPacket(_, _, _))
567 .WillOnce(testing::WithArgs<2>( 568 .WillOnce(testing::WithArgs<2>(
568 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, 569 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
569 base::Unretained(this), connection_id)))); 570 base::Unretained(this), connection_id))));
570 ProcessPacket(client_address, connection_id, true, QuicVersionMax(), 571 ProcessPacket(client_address, connection_id, true, QuicVersionMax(),
571 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, 572 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
572 PACKET_6BYTE_PACKET_NUMBER, 1); 573 PACKET_6BYTE_PACKET_NUMBER, 1);
574 // Turn off version 40.
575 SetQuicFlag(&FLAGS_quic_enable_version_40, false);
576 ++connection_id;
577 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
578 .Times(0);
579 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_40,
580 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
581 PACKET_6BYTE_PACKET_NUMBER, 1);
582
583 // Turn on version 40.
584 SetQuicFlag(&FLAGS_quic_enable_version_40, true);
585 ++connection_id;
586 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
587 .WillOnce(testing::Return(CreateSession(
588 dispatcher_.get(), config_, connection_id, client_address,
589 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
590 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
591 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
592 ProcessUdpPacket(_, _, _))
593 .WillOnce(testing::WithArgs<2>(
594 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
595 base::Unretained(this), connection_id))));
596 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_40,
597 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
598 PACKET_6BYTE_PACKET_NUMBER, 1);
573 599
574 // Turn off version 39. 600 // Turn off version 39.
575 FLAGS_quic_reloadable_flag_quic_enable_version_39 = false; 601 FLAGS_quic_reloadable_flag_quic_enable_version_39 = false;
576 ++connection_id; 602 ++connection_id;
577 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 603 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
578 .Times(0); 604 .Times(0);
579 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39, 605 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_39,
580 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, 606 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
581 PACKET_6BYTE_PACKET_NUMBER, 1); 607 PACKET_6BYTE_PACKET_NUMBER, 1);
582 608
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 check.Call(2); 2064 check.Call(2);
2039 GetFakeProofSource()->InvokePendingCallback(0); 2065 GetFakeProofSource()->InvokePendingCallback(0);
2040 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); 2066 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0);
2041 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 2067 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
2042 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 2068 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
2043 } 2069 }
2044 2070
2045 } // namespace 2071 } // namespace
2046 } // namespace test 2072 } // namespace test
2047 } // namespace net 2073 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_simple_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698