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

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

Issue 18307003: Implement the variable length changes necessary to easily accommodate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging with TOT Created 7 years, 5 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/quic_packet_creator.cc ('k') | net/quic/quic_protocol.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_packet_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/crypto/null_encrypter.h" 8 #include "net/quic/crypto/null_encrypter.h"
9 #include "net/quic/crypto/quic_decrypter.h" 9 #include "net/quic/crypto/quic_decrypter.h"
10 #include "net/quic/crypto/quic_encrypter.h" 10 #include "net/quic/crypto/quic_encrypter.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ProcessPacket(serialized.packet); 217 ProcessPacket(serialized.packet);
218 EXPECT_EQ(GetParam(), header.public_header.version_flag); 218 EXPECT_EQ(GetParam(), header.public_header.version_flag);
219 delete serialized.packet; 219 delete serialized.packet;
220 } 220 }
221 221
222 TEST_P(QuicPacketCreatorTest, CreateStreamFrameTooLarge) { 222 TEST_P(QuicPacketCreatorTest, CreateStreamFrameTooLarge) {
223 if (!GetParam()) { 223 if (!GetParam()) {
224 creator_.StopSendingVersion(); 224 creator_.StopSendingVersion();
225 } 225 }
226 // A string larger than fits into a frame. 226 // A string larger than fits into a frame.
227 size_t payload_length;
227 creator_.options()->max_packet_length = GetPacketLengthForOneStream( 228 creator_.options()->max_packet_length = GetPacketLengthForOneStream(
228 QuicPacketCreatorPeer::SendVersionInPacket(&creator_), 229 QuicPacketCreatorPeer::SendVersionInPacket(&creator_),
229 NOT_IN_FEC_GROUP, 4); 230 NOT_IN_FEC_GROUP, &payload_length);
230 QuicFrame frame; 231 QuicFrame frame;
231 size_t consumed = creator_.CreateStreamFrame(1u, "testTooLong", 0u, true, 232 const string too_long_payload(payload_length * 2, 'a');
232 &frame); 233 size_t consumed = creator_.CreateStreamFrame(
233 EXPECT_EQ(4u, consumed); 234 1u, too_long_payload, 0u, true, &frame);
234 CheckStreamFrame(frame, 1u, "test", 0u, false); 235 EXPECT_EQ(payload_length, consumed);
236 const string payload(payload_length, 'a');
237 CheckStreamFrame(frame, 1u, payload, 0u, false);
235 delete frame.stream_frame; 238 delete frame.stream_frame;
236 } 239 }
237 240
238 TEST_P(QuicPacketCreatorTest, AddFrameAndSerialize) { 241 TEST_P(QuicPacketCreatorTest, AddFrameAndSerialize) {
239 if (!GetParam()) { 242 if (!GetParam()) {
240 creator_.StopSendingVersion(); 243 creator_.StopSendingVersion();
241 } 244 }
242 const size_t max_plaintext_size = 245 const size_t max_plaintext_size =
243 client_framer_.GetMaxPlaintextSize(creator_.options()->max_packet_length); 246 client_framer_.GetMaxPlaintextSize(creator_.options()->max_packet_length);
244 EXPECT_FALSE(creator_.HasPendingFrames()); 247 EXPECT_FALSE(creator_.HasPendingFrames());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 creator_.options()->send_guid_length, 294 creator_.options()->send_guid_length,
292 QuicPacketCreatorPeer::SendVersionInPacket(&creator_), 295 QuicPacketCreatorPeer::SendVersionInPacket(&creator_),
293 PACKET_6BYTE_SEQUENCE_NUMBER, 296 PACKET_6BYTE_SEQUENCE_NUMBER,
294 NOT_IN_FEC_GROUP), 297 NOT_IN_FEC_GROUP),
295 creator_.BytesFree()); 298 creator_.BytesFree());
296 } 299 }
297 300
298 } // namespace 301 } // namespace
299 } // namespace test 302 } // namespace test
300 } // namespace net 303 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698