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

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

Issue 17302002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/reliable_quic_stream.cc ('k') | net/quic/test_tools/crypto_test_utils_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/crypto_test_utils.cc
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc
index d469bfa756af3ba3adff5ba58e7e0939dd533b89..4c8b67d5c06642cdb67607fd0c4de9bfe46f0347 100644
--- a/net/quic/test_tools/crypto_test_utils.cc
+++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -444,6 +444,19 @@ CryptoHandshakeMessage CryptoTestUtils::BuildMessage(const char* message_tag,
break;
}
+ if (tagstr[0] == '$') {
+ // Special value.
+ const char* const special = tagstr + 1;
+ if (strcmp(special, "padding") == 0) {
+ const int min_bytes = va_arg(ap, int);
+ msg.set_minimum_size(min_bytes);
+ } else {
+ CHECK(false) << "Unknown special value: " << special;
+ }
+
+ continue;
+ }
+
const QuicTag tag = ParseTag(tagstr);
const char* valuestr = va_arg(ap, const char*);
@@ -471,7 +484,14 @@ CryptoHandshakeMessage CryptoTestUtils::BuildMessage(const char* message_tag,
msg.SetStringPiece(tag, valuestr);
}
- return msg;
+ // The CryptoHandshakeMessage needs to be serialized and parsed to ensure
+ // that any padding is included.
+ scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg));
+ scoped_ptr<CryptoHandshakeMessage> parsed(
+ CryptoFramer::ParseMessage(bytes->AsStringPiece()));
+ CHECK(parsed.get());
+
+ return *parsed;
}
} // namespace test
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | net/quic/test_tools/crypto_test_utils_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698