Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: net/quic/test_tools/quic_test_utils.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 QuicPacket* ConstructHandshakePacket(QuicConnectionId connection_id, 562 QuicPacket* ConstructHandshakePacket(QuicConnectionId connection_id,
563 QuicTag tag) { 563 QuicTag tag) {
564 CryptoHandshakeMessage message; 564 CryptoHandshakeMessage message;
565 message.set_tag(tag); 565 message.set_tag(tag);
566 return ConstructPacketFromHandshakeMessage(connection_id, message, false); 566 return ConstructPacketFromHandshakeMessage(connection_id, message, false);
567 } 567 }
568 568
569 size_t GetPacketLengthForOneStream( 569 size_t GetPacketLengthForOneStream(
570 QuicVersion version, 570 QuicVersion version,
571 bool include_version, 571 bool include_version,
572 QuicConnectionIdLength connection_id_length,
572 QuicSequenceNumberLength sequence_number_length, 573 QuicSequenceNumberLength sequence_number_length,
573 InFecGroup is_in_fec_group, 574 InFecGroup is_in_fec_group,
574 size_t* payload_length) { 575 size_t* payload_length) {
575 *payload_length = 1; 576 *payload_length = 1;
576 const size_t stream_length = 577 const size_t stream_length =
577 NullEncrypter().GetCiphertextSize(*payload_length) + 578 NullEncrypter().GetCiphertextSize(*payload_length) +
578 QuicPacketCreator::StreamFramePacketOverhead( 579 QuicPacketCreator::StreamFramePacketOverhead(
579 PACKET_8BYTE_CONNECTION_ID, include_version, 580 PACKET_8BYTE_CONNECTION_ID, include_version,
580 sequence_number_length, 0u, is_in_fec_group); 581 sequence_number_length, 0u, is_in_fec_group);
581 const size_t ack_length = NullEncrypter().GetCiphertextSize( 582 const size_t ack_length = NullEncrypter().GetCiphertextSize(
582 QuicFramer::GetMinAckFrameSize( 583 QuicFramer::GetMinAckFrameSize(
583 sequence_number_length, PACKET_1BYTE_SEQUENCE_NUMBER)) + 584 sequence_number_length, PACKET_1BYTE_SEQUENCE_NUMBER)) +
584 GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, include_version, 585 GetPacketHeaderSize(connection_id_length, include_version,
585 sequence_number_length, is_in_fec_group); 586 sequence_number_length, is_in_fec_group);
586 if (stream_length < ack_length) { 587 if (stream_length < ack_length) {
587 *payload_length = 1 + ack_length - stream_length; 588 *payload_length = 1 + ack_length - stream_length;
588 } 589 }
589 590
590 return NullEncrypter().GetCiphertextSize(*payload_length) + 591 return NullEncrypter().GetCiphertextSize(*payload_length) +
591 QuicPacketCreator::StreamFramePacketOverhead( 592 QuicPacketCreator::StreamFramePacketOverhead(
592 PACKET_8BYTE_CONNECTION_ID, include_version, 593 connection_id_length, include_version,
593 sequence_number_length, 0u, is_in_fec_group); 594 sequence_number_length, 0u, is_in_fec_group);
594 } 595 }
595 596
596 TestEntropyCalculator::TestEntropyCalculator() {} 597 TestEntropyCalculator::TestEntropyCalculator() {}
597 598
598 TestEntropyCalculator::~TestEntropyCalculator() {} 599 TestEntropyCalculator::~TestEntropyCalculator() {}
599 600
600 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash( 601 QuicPacketEntropyHash TestEntropyCalculator::EntropyHash(
601 QuicPacketSequenceNumber sequence_number) const { 602 QuicPacketSequenceNumber sequence_number) const {
602 return 1u; 603 return 1u;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // called. 668 // called.
668 factory_->current_writer_ = this; 669 factory_->current_writer_ = this;
669 return QuicPerConnectionPacketWriter::WritePacket(buffer, 670 return QuicPerConnectionPacketWriter::WritePacket(buffer,
670 buf_len, 671 buf_len,
671 self_address, 672 self_address,
672 peer_address); 673 peer_address);
673 } 674 }
674 675
675 } // namespace test 676 } // namespace test
676 } // namespace net 677 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698