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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1433703005: Pass in connection ID and supported version to QuicFramer::BuildVersionNegotiationPacket, instead … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106947577
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/quic_framer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index fe35556638dd5a50c0891ff522ecc274e79df943..15dd943af32a4fed8b3a515587788beb850b2b9f 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -4669,24 +4669,17 @@ TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) {
QuicConnectionPeer::GetFramer(&connection_)->set_version_for_tests(
QUIC_VERSION_UNSUPPORTED);
- QuicPacketHeader header;
- header.public_header.connection_id = connection_id_;
- header.public_header.version_flag = true;
- header.packet_number = 12;
-
- QuicVersionVector supported_versions;
- for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
- supported_versions.push_back(kSupportedQuicVersions[i]);
- }
-
// Send a version negotiation packet.
scoped_ptr<QuicEncryptedPacket> encrypted(
- framer_.BuildVersionNegotiationPacket(
- header.public_header, supported_versions));
+ framer_.BuildVersionNegotiationPacket(connection_id_,
+ QuicSupportedVersions()));
connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *encrypted);
// Now force another packet. The connection should transition into
// NEGOTIATED_VERSION state and tell the packet creator to StopSendingVersion.
+ QuicPacketHeader header;
+ header.public_header.connection_id = connection_id_;
+ header.packet_number = 12;
header.public_header.version_flag = false;
QuicFrames frames;
frames.push_back(QuicFrame(&frame1_));
@@ -4705,24 +4698,14 @@ TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) {
}
TEST_P(QuicConnectionTest, BadVersionNegotiation) {
- QuicPacketHeader header;
- header.public_header.connection_id = connection_id_;
- header.public_header.version_flag = true;
- header.packet_number = 12;
-
- QuicVersionVector supported_versions;
- for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
- supported_versions.push_back(kSupportedQuicVersions[i]);
- }
-
// Send a version negotiation packet with the version the client started with.
// It should be rejected.
EXPECT_CALL(visitor_,
OnConnectionClosed(QUIC_INVALID_VERSION_NEGOTIATION_PACKET,
false));
scoped_ptr<QuicEncryptedPacket> encrypted(
- framer_.BuildVersionNegotiationPacket(
- header.public_header, supported_versions));
+ framer_.BuildVersionNegotiationPacket(connection_id_,
+ QuicSupportedVersions()));
connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *encrypted);
}
« no previous file with comments | « no previous file | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698