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 "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 Loading... |
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // strike register worries that we've just overflowed a uint32_t time. | 788 // strike register worries that we've just overflowed a uint32_t time. |
792 (*server_connection)->AdvanceTime(connection_start_time); | 789 (*server_connection)->AdvanceTime(connection_start_time); |
793 } | 790 } |
794 | 791 |
795 QuicStreamId QuicClientDataStreamId(int i) { | 792 QuicStreamId QuicClientDataStreamId(int i) { |
796 return kClientDataStreamId1 + 2 * i; | 793 return kClientDataStreamId1 + 2 * i; |
797 } | 794 } |
798 | 795 |
799 } // namespace test | 796 } // namespace test |
800 } // namespace net | 797 } // namespace net |
OLD | NEW |