| 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 "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 QuicVersion version, | 514 QuicVersion version, |
| 515 bool include_version, | 515 bool include_version, |
| 516 QuicSequenceNumberLength sequence_number_length, | 516 QuicSequenceNumberLength sequence_number_length, |
| 517 InFecGroup is_in_fec_group, | 517 InFecGroup is_in_fec_group, |
| 518 size_t* payload_length) { | 518 size_t* payload_length) { |
| 519 *payload_length = 1; | 519 *payload_length = 1; |
| 520 const size_t stream_length = | 520 const size_t stream_length = |
| 521 NullEncrypter().GetCiphertextSize(*payload_length) + | 521 NullEncrypter().GetCiphertextSize(*payload_length) + |
| 522 QuicPacketCreator::StreamFramePacketOverhead( | 522 QuicPacketCreator::StreamFramePacketOverhead( |
| 523 version, PACKET_8BYTE_CONNECTION_ID, include_version, | 523 version, PACKET_8BYTE_CONNECTION_ID, include_version, |
| 524 sequence_number_length, is_in_fec_group); | 524 sequence_number_length, 0u, is_in_fec_group); |
| 525 const size_t ack_length = NullEncrypter().GetCiphertextSize( | 525 const size_t ack_length = NullEncrypter().GetCiphertextSize( |
| 526 QuicFramer::GetMinAckFrameSize( | 526 QuicFramer::GetMinAckFrameSize( |
| 527 version, sequence_number_length, PACKET_1BYTE_SEQUENCE_NUMBER)) + | 527 version, sequence_number_length, PACKET_1BYTE_SEQUENCE_NUMBER)) + |
| 528 GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, include_version, | 528 GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, include_version, |
| 529 sequence_number_length, is_in_fec_group); | 529 sequence_number_length, is_in_fec_group); |
| 530 if (stream_length < ack_length) { | 530 if (stream_length < ack_length) { |
| 531 *payload_length = 1 + ack_length - stream_length; | 531 *payload_length = 1 + ack_length - stream_length; |
| 532 } | 532 } |
| 533 | 533 |
| 534 return NullEncrypter().GetCiphertextSize(*payload_length) + | 534 return NullEncrypter().GetCiphertextSize(*payload_length) + |
| 535 QuicPacketCreator::StreamFramePacketOverhead( | 535 QuicPacketCreator::StreamFramePacketOverhead( |
| 536 version, PACKET_8BYTE_CONNECTION_ID, include_version, | 536 version, PACKET_8BYTE_CONNECTION_ID, include_version, |
| 537 sequence_number_length, is_in_fec_group); | 537 sequence_number_length, 0u, is_in_fec_group); |
| 538 } | 538 } |
| 539 | 539 |
| 540 TestEntropyCalculator::TestEntropyCalculator() { } | 540 TestEntropyCalculator::TestEntropyCalculator() { } |
| 541 | 541 |
| 542 TestEntropyCalculator::~TestEntropyCalculator() { } | 542 TestEntropyCalculator::~TestEntropyCalculator() { } |
| 543 | 543 |
| 544 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash( | 544 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash( |
| 545 QuicPacketSequenceNumber sequence_number) const { | 545 QuicPacketSequenceNumber sequence_number) const { |
| 546 return 1u; | 546 return 1u; |
| 547 } | 547 } |
| 548 | 548 |
| 549 MockEntropyCalculator::MockEntropyCalculator() { } | 549 MockEntropyCalculator::MockEntropyCalculator() { } |
| 550 | 550 |
| 551 MockEntropyCalculator::~MockEntropyCalculator() { } | 551 MockEntropyCalculator::~MockEntropyCalculator() { } |
| 552 | 552 |
| 553 QuicConfig DefaultQuicConfig() { | 553 QuicConfig DefaultQuicConfig() { |
| 554 QuicConfig config; | 554 QuicConfig config; |
| 555 config.SetDefaults(); | 555 config.SetDefaults(); |
| 556 return config; | 556 return config; |
| 557 } | 557 } |
| 558 | 558 |
| 559 QuicVersionVector SupportedVersions(QuicVersion version) { | 559 QuicVersionVector SupportedVersions(QuicVersion version) { |
| 560 QuicVersionVector versions; | 560 QuicVersionVector versions; |
| 561 versions.push_back(version); | 561 versions.push_back(version); |
| 562 return versions; | 562 return versions; |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace test | 565 } // namespace test |
| 566 } // namespace net | 566 } // namespace net |
| OLD | NEW |