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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 CryptoHandshakeMessage message; | 379 CryptoHandshakeMessage message; |
380 message.set_tag(tag); | 380 message.set_tag(tag); |
381 return ConstructPacketFromHandshakeMessage(guid, message, false); | 381 return ConstructPacketFromHandshakeMessage(guid, message, false); |
382 } | 382 } |
383 | 383 |
384 size_t GetPacketLengthForOneStream( | 384 size_t GetPacketLengthForOneStream( |
385 bool include_version, InFecGroup is_in_fec_group, size_t payload) { | 385 bool include_version, InFecGroup is_in_fec_group, size_t payload) { |
386 // TODO(wtc): the hardcoded use of NullEncrypter here seems wrong. | 386 // TODO(wtc): the hardcoded use of NullEncrypter here seems wrong. |
387 size_t packet_length = NullEncrypter().GetCiphertextSize(payload) + | 387 size_t packet_length = NullEncrypter().GetCiphertextSize(payload) + |
388 QuicPacketCreator::StreamFramePacketOverhead( | 388 QuicPacketCreator::StreamFramePacketOverhead( |
389 1, PACKET_8BYTE_GUID, include_version, | 389 1, PACKET_8BYTE_GUID, include_version, is_in_fec_group); |
390 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); | |
391 | 390 |
392 size_t ack_length = NullEncrypter().GetCiphertextSize( | 391 size_t ack_length = NullEncrypter().GetCiphertextSize( |
393 QuicFramer::GetMinAckFrameSize()) + | 392 QuicFramer::GetMinAckFrameSize()) + |
394 GetPacketHeaderSize(PACKET_8BYTE_GUID, include_version, | 393 GetPacketHeaderSize(PACKET_8BYTE_GUID, include_version, is_in_fec_group); |
395 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); | |
396 // Make sure that if we change the size of the packet length for one stream | 394 // Make sure that if we change the size of the packet length for one stream |
397 // or the ack frame; that all our test are configured correctly. | 395 // or the ack frame; that all our test are configured correctly. |
398 DCHECK_GE(packet_length, ack_length); | 396 DCHECK_GE(packet_length, ack_length); |
399 return packet_length; | 397 return packet_length; |
400 } | 398 } |
401 | 399 |
402 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( | 400 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( |
403 QuicPacketSequenceNumber sequence_number) const { | 401 QuicPacketSequenceNumber sequence_number) const { |
404 return 1u; | 402 return 1u; |
405 } | 403 } |
406 | 404 |
407 QuicConfig DefaultQuicConfig() { | 405 QuicConfig DefaultQuicConfig() { |
408 QuicConfig config; | 406 QuicConfig config; |
409 config.SetDefaults(); | 407 config.SetDefaults(); |
410 return config; | 408 return config; |
411 } | 409 } |
412 | 410 |
413 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { | 411 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { |
414 data.AppendToString(&data_); | 412 data.AppendToString(&data_); |
415 return true; | 413 return true; |
416 } | 414 } |
417 | 415 |
418 void TestDecompressorVisitor::OnDecompressionError() { | 416 void TestDecompressorVisitor::OnDecompressionError() { |
419 error_ = true; | 417 error_ = true; |
420 } | 418 } |
421 | 419 |
422 } // namespace test | 420 } // namespace test |
423 } // namespace net | 421 } // namespace net |
OLD | NEW |