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, is_in_fec_group); | 389 1, PACKET_8BYTE_GUID, include_version, |
| 390 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); |
390 | 391 |
391 size_t ack_length = NullEncrypter().GetCiphertextSize( | 392 size_t ack_length = NullEncrypter().GetCiphertextSize( |
392 QuicFramer::GetMinAckFrameSize()) + | 393 QuicFramer::GetMinAckFrameSize()) + |
393 GetPacketHeaderSize(PACKET_8BYTE_GUID, include_version, is_in_fec_group); | 394 GetPacketHeaderSize(PACKET_8BYTE_GUID, include_version, |
| 395 PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group); |
394 // Make sure that if we change the size of the packet length for one stream | 396 // Make sure that if we change the size of the packet length for one stream |
395 // or the ack frame; that all our test are configured correctly. | 397 // or the ack frame; that all our test are configured correctly. |
396 DCHECK_GE(packet_length, ack_length); | 398 DCHECK_GE(packet_length, ack_length); |
397 return packet_length; | 399 return packet_length; |
398 } | 400 } |
399 | 401 |
400 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( | 402 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( |
401 QuicPacketSequenceNumber sequence_number) const { | 403 QuicPacketSequenceNumber sequence_number) const { |
402 return 1u; | 404 return 1u; |
403 } | 405 } |
404 | 406 |
405 QuicConfig DefaultQuicConfig() { | 407 QuicConfig DefaultQuicConfig() { |
406 QuicConfig config; | 408 QuicConfig config; |
407 config.SetDefaults(); | 409 config.SetDefaults(); |
408 return config; | 410 return config; |
409 } | 411 } |
410 | 412 |
411 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { | 413 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) { |
412 data.AppendToString(&data_); | 414 data.AppendToString(&data_); |
413 return true; | 415 return true; |
414 } | 416 } |
415 | 417 |
416 void TestDecompressorVisitor::OnDecompressionError() { | 418 void TestDecompressorVisitor::OnDecompressionError() { |
417 error_ = true; | 419 error_ = true; |
418 } | 420 } |
419 | 421 |
420 } // namespace test | 422 } // namespace test |
421 } // namespace net | 423 } // namespace net |
OLD | NEW |