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

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

Issue 2460163002: Refactor QuicServerSessionBase::Visitor (Closed)
Patch Set: Updated patchset dependency Created 4 years, 1 month 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_dispatcher.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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 encrypted_packets_.push_back(base::MakeUnique<QuicEncryptedPacket>( 365 encrypted_packets_.push_back(base::MakeUnique<QuicEncryptedPacket>(
366 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true)); 366 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true));
367 // Transfer ownership of the packet to the SentPacketManager and the 367 // Transfer ownership of the packet to the SentPacketManager and the
368 // ack notifier to the AckNotifierManager. 368 // ack notifier to the AckNotifierManager.
369 sent_packet_manager_->OnPacketSent(packet, kInvalidPathId, 0, 369 sent_packet_manager_->OnPacketSent(packet, kInvalidPathId, 0,
370 QuicTime::Zero(), NOT_RETRANSMISSION, 370 QuicTime::Zero(), NOT_RETRANSMISSION,
371 HAS_RETRANSMITTABLE_DATA); 371 HAS_RETRANSMITTABLE_DATA);
372 } 372 }
373 373
374 MockQuicSession::MockQuicSession(QuicConnection* connection) 374 MockQuicSession::MockQuicSession(QuicConnection* connection)
375 : QuicSession(connection, DefaultQuicConfig()) { 375 : QuicSession(connection, nullptr, DefaultQuicConfig()) {
376 crypto_stream_.reset(new QuicCryptoStream(this)); 376 crypto_stream_.reset(new QuicCryptoStream(this));
377 Initialize(); 377 Initialize();
378 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 378 ON_CALL(*this, WritevData(_, _, _, _, _, _))
379 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 379 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
380 } 380 }
381 381
382 MockQuicSession::~MockQuicSession() { 382 MockQuicSession::~MockQuicSession() {
383 delete connection(); 383 delete connection();
384 } 384 }
385 385
386 // static 386 // static
387 QuicConsumedData MockQuicSession::ConsumeAllData( 387 QuicConsumedData MockQuicSession::ConsumeAllData(
388 ReliableQuicStream* /*stream*/, 388 ReliableQuicStream* /*stream*/,
389 QuicStreamId /*id*/, 389 QuicStreamId /*id*/,
390 const QuicIOVector& data, 390 const QuicIOVector& data,
391 QuicStreamOffset /*offset*/, 391 QuicStreamOffset /*offset*/,
392 bool fin, 392 bool fin,
393 QuicAckListenerInterface* /*ack_notifier_delegate*/) { 393 QuicAckListenerInterface* /*ack_notifier_delegate*/) {
394 return QuicConsumedData(data.total_length, fin); 394 return QuicConsumedData(data.total_length, fin);
395 } 395 }
396 396
397 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 397 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
398 : QuicSpdySession(connection, DefaultQuicConfig()) { 398 : QuicSpdySession(connection, nullptr, DefaultQuicConfig()) {
399 crypto_stream_.reset(new QuicCryptoStream(this)); 399 crypto_stream_.reset(new QuicCryptoStream(this));
400 Initialize(); 400 Initialize();
401 ON_CALL(*this, WritevData(_, _, _, _, _, _)) 401 ON_CALL(*this, WritevData(_, _, _, _, _, _))
402 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 402 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
403 } 403 }
404 404
405 MockQuicSpdySession::~MockQuicSpdySession() { 405 MockQuicSpdySession::~MockQuicSpdySession() {
406 delete connection(); 406 delete connection();
407 } 407 }
408 408
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 // strike register worries that we've just overflowed a uint32_t time. 926 // strike register worries that we've just overflowed a uint32_t time.
927 (*server_connection)->AdvanceTime(connection_start_time); 927 (*server_connection)->AdvanceTime(connection_start_time);
928 } 928 }
929 929
930 QuicStreamId QuicClientDataStreamId(int i) { 930 QuicStreamId QuicClientDataStreamId(int i) {
931 return kClientDataStreamId1 + 2 * i; 931 return kClientDataStreamId1 + 2 * i;
932 } 932 }
933 933
934 } // namespace test 934 } // namespace test
935 } // namespace net 935 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698