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

Unified Diff: net/quic/test_tools/quic_test_utils.cc

Issue 18307003: Implement the variable length changes necessary to easily accommodate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging with TOT Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/quic_test_utils.cc
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index a8c67f7191026973115047fc40be2c27ec397008..809f28a4684ddf04d599a60f3aeed3baf9f7a9e5 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -382,21 +382,25 @@ QuicPacket* ConstructHandshakePacket(QuicGuid guid, QuicTag tag) {
}
size_t GetPacketLengthForOneStream(
- bool include_version, InFecGroup is_in_fec_group, size_t payload) {
- // TODO(wtc): the hardcoded use of NullEncrypter here seems wrong.
- size_t packet_length = NullEncrypter().GetCiphertextSize(payload) +
+ bool include_version, InFecGroup is_in_fec_group, size_t* payload_length) {
+ *payload_length = 1;
+ const size_t stream_length =
+ NullEncrypter().GetCiphertextSize(*payload_length) +
QuicPacketCreator::StreamFramePacketOverhead(
- 1, PACKET_8BYTE_GUID, include_version,
+ PACKET_8BYTE_GUID, include_version,
PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group);
-
- size_t ack_length = NullEncrypter().GetCiphertextSize(
+ const size_t ack_length = NullEncrypter().GetCiphertextSize(
QuicFramer::GetMinAckFrameSize()) +
GetPacketHeaderSize(PACKET_8BYTE_GUID, include_version,
PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group);
- // Make sure that if we change the size of the packet length for one stream
- // or the ack frame; that all our test are configured correctly.
- DCHECK_GE(packet_length, ack_length);
- return packet_length;
+ if (stream_length < ack_length) {
+ *payload_length = 1 + ack_length - stream_length;
+ }
+
+ return NullEncrypter().GetCiphertextSize(*payload_length) +
+ QuicPacketCreator::StreamFramePacketOverhead(
+ PACKET_8BYTE_GUID, include_version,
+ PACKET_6BYTE_SEQUENCE_NUMBER, is_in_fec_group);
}
QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash(
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698