OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |