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

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

Issue 1975483003: Fixes use-after-free bug in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Removes use of QuicHeaderList from merge CL. Created 4 years, 7 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_test_utils.h ('k') | no next file » | 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { 298 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) {
299 encrypted_packets_.push_back(new QuicEncryptedPacket( 299 encrypted_packets_.push_back(new QuicEncryptedPacket(
300 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true)); 300 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true));
301 // Transfer ownership of the packet to the SentPacketManager and the 301 // Transfer ownership of the packet to the SentPacketManager and the
302 // ack notifier to the AckNotifierManager. 302 // ack notifier to the AckNotifierManager.
303 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 303 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(),
304 NOT_RETRANSMISSION, 304 NOT_RETRANSMISSION,
305 HAS_RETRANSMITTABLE_DATA); 305 HAS_RETRANSMITTABLE_DATA);
306 } 306 }
307 307
308 MockQuicSession::MockQuicSession(QuicConnection* connection)
309 : QuicSession(connection, DefaultQuicConfig()) {
310 crypto_stream_.reset(new QuicCryptoStream(this));
311 Initialize();
312 ON_CALL(*this, WritevData(_, _, _, _, _))
313 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
314 }
315
316 MockQuicSession::~MockQuicSession() {}
317
318 // static
319 QuicConsumedData MockQuicSession::ConsumeAllData(
320 QuicStreamId /*id*/,
321 const QuicIOVector& data,
322 QuicStreamOffset /*offset*/,
323 bool fin,
324 QuicAckListenerInterface* /*ack_notifier_delegate*/) {
325 return QuicConsumedData(data.total_length, fin);
326 }
327
308 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 328 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
309 : QuicSpdySession(connection, DefaultQuicConfig()) { 329 : QuicSpdySession(connection, DefaultQuicConfig()) {
310 crypto_stream_.reset(new QuicCryptoStream(this)); 330 crypto_stream_.reset(new QuicCryptoStream(this));
311 Initialize(); 331 Initialize();
312 ON_CALL(*this, WritevData(_, _, _, _, _)) 332 ON_CALL(*this, WritevData(_, _, _, _, _))
313 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 333 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
314 } 334 }
315 335
316 MockQuicSpdySession::~MockQuicSpdySession() {} 336 MockQuicSpdySession::~MockQuicSpdySession() {}
317 337
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 // strike register worries that we've just overflowed a uint32_t time. 824 // strike register worries that we've just overflowed a uint32_t time.
805 (*server_connection)->AdvanceTime(connection_start_time); 825 (*server_connection)->AdvanceTime(connection_start_time);
806 } 826 }
807 827
808 QuicStreamId QuicClientDataStreamId(int i) { 828 QuicStreamId QuicClientDataStreamId(int i) {
809 return kClientDataStreamId1 + 2 * i; 829 return kClientDataStreamId1 + 2 * i;
810 } 830 }
811 831
812 } // namespace test 832 } // namespace test
813 } // namespace net 833 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698