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

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: Fix QuicStreamFactoryTest properly Created 7 years, 12 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
« net/quic/quic_utils.h ('K') | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | 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 "net/quic/crypto/crypto_framer.h" 7 #include "net/quic/crypto/crypto_framer.h"
8 #include "net/quic/quic_utils.h"
8 9
10 using base::StringPiece;
9 using std::max; 11 using std::max;
10 using std::min; 12 using std::min;
11 using std::string; 13 using std::string;
12 14
13 namespace net { 15 namespace net {
14 namespace test { 16 namespace test {
15 17
16 MockFramerVisitor::MockFramerVisitor() { 18 MockFramerVisitor::MockFramerVisitor() {
17 // By default, we want to accept packets. 19 // By default, we want to accept packets.
18 ON_CALL(*this, OnPacketHeader(testing::_)) 20 ON_CALL(*this, OnPacketHeader(testing::_))
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 206
205 QuicStreamFrame stream_frame(kCryptoStreamId, false, 0, 207 QuicStreamFrame stream_frame(kCryptoStreamId, false, 0,
206 data->AsStringPiece()); 208 data->AsStringPiece());
207 209
208 QuicFrame frame(&stream_frame); 210 QuicFrame frame(&stream_frame);
209 QuicFrames frames; 211 QuicFrames frames;
210 frames.push_back(frame); 212 frames.push_back(frame);
211 return quic_framer.ConstructFrameDataPacket(header, frames); 213 return quic_framer.ConstructFrameDataPacket(header, frames);
212 } 214 }
213 215
216 QuicPacket* ConstructClientHelloPacket(QuicGuid guid,
217 QuicClock* clock,
218 QuicRandom* random_generator) {
219 QuicClientHelloConfig config;
220 std::string nonce;
221 QuicUtils::GenerateNonce(clock, random_generator, &nonce);
222
223 CryptoHandshakeMessage message;
224 QuicUtils::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/quic_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