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

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

Issue 1046523002: Cache the value of GetMaxPlaintextSize in QuicPacketCreator. No functional change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/quic_packet_generator.cc ('k') | net/quic/reliable_quic_stream_test.cc » ('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_generator.h" 5 #include "net/quic/quic_packet_generator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "net/quic/crypto/crypto_protocol.h" 9 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/null_encrypter.h" 10 #include "net/quic/crypto/null_encrypter.h"
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 size_t length = 618 size_t length =
619 NullEncrypter().GetCiphertextSize(0) + 619 NullEncrypter().GetCiphertextSize(0) +
620 GetPacketHeaderSize( 620 GetPacketHeaderSize(
621 creator_->connection_id_length(), true, 621 creator_->connection_id_length(), true,
622 QuicPacketCreatorPeer::NextSequenceNumberLength(creator_), 622 QuicPacketCreatorPeer::NextSequenceNumberLength(creator_),
623 NOT_IN_FEC_GROUP) + 623 NOT_IN_FEC_GROUP) +
624 // Add an extra 3 bytes for the payload and 1 byte so BytesFree is larger 624 // Add an extra 3 bytes for the payload and 1 byte so BytesFree is larger
625 // than the GetMinStreamFrameSize. 625 // than the GetMinStreamFrameSize.
626 QuicFramer::GetMinStreamFrameSize(1, 0, false, NOT_IN_FEC_GROUP) + 3 + 626 QuicFramer::GetMinStreamFrameSize(1, 0, false, NOT_IN_FEC_GROUP) + 3 +
627 QuicFramer::GetMinStreamFrameSize(1, 0, true, NOT_IN_FEC_GROUP) + 1; 627 QuicFramer::GetMinStreamFrameSize(1, 0, true, NOT_IN_FEC_GROUP) + 1;
628 creator_->set_max_packet_length(length); 628 creator_->SetMaxPacketLength(length);
629 delegate_.SetCanWriteAnything(); 629 delegate_.SetCanWriteAnything();
630 { 630 {
631 InSequence dummy; 631 InSequence dummy;
632 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( 632 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce(
633 SaveArg<0>(&packet_)); 633 SaveArg<0>(&packet_));
634 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( 634 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce(
635 SaveArg<0>(&packet2_)); 635 SaveArg<0>(&packet2_));
636 } 636 }
637 generator_.StartBatchOperations(); 637 generator_.StartBatchOperations();
638 // Queue enough data to prevent a stream frame with a non-zero offset from 638 // Queue enough data to prevent a stream frame with a non-zero offset from
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 generator_.SetConnectionIdLength(7); 1100 generator_.SetConnectionIdLength(7);
1101 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 1101 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
1102 generator_.SetConnectionIdLength(8); 1102 generator_.SetConnectionIdLength(8);
1103 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 1103 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
1104 generator_.SetConnectionIdLength(9); 1104 generator_.SetConnectionIdLength(9);
1105 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 1105 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
1106 } 1106 }
1107 1107
1108 } // namespace test 1108 } // namespace test
1109 } // namespace net 1109 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698