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/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/crypto/crypto_framer.h" | 8 #include "net/quic/crypto/crypto_framer.h" |
9 #include "net/quic/crypto/crypto_handshake.h" | 9 #include "net/quic/crypto/crypto_handshake.h" |
10 #include "net/quic/crypto/crypto_utils.h" | 10 #include "net/quic/crypto/crypto_utils.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (stream_length < ack_length) { | 416 if (stream_length < ack_length) { |
417 *payload_length = 1 + ack_length - stream_length; | 417 *payload_length = 1 + ack_length - stream_length; |
418 } | 418 } |
419 | 419 |
420 return NullEncrypter().GetCiphertextSize(*payload_length) + | 420 return NullEncrypter().GetCiphertextSize(*payload_length) + |
421 QuicPacketCreator::StreamFramePacketOverhead( | 421 QuicPacketCreator::StreamFramePacketOverhead( |
422 version, PACKET_8BYTE_GUID, include_version, | 422 version, PACKET_8BYTE_GUID, include_version, |
423 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); | 423 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); |
424 } | 424 } |
425 | 425 |
| 426 // Size in bytes of the stream frame fields for an arbitrary StreamID and |
| 427 // offset and the last frame in a packet. |
426 size_t GetMinStreamFrameSize(QuicVersion version) { | 428 size_t GetMinStreamFrameSize(QuicVersion version) { |
427 return kQuicFrameTypeSize + kQuicMaxStreamIdSize + kQuicMaxStreamOffsetSize + | 429 return kQuicFrameTypeSize + kQuicMaxStreamIdSize + kQuicMaxStreamOffsetSize; |
428 (version == QUIC_VERSION_6 ? | |
429 (kQuicStreamFinSize + kQuicStreamPayloadLengthSize) : 0); | |
430 } | 430 } |
431 | 431 |
432 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash( | 432 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash( |
433 QuicPacketSequenceNumber sequence_number) const { | 433 QuicPacketSequenceNumber sequence_number) const { |
434 return 1u; | 434 return 1u; |
435 } | 435 } |
436 | 436 |
437 QuicConfig DefaultQuicConfig() { | 437 QuicConfig DefaultQuicConfig() { |
438 QuicConfig config; | 438 QuicConfig config; |
439 config.SetDefaults(); | 439 config.SetDefaults(); |
440 return config; | 440 return config; |
441 } | 441 } |
442 | 442 |
443 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { | 443 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { |
444 data.AppendToString(&data_); | 444 data.AppendToString(&data_); |
445 return true; | 445 return true; |
446 } | 446 } |
447 | 447 |
448 void TestDecompressorVisitor::OnDecompressionError() { | 448 void TestDecompressorVisitor::OnDecompressionError() { |
449 error_ = true; | 449 error_ = true; |
450 } | 450 } |
451 | 451 |
452 } // namespace test | 452 } // namespace test |
453 } // namespace net | 453 } // namespace net |
OLD | NEW |