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

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

Issue 1932653002: Fixes use-after-free bug in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 <memory> 7 #include <memory>
8 8
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) { 319 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) {
320 encrypted_packets_.push_back(new QuicEncryptedPacket( 320 encrypted_packets_.push_back(new QuicEncryptedPacket(
321 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true)); 321 QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true));
322 // Transfer ownership of the packet to the SentPacketManager and the 322 // Transfer ownership of the packet to the SentPacketManager and the
323 // ack notifier to the AckNotifierManager. 323 // ack notifier to the AckNotifierManager.
324 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 324 sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(),
325 NOT_RETRANSMISSION, 325 NOT_RETRANSMISSION,
326 HAS_RETRANSMITTABLE_DATA); 326 HAS_RETRANSMITTABLE_DATA);
327 } 327 }
328 328
329 MockQuicSession::MockQuicSession(QuicConnection* connection)
330 : QuicSession(connection, DefaultQuicConfig()) {
331 crypto_stream_.reset(new QuicCryptoStream(this));
332 Initialize();
333 ON_CALL(*this, WritevData(_, _, _, _, _))
334 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
335 }
336
337 MockQuicSession::~MockQuicSession() {}
338
339 // static
340 QuicConsumedData MockQuicSession::ConsumeAllData(
341 QuicStreamId /*id*/,
342 const QuicIOVector& data,
343 QuicStreamOffset /*offset*/,
344 bool fin,
345 QuicAckListenerInterface* /*ack_notifier_delegate*/) {
346 return QuicConsumedData(data.total_length, fin);
347 }
348
329 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection) 349 MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
330 : QuicSpdySession(connection, DefaultQuicConfig()) { 350 : QuicSpdySession(connection, DefaultQuicConfig()) {
331 crypto_stream_.reset(new QuicCryptoStream(this)); 351 crypto_stream_.reset(new QuicCryptoStream(this));
332 Initialize(); 352 Initialize();
333 ON_CALL(*this, WritevData(_, _, _, _, _)) 353 ON_CALL(*this, WritevData(_, _, _, _, _))
334 .WillByDefault(testing::Return(QuicConsumedData(0, false))); 354 .WillByDefault(testing::Return(QuicConsumedData(0, false)));
335 } 355 }
336 356
337 MockQuicSpdySession::~MockQuicSpdySession() {} 357 MockQuicSpdySession::~MockQuicSpdySession() {}
338 358
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // strike register worries that we've just overflowed a uint32_t time. 850 // strike register worries that we've just overflowed a uint32_t time.
831 (*server_connection)->AdvanceTime(connection_start_time); 851 (*server_connection)->AdvanceTime(connection_start_time);
832 } 852 }
833 853
834 QuicStreamId QuicClientDataStreamId(int i) { 854 QuicStreamId QuicClientDataStreamId(int i) {
835 return kClientDataStreamId1 + 2 * i; 855 return kClientDataStreamId1 + 2 * i;
836 } 856 }
837 857
838 } // namespace test 858 } // namespace test
839 } // namespace net 859 } // 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