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

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 22311013: Removing QUIC's VERSION_6, now that QUIC no longer needs to support the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with trunk Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/proof_source.h ('k') | net/quic/quic_framer.h » ('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/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/quic/congestion_control/receive_algorithm_interface.h" 10 #include "net/quic/congestion_control/receive_algorithm_interface.h"
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 EXPECT_TRUE(NULL != packet.get()); 2366 EXPECT_TRUE(NULL != packet.get());
2367 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket( 2367 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(
2368 ENCRYPTION_NONE, 1, *packet)); 2368 ENCRYPTION_NONE, 1, *packet));
2369 2369
2370 EXPECT_CALL(visitor_, ConnectionClose(QUIC_PEER_GOING_AWAY, true)); 2370 EXPECT_CALL(visitor_, ConnectionClose(QUIC_PEER_GOING_AWAY, true));
2371 EXPECT_CALL(visitor_, OnPacket(_, _, _, _)).Times(0); 2371 EXPECT_CALL(visitor_, OnPacket(_, _, _, _)).Times(0);
2372 2372
2373 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted); 2373 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted);
2374 } 2374 }
2375 2375
2376 // The QUIC_VERSION_X versions are deliberately set, rather than using all
2377 // values in kSupportedQuicVersions.
2378 TEST_F(QuicConnectionTest, SelectMutualVersion) { 2376 TEST_F(QuicConnectionTest, SelectMutualVersion) {
2379 // Set the connection to speak QUIC_VERSION_6. 2377 // Set the connection to speak the lowest quic version.
2380 connection_.set_version(QUIC_VERSION_6); 2378 connection_.set_version(QuicVersionMin());
2381 EXPECT_EQ(connection_.version(), QUIC_VERSION_6); 2379 EXPECT_EQ(QuicVersionMin(), connection_.version());
2382 2380
2383 // Pass in available versions which includes a higher mutually supported 2381 // Pass in available versions which includes a higher mutually supported
2384 // version. The higher mutually supported version should be selected. 2382 // version. The higher mutually supported version should be selected.
2385 QuicVersionVector available_versions; 2383 QuicVersionVector supported_versions;
2386 available_versions.push_back(QUIC_VERSION_6); 2384 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
2387 available_versions.push_back(QUIC_VERSION_7); 2385 supported_versions.push_back(kSupportedQuicVersions[i]);
2388 EXPECT_TRUE(connection_.SelectMutualVersion(available_versions)); 2386 }
2389 EXPECT_EQ(connection_.version(), QUIC_VERSION_7); 2387 EXPECT_TRUE(connection_.SelectMutualVersion(supported_versions));
2388 EXPECT_EQ(QuicVersionMax(), connection_.version());
2390 2389
2391 // Expect that the lower version is selected. 2390 // Expect that the lowest version is selected.
2392 QuicVersionVector lower_version; 2391 // Ensure the lowest supported version is less than the max, unless they're
2393 lower_version.push_back(QUIC_VERSION_6); 2392 // the same.
2394 EXPECT_TRUE(connection_.SelectMutualVersion(lower_version)); 2393 EXPECT_LE(QuicVersionMin(), QuicVersionMax());
2395 EXPECT_EQ(connection_.version(), QUIC_VERSION_6); 2394 QuicVersionVector lowest_version_vector;
2395 lowest_version_vector.push_back(QuicVersionMin());
2396 EXPECT_TRUE(connection_.SelectMutualVersion(lowest_version_vector));
2397 EXPECT_EQ(QuicVersionMin(), connection_.version());
2396 2398
2397 // Shouldn't be able to find a mutually supported version. 2399 // Shouldn't be able to find a mutually supported version.
2398 QuicVersionVector unsupported_version; 2400 QuicVersionVector unsupported_version;
2399 unsupported_version.push_back(QUIC_VERSION_UNSUPPORTED); 2401 unsupported_version.push_back(QUIC_VERSION_UNSUPPORTED);
2400 EXPECT_FALSE(connection_.SelectMutualVersion(unsupported_version)); 2402 EXPECT_FALSE(connection_.SelectMutualVersion(unsupported_version));
2401 } 2403 }
2402 2404
2403 TEST_F(QuicConnectionTest, ConnectionCloseWhenNotWriteBlocked) { 2405 TEST_F(QuicConnectionTest, ConnectionCloseWhenNotWriteBlocked) {
2404 helper_->set_blocked(false); // Already default. 2406 helper_->set_blocked(false); // Already default.
2405 2407
(...skipping 28 matching lines...) Expand all
2434 2436
2435 // Send an erroneous packet to close the connection. 2437 // Send an erroneous packet to close the connection.
2436 EXPECT_CALL(visitor_, ConnectionClose(QUIC_INVALID_PACKET_HEADER, false)); 2438 EXPECT_CALL(visitor_, ConnectionClose(QUIC_INVALID_PACKET_HEADER, false));
2437 ProcessDataPacket(6000, 0, !kEntropyFlag); 2439 ProcessDataPacket(6000, 0, !kEntropyFlag);
2438 EXPECT_EQ(1u, helper_->packets_write_attempts()); 2440 EXPECT_EQ(1u, helper_->packets_write_attempts());
2439 } 2441 }
2440 2442
2441 } // namespace 2443 } // namespace
2442 } // namespace test 2444 } // namespace test
2443 } // namespace net 2445 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/proof_source.h ('k') | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698