| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 PacketSavingConnection::PacketSavingConnection( | 275 PacketSavingConnection::PacketSavingConnection( |
| 276 MockConnectionHelper* helper, | 276 MockConnectionHelper* helper, |
| 277 Perspective perspective, | 277 Perspective perspective, |
| 278 const QuicVersionVector& supported_versions) | 278 const QuicVersionVector& supported_versions) |
| 279 : MockConnection(helper, perspective, supported_versions) {} | 279 : MockConnection(helper, perspective, supported_versions) {} |
| 280 | 280 |
| 281 PacketSavingConnection::~PacketSavingConnection() { | 281 PacketSavingConnection::~PacketSavingConnection() { |
| 282 STLDeleteElements(&encrypted_packets_); | 282 STLDeleteElements(&encrypted_packets_); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void PacketSavingConnection::SendOrQueuePacket(QueuedPacket packet) { | 285 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { |
| 286 if (!packet.serialized_packet.packet->owns_buffer()) { | 286 if (!packet->packet->owns_buffer()) { |
| 287 scoped_ptr<QuicEncryptedPacket> encrypted_deleter( | 287 scoped_ptr<QuicEncryptedPacket> encrypted_deleter(packet->packet); |
| 288 packet.serialized_packet.packet); | 288 packet->packet = packet->packet->Clone(); |
| 289 packet.serialized_packet.packet = packet.serialized_packet.packet->Clone(); | |
| 290 } | 289 } |
| 291 encrypted_packets_.push_back(packet.serialized_packet.packet); | 290 encrypted_packets_.push_back(packet->packet); |
| 292 // Transfer ownership of the packet to the SentPacketManager and the | 291 // Transfer ownership of the packet to the SentPacketManager and the |
| 293 // ack notifier to the AckNotifierManager. | 292 // ack notifier to the AckNotifierManager. |
| 294 sent_packet_manager_.OnPacketSent(&packet.serialized_packet, 0, | 293 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 1000, |
| 295 QuicTime::Zero(), 1000, NOT_RETRANSMISSION, | 294 NOT_RETRANSMISSION, |
| 296 HAS_RETRANSMITTABLE_DATA); | 295 HAS_RETRANSMITTABLE_DATA); |
| 297 } | 296 } |
| 298 | 297 |
| 299 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) | 298 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) |
| 300 : QuicSpdySession(connection, DefaultQuicConfig()) { | 299 : QuicSpdySession(connection, DefaultQuicConfig()) { |
| 301 crypto_stream_.reset(new QuicCryptoStream(this)); | 300 crypto_stream_.reset(new QuicCryptoStream(this)); |
| 302 Initialize(); | 301 Initialize(); |
| 303 ON_CALL(*this, WritevData(_, _, _, _, _, _)) | 302 ON_CALL(*this, WritevData(_, _, _, _, _, _)) |
| 304 .WillByDefault(testing::Return(QuicConsumedData(0, false))); | 303 .WillByDefault(testing::Return(QuicConsumedData(0, false))); |
| 305 } | 304 } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 // strike register worries that we've just overflowed a uint32_t time. | 808 // strike register worries that we've just overflowed a uint32_t time. |
| 810 (*server_connection)->AdvanceTime(connection_start_time); | 809 (*server_connection)->AdvanceTime(connection_start_time); |
| 811 } | 810 } |
| 812 | 811 |
| 813 QuicStreamId QuicClientDataStreamId(int i) { | 812 QuicStreamId QuicClientDataStreamId(int i) { |
| 814 return kClientDataStreamId1 + 2 * i; | 813 return kClientDataStreamId1 + 2 * i; |
| 815 } | 814 } |
| 816 | 815 |
| 817 } // namespace test | 816 } // namespace test |
| 818 } // namespace net | 817 } // namespace net |
| OLD | NEW |