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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/quic/crypto/crypto_framer.h" | 10 #include "net/quic/crypto/crypto_framer.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 QuicConnectionIdLength connection_id_length, | 679 QuicConnectionIdLength connection_id_length, |
680 QuicSequenceNumberLength sequence_number_length, | 680 QuicSequenceNumberLength sequence_number_length, |
681 InFecGroup is_in_fec_group, | 681 InFecGroup is_in_fec_group, |
682 size_t* payload_length) { | 682 size_t* payload_length) { |
683 *payload_length = 1; | 683 *payload_length = 1; |
684 const size_t stream_length = | 684 const size_t stream_length = |
685 NullEncrypter().GetCiphertextSize(*payload_length) + | 685 NullEncrypter().GetCiphertextSize(*payload_length) + |
686 QuicPacketCreator::StreamFramePacketOverhead( | 686 QuicPacketCreator::StreamFramePacketOverhead( |
687 PACKET_8BYTE_CONNECTION_ID, include_version, | 687 PACKET_8BYTE_CONNECTION_ID, include_version, |
688 sequence_number_length, 0u, is_in_fec_group); | 688 sequence_number_length, 0u, is_in_fec_group); |
689 const size_t ack_length = NullEncrypter().GetCiphertextSize( | 689 const size_t ack_length = |
690 QuicFramer::GetMinAckFrameSize( | 690 NullEncrypter().GetCiphertextSize( |
691 sequence_number_length, PACKET_1BYTE_SEQUENCE_NUMBER)) + | 691 QuicFramer::GetMinAckFrameSize(PACKET_1BYTE_SEQUENCE_NUMBER)) + |
692 GetPacketHeaderSize(connection_id_length, include_version, | 692 GetPacketHeaderSize(connection_id_length, include_version, |
693 sequence_number_length, is_in_fec_group); | 693 sequence_number_length, is_in_fec_group); |
694 if (stream_length < ack_length) { | 694 if (stream_length < ack_length) { |
695 *payload_length = 1 + ack_length - stream_length; | 695 *payload_length = 1 + ack_length - stream_length; |
696 } | 696 } |
697 | 697 |
698 return NullEncrypter().GetCiphertextSize(*payload_length) + | 698 return NullEncrypter().GetCiphertextSize(*payload_length) + |
699 QuicPacketCreator::StreamFramePacketOverhead( | 699 QuicPacketCreator::StreamFramePacketOverhead( |
700 connection_id_length, include_version, | 700 connection_id_length, include_version, |
701 sequence_number_length, 0u, is_in_fec_group); | 701 sequence_number_length, 0u, is_in_fec_group); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 *server_session = new TestQuicSpdyServerSession( | 828 *server_session = new TestQuicSpdyServerSession( |
829 *server_connection, DefaultQuicConfig(), server_crypto_config); | 829 *server_connection, DefaultQuicConfig(), server_crypto_config); |
830 | 830 |
831 // We advance the clock initially because the default time is zero and the | 831 // We advance the clock initially because the default time is zero and the |
832 // strike register worries that we've just overflowed a uint32 time. | 832 // strike register worries that we've just overflowed a uint32 time. |
833 (*server_connection)->AdvanceTime(connection_start_time); | 833 (*server_connection)->AdvanceTime(connection_start_time); |
834 } | 834 } |
835 | 835 |
836 } // namespace test | 836 } // namespace test |
837 } // namespace net | 837 } // namespace net |
OLD | NEW |