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

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

Issue 1667583004: Landing Recent QUIC changes until 01/31/2016 05:22 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0203
Patch Set: Rebase Created 4 years, 10 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_packet_creator_peer.cc ('k') | net/tools/quic/end_to_end_test.cc » ('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 "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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 MockConnectionHelper* helper, 288 MockConnectionHelper* helper,
289 Perspective perspective, 289 Perspective perspective,
290 const QuicVersionVector& supported_versions) 290 const QuicVersionVector& supported_versions)
291 : MockConnection(helper, perspective, supported_versions) {} 291 : MockConnection(helper, perspective, supported_versions) {}
292 292
293 PacketSavingConnection::~PacketSavingConnection() { 293 PacketSavingConnection::~PacketSavingConnection() {
294 STLDeleteElements(&encrypted_packets_); 294 STLDeleteElements(&encrypted_packets_);
295 } 295 }
296 296
297 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { 297 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) {
298 if (!packet->packet->owns_buffer()) { 298 encrypted_packets_.push_back(new QuicEncryptedPacket(
299 scoped_ptr<QuicEncryptedPacket> encrypted_deleter(packet->packet); 299 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true));
300 packet->packet = packet->packet->Clone();
301 }
302 encrypted_packets_.push_back(packet->packet);
303 // Transfer ownership of the packet to the SentPacketManager and the 300 // Transfer ownership of the packet to the SentPacketManager and the
304 // ack notifier to the AckNotifierManager. 301 // ack notifier to the AckNotifierManager.
305 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 1000, 302 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 1000,
306 NOT_RETRANSMISSION, 303 NOT_RETRANSMISSION,
307 HAS_RETRANSMITTABLE_DATA); 304 HAS_RETRANSMITTABLE_DATA);
308 } 305 }
309 306
310 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 307 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
311 : QuicSpdySession(connection, DefaultQuicConfig()) { 308 : QuicSpdySession(connection, DefaultQuicConfig()) {
312 crypto_stream_.reset(new QuicCryptoStream(this)); 309 crypto_stream_.reset(new QuicCryptoStream(this));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 347 }
351 348
352 TestQuicSpdyClientSession::TestQuicSpdyClientSession( 349 TestQuicSpdyClientSession::TestQuicSpdyClientSession(
353 QuicConnection* connection, 350 QuicConnection* connection,
354 const QuicConfig& config, 351 const QuicConfig& config,
355 const QuicServerId& server_id, 352 const QuicServerId& server_id,
356 QuicCryptoClientConfig* crypto_config) 353 QuicCryptoClientConfig* crypto_config)
357 : QuicClientSessionBase(connection, &push_promise_index_, config) { 354 : QuicClientSessionBase(connection, &push_promise_index_, config) {
358 crypto_stream_.reset(new QuicCryptoClientStream( 355 crypto_stream_.reset(new QuicCryptoClientStream(
359 server_id, this, CryptoTestUtils::ProofVerifyContextForTesting(), 356 server_id, this, CryptoTestUtils::ProofVerifyContextForTesting(),
360 crypto_config)); 357 crypto_config, this));
361 Initialize(); 358 Initialize();
362 } 359 }
363 360
364 TestQuicSpdyClientSession::~TestQuicSpdyClientSession() {} 361 TestQuicSpdyClientSession::~TestQuicSpdyClientSession() {}
365 362
366 bool TestQuicSpdyClientSession::IsAuthorized(const string& authority) { 363 bool TestQuicSpdyClientSession::IsAuthorized(const string& authority) {
367 return true; 364 return true;
368 } 365 }
369 366
370 QuicCryptoClientStream* TestQuicSpdyClientSession::GetCryptoStream() { 367 QuicCryptoClientStream* TestQuicSpdyClientSession::GetCryptoStream() {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // strike register worries that we've just overflowed a uint32_t time. 792 // strike register worries that we've just overflowed a uint32_t time.
796 (*server_connection)->AdvanceTime(connection_start_time); 793 (*server_connection)->AdvanceTime(connection_start_time);
797 } 794 }
798 795
799 QuicStreamId QuicClientDataStreamId(int i) { 796 QuicStreamId QuicClientDataStreamId(int i) {
800 return kClientDataStreamId1 + 2 * i; 797 return kClientDataStreamId1 + 2 * i;
801 } 798 }
802 799
803 } // namespace test 800 } // namespace test
804 } // namespace net 801 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_packet_creator_peer.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698