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

Side by Side Diff: net/quic/core/quic_framer_test.cc

Issue 2426823003: Re-enable the QUIC v33 hacks. (Closed)
Patch Set: Rebase to tip of tree Created 4 years, 2 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/quic/core/quic_framer.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/quic/core/quic_framer.h" 5 #include "net/quic/core/quic_framer.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, 4225 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
4226 StringPiece("hello world!")); 4226 StringPiece("hello world!"));
4227 4227
4228 QuicFrames frames; 4228 QuicFrames frames;
4229 frames.push_back(QuicFrame(&stream_frame)); 4229 frames.push_back(QuicFrame(&stream_frame));
4230 4230
4231 // clang-format off 4231 // clang-format off
4232 unsigned char packet[] = { 4232 unsigned char packet[] = {
4233 // public flags (version, 8 byte connection_id) 4233 // public flags (version, 8 byte connection_id)
4234 static_cast<unsigned char>( 4234 static_cast<unsigned char>(
4235 framer_.version() > QUIC_VERSION_32 ? 0x39 : 0x3D), 4235 (FLAGS_quic_remove_v33_hacks2 &&
4236 framer_.version() > QUIC_VERSION_32) ? 0x39 : 0x3D),
4236 // connection_id 4237 // connection_id
4237 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 4238 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
4238 // version tag 4239 // version tag
4239 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4240 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4240 // packet number 4241 // packet number
4241 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 4242 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
4242 // private flags (entropy) 4243 // private flags (entropy)
4243 0x01, 4244 0x01,
4244 4245
4245 // frame type (stream frame with fin and no length) 4246 // frame type (stream frame with fin and no length)
4246 0xDF, 4247 0xDF,
4247 // stream id 4248 // stream id
4248 0x04, 0x03, 0x02, 0x01, 4249 0x04, 0x03, 0x02, 0x01,
4249 // offset 4250 // offset
4250 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA, 4251 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA,
4251 // data 4252 // data
4252 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', 4253 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!',
4253 }; 4254 };
4254 unsigned char packet_34[] = { 4255 unsigned char packet_34[] = {
4255 // public flags (version, 8 byte connection_id) 4256 // public flags (version, 8 byte connection_id)
4256 0x39, 4257 static_cast<unsigned char>(
4258 FLAGS_quic_remove_v33_hacks2 ? 0x39 : 0x3D),
4257 // connection_id 4259 // connection_id
4258 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 4260 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
4259 // version tag 4261 // version tag
4260 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4262 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4261 // packet number 4263 // packet number
4262 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 4264 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
4263 4265
4264 // frame type (stream frame with fin and no length) 4266 // frame type (stream frame with fin and no length)
4265 0xDF, 4267 0xDF,
4266 // stream id 4268 // stream id
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
4376 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, 4378 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
4377 StringPiece("hello world!")); 4379 StringPiece("hello world!"));
4378 4380
4379 QuicFrames frames; 4381 QuicFrames frames;
4380 frames.push_back(QuicFrame(&stream_frame)); 4382 frames.push_back(QuicFrame(&stream_frame));
4381 4383
4382 // clang-format off 4384 // clang-format off
4383 unsigned char packet[] = { 4385 unsigned char packet[] = {
4384 // public flags (8 byte connection_id) 4386 // public flags (8 byte connection_id)
4385 static_cast<unsigned char>( 4387 static_cast<unsigned char>(
4386 framer_.version() > QUIC_VERSION_32 ? 0x79 : 0x7D), 4388 (FLAGS_quic_remove_v33_hacks2 &&
4389 framer_.version() > QUIC_VERSION_32) ? 0x79 : 0x7D),
4387 // connection_id 4390 // connection_id
4388 0x10, 0x32, 0x54, 0x76, 4391 0x10, 0x32, 0x54, 0x76,
4389 0x98, 0xBA, 0xDC, 0xFE, 4392 0x98, 0xBA, 0xDC, 0xFE,
4390 // version tag 4393 // version tag
4391 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4394 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4392 // path_id 4395 // path_id
4393 0x42, 4396 0x42,
4394 // packet number 4397 // packet number
4395 0xBC, 0x9A, 0x78, 0x56, 4398 0xBC, 0x9A, 0x78, 0x56,
4396 0x34, 0x12, 4399 0x34, 0x12,
4397 // private flags (entropy) 4400 // private flags (entropy)
4398 0x01, 4401 0x01,
4399 4402
4400 // frame type (stream frame with fin and no length) 4403 // frame type (stream frame with fin and no length)
4401 0xDF, 4404 0xDF,
4402 // stream id 4405 // stream id
4403 0x04, 0x03, 0x02, 0x01, 4406 0x04, 0x03, 0x02, 0x01,
4404 // offset 4407 // offset
4405 0x54, 0x76, 0x10, 0x32, 4408 0x54, 0x76, 0x10, 0x32,
4406 0xDC, 0xFE, 0x98, 0xBA, 4409 0xDC, 0xFE, 0x98, 0xBA,
4407 // data 4410 // data
4408 'h', 'e', 'l', 'l', 4411 'h', 'e', 'l', 'l',
4409 'o', ' ', 'w', 'o', 4412 'o', ' ', 'w', 'o',
4410 'r', 'l', 'd', '!', 4413 'r', 'l', 'd', '!',
4411 }; 4414 };
4412 unsigned char packet_34[] = { 4415 unsigned char packet_34[] = {
4413 // public flags (8 byte connection_id) 4416 // public flags (8 byte connection_id)
4414 0x79, 4417 static_cast<unsigned char>(
4418 FLAGS_quic_remove_v33_hacks2 ? 0x79 : 0x7D),
4415 // connection_id 4419 // connection_id
4416 0x10, 0x32, 0x54, 0x76, 4420 0x10, 0x32, 0x54, 0x76,
4417 0x98, 0xBA, 0xDC, 0xFE, 4421 0x98, 0xBA, 0xDC, 0xFE,
4418 // version tag 4422 // version tag
4419 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4423 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4420 // path_id 4424 // path_id
4421 0x42, 4425 0x42,
4422 // packet number 4426 // packet number
4423 0xBC, 0x9A, 0x78, 0x56, 4427 0xBC, 0x9A, 0x78, 0x56,
4424 0x34, 0x12, 4428 0x34, 0x12,
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
6488 'o', ' ', 'w', 'o', 6492 'o', ' ', 'w', 'o',
6489 'r', 'l', 'd', '!', 6493 'r', 'l', 'd', '!',
6490 }; 6494 };
6491 // clang-format on 6495 // clang-format on
6492 6496
6493 QuicFramerFuzzFunc(packet, arraysize(packet)); 6497 QuicFramerFuzzFunc(packet, arraysize(packet));
6494 } 6498 }
6495 6499
6496 } // namespace test 6500 } // namespace test
6497 } // namespace net 6501 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_framer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698