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

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

Issue 11633030: Send the ClientHello handshake message. Fix a bug in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove an extraneous test:: before TestCryptoVisitor Created 7 years, 11 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
===================================================================
--- net/quic/test_tools/quic_test_utils.cc (revision 177030)
+++ net/quic/test_tools/quic_test_utils.cc (working copy)
@@ -5,6 +5,7 @@
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/quic/crypto/crypto_framer.h"
+#include "net/quic/crypto/crypto_utils.h"
using std::max;
using std::min;
@@ -80,6 +81,13 @@
helper_(helper()) {
}
+MockConnection::MockConnection(QuicGuid guid,
+ IPEndPoint address,
+ QuicConnectionHelperInterface* helper)
+ : QuicConnection(guid, address, helper),
+ helper_(helper) {
+}
+
MockConnection::~MockConnection() {
}
@@ -214,5 +222,36 @@
return quic_framer.ConstructFrameDataPacket(header, frames);
}
+QuicPacket* ConstructClientHelloPacket(QuicGuid guid,
+ const QuicClock* clock,
+ QuicRandom* random_generator) {
+ QuicClientCryptoConfig config;
+ config.SetDefaults();
+ string nonce;
+ CryptoUtils::GenerateNonce(clock, random_generator, &nonce);
+
+ CryptoHandshakeMessage message;
+ CryptoUtils::FillClientHelloMessage(config, nonce, &message);
+ CryptoFramer crypto_framer;
+ scoped_ptr<QuicData> data(crypto_framer.ConstructHandshakeMessage(message));
+ QuicFramer quic_framer(QuicDecrypter::Create(kNULL),
+ QuicEncrypter::Create(kNULL));
+
+ QuicPacketHeader header;
+ header.guid = guid;
+ header.packet_sequence_number = 1;
+ header.flags = PACKET_FLAGS_NONE;
+ header.fec_group = 0;
+
+ QuicStreamFrame stream_frame(kCryptoStreamId, false, 0,
+ data->AsStringPiece());
+
+ QuicFrame frame(&stream_frame);
+ QuicFrames frames;
+ frames.push_back(frame);
+ return quic_framer.ConstructFrameDataPacket(header, frames);
+}
+
+
} // namespace test
} // namespace net
« 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