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

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

Issue 2903633002: Move some method definitions from header file to .cc file in shared QUIC in order to comply with Ch… (Closed)
Patch Set: Created 3 years, 7 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') | 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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "net/quic/core/crypto/crypto_framer.h" 10 #include "net/quic/core/crypto/crypto_framer.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 .WillByDefault( 327 .WillByDefault(
328 Invoke(this, &PacketSavingConnection::QuicConnection_OnError)); 328 Invoke(this, &PacketSavingConnection::QuicConnection_OnError));
329 } 329 }
330 330
331 MockQuicConnection::~MockQuicConnection() {} 331 MockQuicConnection::~MockQuicConnection() {}
332 332
333 void MockQuicConnection::AdvanceTime(QuicTime::Delta delta) { 333 void MockQuicConnection::AdvanceTime(QuicTime::Delta delta) {
334 static_cast<MockQuicConnectionHelper*>(helper())->AdvanceTime(delta); 334 static_cast<MockQuicConnectionHelper*>(helper())->AdvanceTime(delta);
335 } 335 }
336 336
337 bool MockQuicConnection::OnProtocolVersionMismatch(QuicVersion version) {
338 return false;
339 }
340
337 PacketSavingConnection::PacketSavingConnection(MockQuicConnectionHelper* helper, 341 PacketSavingConnection::PacketSavingConnection(MockQuicConnectionHelper* helper,
338 MockAlarmFactory* alarm_factory, 342 MockAlarmFactory* alarm_factory,
339 Perspective perspective) 343 Perspective perspective)
340 : MockQuicConnection(helper, alarm_factory, perspective) {} 344 : MockQuicConnection(helper, alarm_factory, perspective) {}
341 345
342 PacketSavingConnection::PacketSavingConnection( 346 PacketSavingConnection::PacketSavingConnection(
343 MockQuicConnectionHelper* helper, 347 MockQuicConnectionHelper* helper,
344 MockAlarmFactory* alarm_factory, 348 MockAlarmFactory* alarm_factory,
345 Perspective perspective, 349 Perspective perspective,
346 const QuicVersionVector& supported_versions) 350 const QuicVersionVector& supported_versions)
(...skipping 19 matching lines...) Expand all
366 crypto_stream_.reset(new QuicCryptoStream(this)); 370 crypto_stream_.reset(new QuicCryptoStream(this));
367 Initialize(); 371 Initialize();
368 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 372 ON_CALL(*this, WritevData(_, _, _, _, _, _))
369 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 373 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
370 } 374 }
371 375
372 MockQuicSession::~MockQuicSession() { 376 MockQuicSession::~MockQuicSession() {
373 delete connection(); 377 delete connection();
374 } 378 }
375 379
380 QuicCryptoStream* MockQuicSession::GetMutableCryptoStream() {
381 return crypto_stream_.get();
382 }
383
384 const QuicCryptoStream* MockQuicSession::GetCryptoStream() const {
385 return crypto_stream_.get();
386 }
387
376 // static 388 // static
377 QuicConsumedData MockQuicSession::ConsumeAllData( 389 QuicConsumedData MockQuicSession::ConsumeAllData(
378 QuicStream* /*stream*/, 390 QuicStream* /*stream*/,
379 QuicStreamId /*id*/, 391 QuicStreamId /*id*/,
380 const QuicIOVector& data, 392 const QuicIOVector& data,
381 QuicStreamOffset /*offset*/, 393 QuicStreamOffset /*offset*/,
382 StreamSendingState state, 394 StreamSendingState state,
383 const QuicReferenceCountedPointer< 395 const QuicReferenceCountedPointer<
384 QuicAckListenerInterface>& /*ack_listener*/) { 396 QuicAckListenerInterface>& /*ack_listener*/) {
385 return QuicConsumedData(data.total_length, state != NO_FIN); 397 return QuicConsumedData(data.total_length, state != NO_FIN);
386 } 398 }
387 399
388 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 400 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
389 : QuicSpdySession(connection, nullptr, DefaultQuicConfig()) { 401 : QuicSpdySession(connection, nullptr, DefaultQuicConfig()) {
390 crypto_stream_.reset(new QuicCryptoStream(this)); 402 crypto_stream_.reset(new QuicCryptoStream(this));
391 Initialize(); 403 Initialize();
392 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 404 ON_CALL(*this, WritevData(_, _, _, _, _, _))
393 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 405 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
394 } 406 }
395 407
396 MockQuicSpdySession::~MockQuicSpdySession() { 408 MockQuicSpdySession::~MockQuicSpdySession() {
397 delete connection(); 409 delete connection();
398 } 410 }
399 411
412 QuicCryptoStream* MockQuicSpdySession::GetMutableCryptoStream() {
413 return crypto_stream_.get();
414 }
415
416 const QuicCryptoStream* MockQuicSpdySession::GetCryptoStream() const {
417 return crypto_stream_.get();
418 }
419
420 size_t MockQuicSpdySession::WriteHeaders(
421 QuicStreamId id,
422 SpdyHeaderBlock headers,
423 bool fin,
424 SpdyPriority priority,
425 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
426 write_headers_ = std::move(headers);
427 return WriteHeadersMock(id, write_headers_, fin, priority, ack_listener);
428 }
429
400 TestQuicSpdyServerSession::TestQuicSpdyServerSession( 430 TestQuicSpdyServerSession::TestQuicSpdyServerSession(
401 QuicConnection* connection, 431 QuicConnection* connection,
402 const QuicConfig& config, 432 const QuicConfig& config,
403 const QuicCryptoServerConfig* crypto_config, 433 const QuicCryptoServerConfig* crypto_config,
404 QuicCompressedCertsCache* compressed_certs_cache) 434 QuicCompressedCertsCache* compressed_certs_cache)
405 : QuicServerSessionBase(config, 435 : QuicServerSessionBase(config,
406 connection, 436 connection,
407 &visitor_, 437 &visitor_,
408 &helper_, 438 &helper_,
409 crypto_config, 439 crypto_config,
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 QuicStreamId GetNthClientInitiatedStreamId(QuicVersion version, int n) { 875 QuicStreamId GetNthClientInitiatedStreamId(QuicVersion version, int n) {
846 return 5 + NextStreamId(version) * n; 876 return 5 + NextStreamId(version) * n;
847 } 877 }
848 878
849 QuicStreamId GetNthServerInitiatedStreamId(QuicVersion version, int n) { 879 QuicStreamId GetNthServerInitiatedStreamId(QuicVersion version, int n) {
850 return 2 + NextStreamId(version) * n; 880 return 2 + NextStreamId(version) * n;
851 } 881 }
852 882
853 } // namespace test 883 } // namespace test
854 } // namespace net 884 } // namespace net
OLDNEW
« 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