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

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

Issue 2512163004: Fix version manager that flip flag in-flight does not make supported versions change. (Closed)
Patch Set: Created 4 years, 1 month 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') | no next file » | 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 530 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
531 .Times(1); 531 .Times(1);
532 // A packet whose packet number is one to large to be allowed to start a 532 // A packet whose packet number is one to large to be allowed to start a
533 // connection. 533 // connection.
534 ProcessPacket(client_address, connection_id, true, false, SerializeCHLO(), 534 ProcessPacket(client_address, connection_id, true, false, SerializeCHLO(),
535 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 535 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER,
536 kDefaultPathId, 536 kDefaultPathId,
537 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); 537 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1);
538 } 538 }
539 539
540 TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) {
541 DCHECK_EQ(3u, arraysize(kSupportedQuicVersions));
542 FLAGS_quic_fix_version_manager = true;
543 FLAGS_quic_enable_version_36_v3 = true;
544 IPEndPoint client_address(Loopback4(), 1);
545 server_address_ = IPEndPoint(Any4(), 5);
546 QuicConnectionId connection_id = 1;
547
548 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
549 .Times(0);
550 ProcessPacket(client_address, connection_id, true,
551 static_cast<QuicVersion>(QuicVersionMin() - 1), SerializeCHLO(),
552 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1);
553 ++connection_id;
554 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
555 .WillOnce(testing::Return(CreateSession(
556 dispatcher_.get(), config_, connection_id, client_address,
557 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
558 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
559 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
560 ProcessUdpPacket(_, _, _))
561 .WillOnce(testing::WithArgs<2>(
562 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
563 base::Unretained(this), connection_id))));
564 ProcessPacket(client_address, connection_id, true, QuicVersionMin(),
565 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
566 PACKET_6BYTE_PACKET_NUMBER, 1);
567 ++connection_id;
568 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
569 .WillOnce(testing::Return(CreateSession(
570 dispatcher_.get(), config_, connection_id, client_address,
571 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
572 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
573 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
574 ProcessUdpPacket(_, _, _))
575 .WillOnce(testing::WithArgs<2>(
576 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
577 base::Unretained(this), connection_id))));
578 ProcessPacket(client_address, connection_id, true, QuicVersionMax(),
579 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
580 PACKET_6BYTE_PACKET_NUMBER, 1);
581 // Turn off version 36.
582 FLAGS_quic_enable_version_36_v3 = false;
583 ++connection_id;
584 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
585 .Times(0);
586 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_36,
587 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
588 PACKET_6BYTE_PACKET_NUMBER, 1);
589
590 // Turn on version 36.
591 FLAGS_quic_enable_version_36_v3 = true;
592 ++connection_id;
593 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
594 .WillOnce(testing::Return(CreateSession(
595 dispatcher_.get(), config_, connection_id, client_address,
596 &mock_helper_, &mock_alarm_factory_, &crypto_config_,
597 QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_)));
598 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
599 ProcessUdpPacket(_, _, _))
600 .WillOnce(testing::WithArgs<2>(
601 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
602 base::Unretained(this), connection_id))));
603 ProcessPacket(client_address, connection_id, true, QUIC_VERSION_35,
604 SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID,
605 PACKET_6BYTE_PACKET_NUMBER, 1);
606 }
607
540 // Enables mocking of the handshake-confirmation for stateless rejects. 608 // Enables mocking of the handshake-confirmation for stateless rejects.
541 class MockQuicCryptoServerStream : public QuicCryptoServerStream { 609 class MockQuicCryptoServerStream : public QuicCryptoServerStream {
542 public: 610 public:
543 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, 611 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config,
544 QuicCompressedCertsCache* compressed_certs_cache, 612 QuicCompressedCertsCache* compressed_certs_cache,
545 QuicServerSessionBase* session, 613 QuicServerSessionBase* session,
546 QuicCryptoServerStream::Helper* helper) 614 QuicCryptoServerStream::Helper* helper)
547 : QuicCryptoServerStream(&crypto_config, 615 : QuicCryptoServerStream(&crypto_config,
548 compressed_certs_cache, 616 compressed_certs_cache,
549 FLAGS_enable_quic_stateless_reject_support, 617 FLAGS_enable_quic_stateless_reject_support,
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 check.Call(2); 2054 check.Call(2);
1987 GetFakeProofSource()->InvokePendingCallback(0); 2055 GetFakeProofSource()->InvokePendingCallback(0);
1988 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); 2056 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0);
1989 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 2057 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
1990 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 2058 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
1991 } 2059 }
1992 2060
1993 } // namespace 2061 } // namespace
1994 } // namespace test 2062 } // namespace test
1995 } // namespace net 2063 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698