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

Side by Side Diff: net/quic/p2p/quic_p2p_session_test.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/p2p/quic_p2p_session.cc ('k') | net/quic/quic_chromium_client_session.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/p2p/quic_p2p_session.h" 5 #include "net/quic/p2p/quic_p2p_session.h"
6 6
7 #include <utility>
8
7 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
11 #include "base/run_loop.h" 13 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
14 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
16 #include "net/quic/crypto/quic_random.h" 18 #include "net/quic/crypto/quic_random.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void CreateSessions() { 225 void CreateSessions() {
224 scoped_ptr<FakeP2PDatagramSocket> socket1(new FakeP2PDatagramSocket()); 226 scoped_ptr<FakeP2PDatagramSocket> socket1(new FakeP2PDatagramSocket());
225 scoped_ptr<FakeP2PDatagramSocket> socket2(new FakeP2PDatagramSocket()); 227 scoped_ptr<FakeP2PDatagramSocket> socket2(new FakeP2PDatagramSocket());
226 socket1->ConnectWith(socket2.get()); 228 socket1->ConnectWith(socket2.get());
227 229
228 socket1_ = socket1->GetWeakPtr(); 230 socket1_ = socket1->GetWeakPtr();
229 socket2_ = socket2->GetWeakPtr(); 231 socket2_ = socket2->GetWeakPtr();
230 232
231 QuicP2PCryptoConfig crypto_config(kTestSharedKey); 233 QuicP2PCryptoConfig crypto_config(kTestSharedKey);
232 234
233 session1_ = 235 session1_ = CreateP2PSession(std::move(socket1), crypto_config,
234 CreateP2PSession(socket1.Pass(), crypto_config, Perspective::IS_SERVER); 236 Perspective::IS_SERVER);
235 session2_ = 237 session2_ = CreateP2PSession(std::move(socket2), crypto_config,
236 CreateP2PSession(socket2.Pass(), crypto_config, Perspective::IS_CLIENT); 238 Perspective::IS_CLIENT);
237 } 239 }
238 240
239 scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket, 241 scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket,
240 QuicP2PCryptoConfig crypto_config, 242 QuicP2PCryptoConfig crypto_config,
241 Perspective perspective) { 243 Perspective perspective) {
242 DefaultPacketWriterFactory writer_factory(socket.get()); 244 DefaultPacketWriterFactory writer_factory(socket.get());
243 net::IPAddressNumber ip(net::kIPv4AddressSize, 0); 245 net::IPAddressNumber ip(net::kIPv4AddressSize, 0);
244 scoped_ptr<QuicConnection> quic_connection1(new QuicConnection( 246 scoped_ptr<QuicConnection> quic_connection1(new QuicConnection(
245 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory, 247 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory,
246 true /* owns_writer */, perspective, QuicSupportedVersions())); 248 true /* owns_writer */, perspective, QuicSupportedVersions()));
247 249
248 scoped_ptr<QuicP2PSession> result(new QuicP2PSession( 250 scoped_ptr<QuicP2PSession> result(
249 config_, crypto_config, quic_connection1.Pass(), socket.Pass())); 251 new QuicP2PSession(config_, crypto_config, std::move(quic_connection1),
252 std::move(socket)));
250 result->Initialize(); 253 result->Initialize();
251 return result.Pass(); 254 return result;
252 } 255 }
253 256
254 void TestStreamConnection(QuicP2PSession* from_session, 257 void TestStreamConnection(QuicP2PSession* from_session,
255 QuicP2PSession* to_session, 258 QuicP2PSession* to_session,
256 QuicStreamId expected_stream_id); 259 QuicStreamId expected_stream_id);
257 260
258 QuicClock quic_clock_; 261 QuicClock quic_clock_;
259 QuicConnectionHelper quic_helper_; 262 QuicConnectionHelper quic_helper_;
260 QuicConfig config_; 263 QuicConfig config_;
261 264
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 EXPECT_TRUE(stream_delegate.is_closed()); 389 EXPECT_TRUE(stream_delegate.is_closed());
387 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); 390 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error());
388 EXPECT_TRUE(session_delegate.is_closed()); 391 EXPECT_TRUE(session_delegate.is_closed());
389 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); 392 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error());
390 393
391 // Verify that the socket was destroyed. 394 // Verify that the socket was destroyed.
392 EXPECT_FALSE(socket1_); 395 EXPECT_FALSE(socket1_);
393 } 396 }
394 397
395 } // namespace net 398 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/p2p/quic_p2p_session.cc ('k') | net/quic/quic_chromium_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698