OLD | NEW |
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/sha1.h" | 10 #include "base/sha1.h" |
10 #include "base/stl_util.h" | |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "net/quic/core/crypto/crypto_framer.h" | 12 #include "net/quic/core/crypto/crypto_framer.h" |
13 #include "net/quic/core/crypto/crypto_handshake.h" | 13 #include "net/quic/core/crypto/crypto_handshake.h" |
14 #include "net/quic/core/crypto/crypto_utils.h" | 14 #include "net/quic/core/crypto/crypto_utils.h" |
15 #include "net/quic/core/crypto/null_encrypter.h" | 15 #include "net/quic/core/crypto/null_encrypter.h" |
16 #include "net/quic/core/crypto/quic_decrypter.h" | 16 #include "net/quic/core/crypto/quic_decrypter.h" |
17 #include "net/quic/core/crypto/quic_encrypter.h" | 17 #include "net/quic/core/crypto/quic_encrypter.h" |
18 #include "net/quic/core/quic_data_writer.h" | 18 #include "net/quic/core/quic_data_writer.h" |
19 #include "net/quic/core/quic_framer.h" | 19 #include "net/quic/core/quic_framer.h" |
20 #include "net/quic/core/quic_packet_creator.h" | 20 #include "net/quic/core/quic_packet_creator.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 PacketSavingConnection::PacketSavingConnection( | 352 PacketSavingConnection::PacketSavingConnection( |
353 MockQuicConnectionHelper* helper, | 353 MockQuicConnectionHelper* helper, |
354 MockAlarmFactory* alarm_factory, | 354 MockAlarmFactory* alarm_factory, |
355 Perspective perspective, | 355 Perspective perspective, |
356 const QuicVersionVector& supported_versions) | 356 const QuicVersionVector& supported_versions) |
357 : MockQuicConnection(helper, | 357 : MockQuicConnection(helper, |
358 alarm_factory, | 358 alarm_factory, |
359 perspective, | 359 perspective, |
360 supported_versions) {} | 360 supported_versions) {} |
361 | 361 |
362 PacketSavingConnection::~PacketSavingConnection() { | 362 PacketSavingConnection::~PacketSavingConnection() {} |
363 base::STLDeleteElements(&encrypted_packets_); | |
364 } | |
365 | 363 |
366 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { | 364 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { |
367 encrypted_packets_.push_back(new QuicEncryptedPacket( | 365 encrypted_packets_.push_back(base::MakeUnique<QuicEncryptedPacket>( |
368 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true)); | 366 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true)); |
369 // Transfer ownership of the packet to the SentPacketManager and the | 367 // Transfer ownership of the packet to the SentPacketManager and the |
370 // ack notifier to the AckNotifierManager. | 368 // ack notifier to the AckNotifierManager. |
371 sent_packet_manager_->OnPacketSent(packet, kInvalidPathId, 0, | 369 sent_packet_manager_->OnPacketSent(packet, kInvalidPathId, 0, |
372 QuicTime::Zero(), NOT_RETRANSMISSION, | 370 QuicTime::Zero(), NOT_RETRANSMISSION, |
373 HAS_RETRANSMITTABLE_DATA); | 371 HAS_RETRANSMITTABLE_DATA); |
374 } | 372 } |
375 | 373 |
376 MockQuicSession::MockQuicSession(QuicConnection* connection) | 374 MockQuicSession::MockQuicSession(QuicConnection* connection) |
377 : QuicSession(connection, DefaultQuicConfig()) { | 375 : QuicSession(connection, DefaultQuicConfig()) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 // 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. |
929 (*server_connection)->AdvanceTime(connection_start_time); | 927 (*server_connection)->AdvanceTime(connection_start_time); |
930 } | 928 } |
931 | 929 |
932 QuicStreamId QuicClientDataStreamId(int i) { | 930 QuicStreamId QuicClientDataStreamId(int i) { |
933 return kClientDataStreamId1 + 2 * i; | 931 return kClientDataStreamId1 + 2 * i; |
934 } | 932 } |
935 | 933 |
936 } // namespace test | 934 } // namespace test |
937 } // namespace net | 935 } // namespace net |
OLD | NEW |