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

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

Issue 2437913002: [m55 merge] Re-enable the QUIC v33 hacks. protected by FLAGS_quic_remove_v33_hacks2 (Closed)
Patch Set: 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 4886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4897 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, 4897 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
4898 StringPiece("hello world!")); 4898 StringPiece("hello world!"));
4899 4899
4900 QuicFrames frames; 4900 QuicFrames frames;
4901 frames.push_back(QuicFrame(&stream_frame)); 4901 frames.push_back(QuicFrame(&stream_frame));
4902 4902
4903 // clang-format off 4903 // clang-format off
4904 unsigned char packet[] = { 4904 unsigned char packet[] = {
4905 // public flags (version, 8 byte connection_id) 4905 // public flags (version, 8 byte connection_id)
4906 static_cast<unsigned char>( 4906 static_cast<unsigned char>(
4907 framer_.version() > QUIC_VERSION_32 ? 0x39 : 0x3D), 4907 (FLAGS_quic_remove_v33_hacks2 &&
4908 framer_.version() > QUIC_VERSION_32) ? 0x39 : 0x3D),
4908 // connection_id 4909 // connection_id
4909 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 4910 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
4910 // version tag 4911 // version tag
4911 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4912 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4912 // packet number 4913 // packet number
4913 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 4914 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
4914 // private flags (entropy) 4915 // private flags (entropy)
4915 0x01, 4916 0x01,
4916 4917
4917 // frame type (stream frame with fin and no length) 4918 // frame type (stream frame with fin and no length)
4918 0xDF, 4919 0xDF,
4919 // stream id 4920 // stream id
4920 0x04, 0x03, 0x02, 0x01, 4921 0x04, 0x03, 0x02, 0x01,
4921 // offset 4922 // offset
4922 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA, 4923 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA,
4923 // data 4924 // data
4924 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', 4925 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!',
4925 }; 4926 };
4926 unsigned char packet_34[] = { 4927 unsigned char packet_34[] = {
4927 // public flags (version, 8 byte connection_id) 4928 // public flags (version, 8 byte connection_id)
4928 0x39, 4929 static_cast<unsigned char>(
4930 FLAGS_quic_remove_v33_hacks2 ? 0x39 : 0x3D),
4929 // connection_id 4931 // connection_id
4930 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 4932 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
4931 // version tag 4933 // version tag
4932 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 4934 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
4933 // packet number 4935 // packet number
4934 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 4936 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
4935 4937
4936 // frame type (stream frame with fin and no length) 4938 // frame type (stream frame with fin and no length)
4937 0xDF, 4939 0xDF,
4938 // stream id 4940 // stream id
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, 5052 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
5051 StringPiece("hello world!")); 5053 StringPiece("hello world!"));
5052 5054
5053 QuicFrames frames; 5055 QuicFrames frames;
5054 frames.push_back(QuicFrame(&stream_frame)); 5056 frames.push_back(QuicFrame(&stream_frame));
5055 5057
5056 // clang-format off 5058 // clang-format off
5057 unsigned char packet[] = { 5059 unsigned char packet[] = {
5058 // public flags (8 byte connection_id) 5060 // public flags (8 byte connection_id)
5059 static_cast<unsigned char>( 5061 static_cast<unsigned char>(
5060 framer_.version() > QUIC_VERSION_32 ? 0x79 : 0x7D), 5062 (FLAGS_quic_remove_v33_hacks2 &&
5063 framer_.version() > QUIC_VERSION_32) ? 0x79 : 0x7D),
5061 // connection_id 5064 // connection_id
5062 0x10, 0x32, 0x54, 0x76, 5065 0x10, 0x32, 0x54, 0x76,
5063 0x98, 0xBA, 0xDC, 0xFE, 5066 0x98, 0xBA, 0xDC, 0xFE,
5064 // version tag 5067 // version tag
5065 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 5068 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
5066 // path_id 5069 // path_id
5067 0x42, 5070 0x42,
5068 // packet number 5071 // packet number
5069 0xBC, 0x9A, 0x78, 0x56, 5072 0xBC, 0x9A, 0x78, 0x56,
5070 0x34, 0x12, 5073 0x34, 0x12,
5071 // private flags (entropy) 5074 // private flags (entropy)
5072 0x01, 5075 0x01,
5073 5076
5074 // frame type (stream frame with fin and no length) 5077 // frame type (stream frame with fin and no length)
5075 0xDF, 5078 0xDF,
5076 // stream id 5079 // stream id
5077 0x04, 0x03, 0x02, 0x01, 5080 0x04, 0x03, 0x02, 0x01,
5078 // offset 5081 // offset
5079 0x54, 0x76, 0x10, 0x32, 5082 0x54, 0x76, 0x10, 0x32,
5080 0xDC, 0xFE, 0x98, 0xBA, 5083 0xDC, 0xFE, 0x98, 0xBA,
5081 // data 5084 // data
5082 'h', 'e', 'l', 'l', 5085 'h', 'e', 'l', 'l',
5083 'o', ' ', 'w', 'o', 5086 'o', ' ', 'w', 'o',
5084 'r', 'l', 'd', '!', 5087 'r', 'l', 'd', '!',
5085 }; 5088 };
5086 unsigned char packet_34[] = { 5089 unsigned char packet_34[] = {
5087 // public flags (8 byte connection_id) 5090 // public flags (8 byte connection_id)
5088 0x79, 5091 static_cast<unsigned char>(
5092 FLAGS_quic_remove_v33_hacks2 ? 0x79 : 0x7D),
5089 // connection_id 5093 // connection_id
5090 0x10, 0x32, 0x54, 0x76, 5094 0x10, 0x32, 0x54, 0x76,
5091 0x98, 0xBA, 0xDC, 0xFE, 5095 0x98, 0xBA, 0xDC, 0xFE,
5092 // version tag 5096 // version tag
5093 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), 5097 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
5094 // path_id 5098 // path_id
5095 0x42, 5099 0x42,
5096 // packet number 5100 // packet number
5097 0xBC, 0x9A, 0x78, 0x56, 5101 0xBC, 0x9A, 0x78, 0x56,
5098 0x34, 0x12, 5102 0x34, 0x12,
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after
7263 'o', ' ', 'w', 'o', 7267 'o', ' ', 'w', 'o',
7264 'r', 'l', 'd', '!', 7268 'r', 'l', 'd', '!',
7265 }; 7269 };
7266 // clang-format on 7270 // clang-format on
7267 7271
7268 QuicFramerFuzzFunc(packet, arraysize(packet)); 7272 QuicFramerFuzzFunc(packet, arraysize(packet));
7269 } 7273 }
7270 7274
7271 } // namespace test 7275 } // namespace test
7272 } // namespace net 7276 } // 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