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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // Set the packet size be enough for two stream frames with 0 stream offset, | 519 // Set the packet size be enough for two stream frames with 0 stream offset, |
520 // but not enough for a stream frame of 0 offset and one with non-zero offset. | 520 // but not enough for a stream frame of 0 offset and one with non-zero offset. |
521 size_t length = | 521 size_t length = |
522 NullEncrypter().GetCiphertextSize(0) + | 522 NullEncrypter().GetCiphertextSize(0) + |
523 GetPacketHeaderSize(creator_->connection_id_length(), | 523 GetPacketHeaderSize(creator_->connection_id_length(), |
524 true, | 524 true, |
525 creator_->next_sequence_number_length(), | 525 creator_->next_sequence_number_length(), |
526 NOT_IN_FEC_GROUP) + | 526 NOT_IN_FEC_GROUP) + |
527 // Add an extra 3 bytes for the payload and 1 byte so BytesFree is larger | 527 // Add an extra 3 bytes for the payload and 1 byte so BytesFree is larger |
528 // than the GetMinStreamFrameSize. | 528 // than the GetMinStreamFrameSize. |
529 QuicFramer::GetMinStreamFrameSize(framer_.version(), 1, 0, false, | 529 QuicFramer::GetMinStreamFrameSize(1, 0, false, NOT_IN_FEC_GROUP) + 3 + |
530 NOT_IN_FEC_GROUP) + 3 + | 530 QuicFramer::GetMinStreamFrameSize(1, 0, true, NOT_IN_FEC_GROUP) + 1; |
531 QuicFramer::GetMinStreamFrameSize(framer_.version(), 1, 0, true, | |
532 NOT_IN_FEC_GROUP) + 1; | |
533 creator_->set_max_packet_length(length); | 531 creator_->set_max_packet_length(length); |
534 delegate_.SetCanWriteAnything(); | 532 delegate_.SetCanWriteAnything(); |
535 { | 533 { |
536 InSequence dummy; | 534 InSequence dummy; |
537 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( | 535 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( |
538 DoAll(SaveArg<0>(&packet_), Return(true))); | 536 DoAll(SaveArg<0>(&packet_), Return(true))); |
539 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( | 537 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( |
540 DoAll(SaveArg<0>(&packet2_), Return(true))); | 538 DoAll(SaveArg<0>(&packet2_), Return(true))); |
541 } | 539 } |
542 generator_.StartBatchOperations(); | 540 generator_.StartBatchOperations(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 | 961 |
964 // The second should have the remainder of the stream data. | 962 // The second should have the remainder of the stream data. |
965 PacketContents contents2; | 963 PacketContents contents2; |
966 contents2.num_goaway_frames = 1; | 964 contents2.num_goaway_frames = 1; |
967 contents2.num_stream_frames = 1; | 965 contents2.num_stream_frames = 1; |
968 CheckPacketContains(contents2, packet2_); | 966 CheckPacketContains(contents2, packet2_); |
969 } | 967 } |
970 | 968 |
971 } // namespace test | 969 } // namespace test |
972 } // namespace net | 970 } // namespace net |
OLD | NEW |