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

Side by Side Diff: net/quic/test_tools/quic_test_utils.cc

Issue 393953009: Moving the work currently done in the QuicSession constructor to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 "base/sha1.h" 7 #include "base/sha1.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/quic/crypto/crypto_framer.h" 10 #include "net/quic/crypto/crypto_framer.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 TransmissionType transmission_type) { 295 TransmissionType transmission_type) {
296 packets_.push_back(packet.packet); 296 packets_.push_back(packet.packet);
297 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)-> 297 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)->
298 EncryptPacket(level, packet.sequence_number, *packet.packet); 298 EncryptPacket(level, packet.sequence_number, *packet.packet);
299 encrypted_packets_.push_back(encrypted); 299 encrypted_packets_.push_back(encrypted);
300 return true; 300 return true;
301 } 301 }
302 302
303 MockSession::MockSession(QuicConnection* connection) 303 MockSession::MockSession(QuicConnection* connection)
304 : QuicSession(connection, DefaultQuicConfig()) { 304 : QuicSession(connection, DefaultQuicConfig()) {
305 InitializeSession();
305 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 306 ON_CALL(*this, WritevData(_, _, _, _, _, _))
306 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 307 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
307 } 308 }
308 309
309 MockSession::~MockSession() { 310 MockSession::~MockSession() {
310 } 311 }
311 312
312 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) 313 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config)
313 : QuicSession(connection, config), 314 : QuicSession(connection, config),
314 crypto_stream_(NULL) {} 315 crypto_stream_(NULL) {
316 InitializeSession();
317 }
315 318
316 TestSession::~TestSession() {} 319 TestSession::~TestSession() {}
317 320
318 void TestSession::SetCryptoStream(QuicCryptoStream* stream) { 321 void TestSession::SetCryptoStream(QuicCryptoStream* stream) {
319 crypto_stream_ = stream; 322 crypto_stream_ = stream;
320 } 323 }
321 324
322 QuicCryptoStream* TestSession::GetCryptoStream() { 325 QuicCryptoStream* TestSession::GetCryptoStream() {
323 return crypto_stream_; 326 return crypto_stream_;
324 } 327 }
325 328
326 TestClientSession::TestClientSession(QuicConnection* connection, 329 TestClientSession::TestClientSession(QuicConnection* connection,
327 const QuicConfig& config) 330 const QuicConfig& config)
328 : QuicClientSessionBase(connection, 331 : QuicClientSessionBase(connection, config),
329 config),
330 crypto_stream_(NULL) { 332 crypto_stream_(NULL) {
331 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber()); 333 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber());
334 InitializeSession();
332 } 335 }
333 336
334 TestClientSession::~TestClientSession() {} 337 TestClientSession::~TestClientSession() {}
335 338
336 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) { 339 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) {
337 crypto_stream_ = stream; 340 crypto_stream_ = stream;
338 } 341 }
339 342
340 QuicCryptoStream* TestClientSession::GetCryptoStream() { 343 QuicCryptoStream* TestClientSession::GetCryptoStream() {
341 return crypto_stream_; 344 return crypto_stream_;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 599 }
597 600
598 QuicVersionVector SupportedVersions(QuicVersion version) { 601 QuicVersionVector SupportedVersions(QuicVersion version) {
599 QuicVersionVector versions; 602 QuicVersionVector versions;
600 versions.push_back(version); 603 versions.push_back(version);
601 return versions; 604 return versions;
602 } 605 }
603 606
604 } // namespace test 607 } // namespace test
605 } // namespace net 608 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698