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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
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 "net/quic/crypto/crypto_framer.h" 7 #include "net/quic/crypto/crypto_framer.h"
8 #include "net/quic/crypto/crypto_utils.h"
8 9
9 using std::max; 10 using std::max;
10 using std::min; 11 using std::min;
11 using std::string; 12 using std::string;
12 13
13 namespace net { 14 namespace net {
14 namespace test { 15 namespace test {
15 16
16 MockFramerVisitor::MockFramerVisitor() { 17 MockFramerVisitor::MockFramerVisitor() {
17 // By default, we want to accept packets. 18 // By default, we want to accept packets.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 205
205 QuicStreamFrame stream_frame(kCryptoStreamId, false, 0, 206 QuicStreamFrame stream_frame(kCryptoStreamId, false, 0,
206 data->AsStringPiece()); 207 data->AsStringPiece());
207 208
208 QuicFrame frame(&stream_frame); 209 QuicFrame frame(&stream_frame);
209 QuicFrames frames; 210 QuicFrames frames;
210 frames.push_back(frame); 211 frames.push_back(frame);
211 return quic_framer.ConstructFrameDataPacket(header, frames); 212 return quic_framer.ConstructFrameDataPacket(header, frames);
212 } 213 }
213 214
215 QuicPacket* ConstructClientHelloPacket(QuicGuid guid,
216 const QuicClock* clock,
217 QuicRandom* random_generator) {
218 QuicClientCryptoConfig config;
219 config.SetDefaults();
220 string nonce;
221 CryptoUtils::GenerateNonce(clock, random_generator, &nonce);
222
223 CryptoHandshakeMessage message;
224 CryptoUtils::FillClientHelloMessage(config, nonce, &message);
225 CryptoFramer crypto_framer;
226 scoped_ptr<QuicData> data(crypto_framer.ConstructHandshakeMessage(message));
227 QuicFramer quic_framer(QuicDecrypter::Create(kNULL),
228 QuicEncrypter::Create(kNULL));
229
230 QuicPacketHeader header;
231 header.guid = guid;
232 header.packet_sequence_number = 1;
233 header.flags = PACKET_FLAGS_NONE;
234 header.fec_group = 0;
235
236 QuicStreamFrame stream_frame(kCryptoStreamId, false, 0,
237 data->AsStringPiece());
238
239 QuicFrame frame(&stream_frame);
240 QuicFrames frames;
241 frames.push_back(frame);
242 return quic_framer.ConstructFrameDataPacket(header, frames);
243 }
244
245
214 } // namespace test 246 } // namespace test
215 } // namespace net 247 } // namespace net
OLDNEW
« net/quic/test_tools/quic_test_utils.h ('K') | « 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