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

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

Issue 14287009: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with Tot Created 7 years, 7 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_framer_test.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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 EXPECT_EQ(GetParam(), header.public_header.version_flag); 225 EXPECT_EQ(GetParam(), header.public_header.version_flag);
226 delete serialized.packet; 226 delete serialized.packet;
227 } 227 }
228 228
229 TEST_P(QuicPacketCreatorTest, CreateStreamFrameTooLarge) { 229 TEST_P(QuicPacketCreatorTest, CreateStreamFrameTooLarge) {
230 if (!GetParam()) { 230 if (!GetParam()) {
231 creator_.StopSendingVersion(); 231 creator_.StopSendingVersion();
232 } 232 }
233 // A string larger than fits into a frame. 233 // A string larger than fits into a frame.
234 creator_.options()->max_packet_length = GetPacketLengthForOneStream( 234 creator_.options()->max_packet_length = GetPacketLengthForOneStream(
235 QuicPacketCreatorPeer::SendVersionInPacket(&creator_), 1); 235 QuicPacketCreatorPeer::SendVersionInPacket(&creator_), 4);
236 QuicFrame frame; 236 QuicFrame frame;
237 size_t consumed = creator_.CreateStreamFrame(1u, "test", 0u, true, &frame); 237 size_t consumed = creator_.CreateStreamFrame(1u, "testTooLong", 0u, true,
238 EXPECT_EQ(1u, consumed); 238 &frame);
239 CheckStreamFrame(frame, 1u, "t", 0u, false); 239 EXPECT_EQ(4u, consumed);
240 CheckStreamFrame(frame, 1u, "test", 0u, false);
240 delete frame.stream_frame; 241 delete frame.stream_frame;
241 } 242 }
242 243
243 TEST_P(QuicPacketCreatorTest, AddFrameAndSerialize) { 244 TEST_P(QuicPacketCreatorTest, AddFrameAndSerialize) {
244 if (!GetParam()) { 245 if (!GetParam()) {
245 creator_.StopSendingVersion(); 246 creator_.StopSendingVersion();
246 } 247 }
247 const size_t max_plaintext_size = 248 const size_t max_plaintext_size =
248 client_framer_.GetMaxPlaintextSize(creator_.options()->max_packet_length); 249 client_framer_.GetMaxPlaintextSize(creator_.options()->max_packet_length);
249 EXPECT_FALSE(creator_.HasPendingFrames()); 250 EXPECT_FALSE(creator_.HasPendingFrames());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 EXPECT_FALSE(creator_.HasPendingFrames()); 291 EXPECT_FALSE(creator_.HasPendingFrames());
291 EXPECT_EQ(max_plaintext_size - 292 EXPECT_EQ(max_plaintext_size -
292 GetPacketHeaderSize( 293 GetPacketHeaderSize(
293 QuicPacketCreatorPeer::SendVersionInPacket(&creator_)), 294 QuicPacketCreatorPeer::SendVersionInPacket(&creator_)),
294 creator_.BytesFree()); 295 creator_.BytesFree());
295 } 296 }
296 297
297 } // namespace 298 } // namespace
298 } // namespace test 299 } // namespace test
299 } // namespace net 300 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698