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

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

Issue 2226643004: QuicSession no longer directly owns its QuicConnection. Not flag protected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129226757
Patch Set: Created 4 years, 4 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
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_base.h » ('j') | 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 <memory> 7 #include <memory>
8 8
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 MockQuicSession::MockQuicSession(QuicConnection* connection) 345 MockQuicSession::MockQuicSession(QuicConnection* connection)
346 : QuicSession(connection, DefaultQuicConfig()) { 346 : QuicSession(connection, DefaultQuicConfig()) {
347 crypto_stream_.reset(new QuicCryptoStream(this)); 347 crypto_stream_.reset(new QuicCryptoStream(this));
348 Initialize(); 348 Initialize();
349 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 349 ON_CALL(*this, WritevData(_, _, _, _, _, _))
350 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 350 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
351 } 351 }
352 352
353 MockQuicSession::~MockQuicSession() {} 353 MockQuicSession::~MockQuicSession() {
354 delete connection();
355 }
354 356
355 // static 357 // static
356 QuicConsumedData MockQuicSession::ConsumeAllData( 358 QuicConsumedData MockQuicSession::ConsumeAllData(
357 ReliableQuicStream* /*stream*/, 359 ReliableQuicStream* /*stream*/,
358 QuicStreamId /*id*/, 360 QuicStreamId /*id*/,
359 const QuicIOVector& data, 361 const QuicIOVector& data,
360 QuicStreamOffset /*offset*/, 362 QuicStreamOffset /*offset*/,
361 bool fin, 363 bool fin,
362 QuicAckListenerInterface* /*ack_notifier_delegate*/) { 364 QuicAckListenerInterface* /*ack_notifier_delegate*/) {
363 return QuicConsumedData(data.total_length, fin); 365 return QuicConsumedData(data.total_length, fin);
364 } 366 }
365 367
366 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 368 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
367 : QuicSpdySession(connection, DefaultQuicConfig()) { 369 : QuicSpdySession(connection, DefaultQuicConfig()) {
368 crypto_stream_.reset(new QuicCryptoStream(this)); 370 crypto_stream_.reset(new QuicCryptoStream(this));
369 Initialize(); 371 Initialize();
370 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 372 ON_CALL(*this, WritevData(_, _, _, _, _, _))
371 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 373 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
372 } 374 }
373 375
374 MockQuicSpdySession::~MockQuicSpdySession() {} 376 MockQuicSpdySession::~MockQuicSpdySession() {
377 delete connection();
378 }
375 379
376 TestQuicSpdyServerSession::TestQuicSpdyServerSession( 380 TestQuicSpdyServerSession::TestQuicSpdyServerSession(
377 QuicConnection* connection, 381 QuicConnection* connection,
378 const QuicConfig& config, 382 const QuicConfig& config,
379 const QuicCryptoServerConfig* crypto_config, 383 const QuicCryptoServerConfig* crypto_config,
380 QuicCompressedCertsCache* compressed_certs_cache) 384 QuicCompressedCertsCache* compressed_certs_cache)
381 : QuicServerSessionBase(config, 385 : QuicServerSessionBase(config,
382 connection, 386 connection,
383 &visitor_, 387 &visitor_,
384 &helper_, 388 &helper_,
385 crypto_config, 389 crypto_config,
386 compressed_certs_cache) { 390 compressed_certs_cache) {
387 Initialize(); 391 Initialize();
388 ON_CALL(helper_, GenerateConnectionIdForReject(_)) 392 ON_CALL(helper_, GenerateConnectionIdForReject(_))
389 .WillByDefault( 393 .WillByDefault(
390 testing::Return(connection->random_generator()->RandUint64())); 394 testing::Return(connection->random_generator()->RandUint64()));
391 ON_CALL(helper_, CanAcceptClientHello(_, _, _)) 395 ON_CALL(helper_, CanAcceptClientHello(_, _, _))
392 .WillByDefault(testing::Return(true)); 396 .WillByDefault(testing::Return(true));
393 } 397 }
394 398
395 TestQuicSpdyServerSession::~TestQuicSpdyServerSession() {} 399 TestQuicSpdyServerSession::~TestQuicSpdyServerSession() {
400 delete connection();
401 }
396 402
397 QuicCryptoServerStreamBase* 403 QuicCryptoServerStreamBase*
398 TestQuicSpdyServerSession::CreateQuicCryptoServerStream( 404 TestQuicSpdyServerSession::CreateQuicCryptoServerStream(
399 const QuicCryptoServerConfig* crypto_config, 405 const QuicCryptoServerConfig* crypto_config,
400 QuicCompressedCertsCache* compressed_certs_cache) { 406 QuicCompressedCertsCache* compressed_certs_cache) {
401 return new QuicCryptoServerStream(crypto_config, compressed_certs_cache, 407 return new QuicCryptoServerStream(crypto_config, compressed_certs_cache,
402 FLAGS_enable_quic_stateless_reject_support, 408 FLAGS_enable_quic_stateless_reject_support,
403 this); 409 this);
404 } 410 }
405 411
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 // strike register worries that we've just overflowed a uint32_t time. 899 // strike register worries that we've just overflowed a uint32_t time.
894 (*server_connection)->AdvanceTime(connection_start_time); 900 (*server_connection)->AdvanceTime(connection_start_time);
895 } 901 }
896 902
897 QuicStreamId QuicClientDataStreamId(int i) { 903 QuicStreamId QuicClientDataStreamId(int i) {
898 return kClientDataStreamId1 + 2 * i; 904 return kClientDataStreamId1 + 2 * i;
899 } 905 }
900 906
901 } // namespace test 907 } // namespace test
902 } // namespace net 908 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698