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 1975403002: Deprecate --quic_stateless_version_negotiation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121437600
Patch Set: Created 4 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') | 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()), 304 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()),
305 ProcessUdpPacket(_, _, _)) 305 ProcessUdpPacket(_, _, _))
306 .Times(1) 306 .Times(1)
307 .WillOnce(testing::WithArgs<2>( 307 .WillOnce(testing::WithArgs<2>(
308 Invoke(this, &QuicDispatcherTest::ValidatePacket))); 308 Invoke(this, &QuicDispatcherTest::ValidatePacket)));
309 ProcessPacket(client_address, 1, false, false, "eep"); 309 ProcessPacket(client_address, 1, false, false, "eep");
310 } 310 }
311 311
312 TEST_F(QuicDispatcherTest, StatelessVersionNegotiation) { 312 TEST_F(QuicDispatcherTest, StatelessVersionNegotiation) {
313 ValueRestore<bool> old_flag(&FLAGS_quic_stateless_version_negotiation, true);
314 IPEndPoint client_address(net::test::Loopback4(), 1); 313 IPEndPoint client_address(net::test::Loopback4(), 1);
315 server_address_ = IPEndPoint(net::test::Any4(), 5); 314 server_address_ = IPEndPoint(net::test::Any4(), 5);
316 315
317 EXPECT_CALL(dispatcher_, CreateQuicSession(1, client_address)).Times(0); 316 EXPECT_CALL(dispatcher_, CreateQuicSession(1, client_address)).Times(0);
318 QuicVersion version = static_cast<QuicVersion>(QuicVersionMin() - 1); 317 QuicVersion version = static_cast<QuicVersion>(QuicVersionMin() - 1);
319 ProcessPacket(client_address, 1, true, version, "foo", 318 ProcessPacket(client_address, 1, true, version, "foo",
320 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); 319 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1);
321 } 320 }
322 321
323 TEST_F(QuicDispatcherTest, StatefulVersionNegotiation) {
324 ValueRestore<bool> old_flag(&FLAGS_quic_stateless_version_negotiation, false);
325 IPEndPoint client_address(net::test::Loopback4(), 1);
326 server_address_ = IPEndPoint(net::test::Any4(), 5);
327
328 EXPECT_CALL(dispatcher_, CreateQuicSession(1, client_address))
329 .WillOnce(testing::Return(CreateSession(
330 &dispatcher_, config_, 1, client_address, &mock_helper_,
331 &mock_alarm_factory_, &crypto_config_,
332 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_)));
333 QuicVersion version = static_cast<QuicVersion>(QuicVersionMin() - 1);
334 ProcessPacket(client_address, 1, true, version, "foo",
335 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1);
336 }
337
338 TEST_F(QuicDispatcherTest, Shutdown) { 322 TEST_F(QuicDispatcherTest, Shutdown) {
339 IPEndPoint client_address(net::test::Loopback4(), 1); 323 IPEndPoint client_address(net::test::Loopback4(), 1);
340 324
341 EXPECT_CALL(dispatcher_, CreateQuicSession(_, client_address)) 325 EXPECT_CALL(dispatcher_, CreateQuicSession(_, client_address))
342 .WillOnce(testing::Return(CreateSession( 326 .WillOnce(testing::Return(CreateSession(
343 &dispatcher_, config_, 1, client_address, &mock_helper_, 327 &dispatcher_, config_, 1, client_address, &mock_helper_,
344 &mock_alarm_factory_, &crypto_config_, 328 &mock_alarm_factory_, &crypto_config_,
345 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_))); 329 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_)));
346 330
347 ProcessPacket(client_address, 1, true, false, "foo"); 331 ProcessPacket(client_address, 1, true, false, "foo");
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 827
844 // And we'll resume where we left off when we get another call. 828 // And we'll resume where we left off when we get another call.
845 EXPECT_CALL(*connection2(), OnCanWrite()); 829 EXPECT_CALL(*connection2(), OnCanWrite());
846 dispatcher_.OnCanWrite(); 830 dispatcher_.OnCanWrite();
847 EXPECT_FALSE(dispatcher_.HasPendingWrites()); 831 EXPECT_FALSE(dispatcher_.HasPendingWrites());
848 } 832 }
849 833
850 } // namespace 834 } // namespace
851 } // namespace test 835 } // namespace test
852 } // namespace net 836 } // 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