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

Side by Side Diff: net/tools/quic/quic_dispatcher_test.cc

Issue 1901173003: Cleanup: Migrate references from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119568788
Patch Set: Created 4 years, 8 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/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_in_memory_cache.h » ('j') | 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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Processes a packet. 234 // Processes a packet.
235 void ProcessPacket(IPEndPoint client_address, 235 void ProcessPacket(IPEndPoint client_address,
236 QuicConnectionId connection_id, 236 QuicConnectionId connection_id,
237 bool has_version_flag, 237 bool has_version_flag,
238 QuicVersion version, 238 QuicVersion version,
239 const string& data, 239 const string& data,
240 QuicConnectionIdLength connection_id_length, 240 QuicConnectionIdLength connection_id_length,
241 QuicPacketNumberLength packet_number_length, 241 QuicPacketNumberLength packet_number_length,
242 QuicPacketNumber packet_number) { 242 QuicPacketNumber packet_number) {
243 QuicVersionVector versions(SupportedVersions(version)); 243 QuicVersionVector versions(SupportedVersions(version));
244 scoped_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( 244 std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket(
245 connection_id, has_version_flag, false, false, 0, packet_number, data, 245 connection_id, has_version_flag, false, false, 0, packet_number, data,
246 connection_id_length, packet_number_length, &versions)); 246 connection_id_length, packet_number_length, &versions));
247 scoped_ptr<QuicReceivedPacket> received_packet( 247 std::unique_ptr<QuicReceivedPacket> received_packet(
248 ConstructReceivedPacket(*packet, helper_.GetClock()->Now())); 248 ConstructReceivedPacket(*packet, helper_.GetClock()->Now()));
249 249
250 data_ = string(packet->data(), packet->length()); 250 data_ = string(packet->data(), packet->length());
251 dispatcher_.ProcessPacket(server_address_, client_address, 251 dispatcher_.ProcessPacket(server_address_, client_address,
252 *received_packet); 252 *received_packet);
253 } 253 }
254 254
255 void ValidatePacket(const QuicEncryptedPacket& packet) { 255 void ValidatePacket(const QuicEncryptedPacket& packet) {
256 EXPECT_EQ(data_.length(), packet.AsStringPiece().length()); 256 EXPECT_EQ(data_.length(), packet.AsStringPiece().length());
257 EXPECT_EQ(data_, packet.AsStringPiece()); 257 EXPECT_EQ(data_, packet.AsStringPiece());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_))); 365 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_)));
366 ProcessPacket(client_address, connection_id, true, false, "foo"); 366 ProcessPacket(client_address, connection_id, true, false, "foo");
367 367
368 // Close the connection by sending public reset packet. 368 // Close the connection by sending public reset packet.
369 QuicPublicResetPacket packet; 369 QuicPublicResetPacket packet;
370 packet.public_header.connection_id = connection_id; 370 packet.public_header.connection_id = connection_id;
371 packet.public_header.reset_flag = true; 371 packet.public_header.reset_flag = true;
372 packet.public_header.version_flag = false; 372 packet.public_header.version_flag = false;
373 packet.rejected_packet_number = 19191; 373 packet.rejected_packet_number = 19191;
374 packet.nonce_proof = 132232; 374 packet.nonce_proof = 132232;
375 scoped_ptr<QuicEncryptedPacket> encrypted( 375 std::unique_ptr<QuicEncryptedPacket> encrypted(
376 QuicFramer::BuildPublicResetPacket(packet)); 376 QuicFramer::BuildPublicResetPacket(packet));
377 scoped_ptr<QuicReceivedPacket> received( 377 std::unique_ptr<QuicReceivedPacket> received(
378 ConstructReceivedPacket(*encrypted, helper_.GetClock()->Now())); 378 ConstructReceivedPacket(*encrypted, helper_.GetClock()->Now()));
379 EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, _, 379 EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, _,
380 ConnectionCloseSource::FROM_PEER)) 380 ConnectionCloseSource::FROM_PEER))
381 .Times(1) 381 .Times(1)
382 .WillOnce(WithoutArgs(Invoke( 382 .WillOnce(WithoutArgs(Invoke(
383 reinterpret_cast<MockServerConnection*>(session1_->connection()), 383 reinterpret_cast<MockServerConnection*>(session1_->connection()),
384 &MockServerConnection::UnregisterOnConnectionClosed))); 384 &MockServerConnection::UnregisterOnConnectionClosed)));
385 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()), 385 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()),
386 ProcessUdpPacket(_, _, _)) 386 ProcessUdpPacket(_, _, _))
387 .WillOnce( 387 .WillOnce(
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 853
854 // And we'll resume where we left off when we get another call. 854 // And we'll resume where we left off when we get another call.
855 EXPECT_CALL(*connection2(), OnCanWrite()); 855 EXPECT_CALL(*connection2(), OnCanWrite());
856 dispatcher_.OnCanWrite(); 856 dispatcher_.OnCanWrite();
857 EXPECT_FALSE(dispatcher_.HasPendingWrites()); 857 EXPECT_FALSE(dispatcher_.HasPendingWrites());
858 } 858 }
859 859
860 } // namespace 860 } // namespace
861 } // namespace test 861 } // namespace test
862 } // namespace net 862 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_in_memory_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698