| OLD | NEW |
| 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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 CreateP2PSession(socket1.Pass(), crypto_config, Perspective::IS_SERVER); | 233 CreateP2PSession(socket1.Pass(), crypto_config, Perspective::IS_SERVER); |
| 234 session2_ = | 234 session2_ = |
| 235 CreateP2PSession(socket2.Pass(), crypto_config, Perspective::IS_CLIENT); | 235 CreateP2PSession(socket2.Pass(), crypto_config, Perspective::IS_CLIENT); |
| 236 } | 236 } |
| 237 | 237 |
| 238 scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket, | 238 scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket, |
| 239 QuicP2PCryptoConfig crypto_config, | 239 QuicP2PCryptoConfig crypto_config, |
| 240 Perspective perspective) { | 240 Perspective perspective) { |
| 241 DefaultPacketWriterFactory writer_factory(socket.get()); | 241 DefaultPacketWriterFactory writer_factory(socket.get()); |
| 242 net::IPAddressNumber ip(net::kIPv4AddressSize, 0); | 242 net::IPAddressNumber ip(net::kIPv4AddressSize, 0); |
| 243 scoped_ptr<QuicConnection> quic_connection1( | 243 scoped_ptr<QuicConnection> quic_connection1(new QuicConnection( |
| 244 new QuicConnection(0, net::IPEndPoint(ip, 0), &quic_helper_, | 244 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory, |
| 245 writer_factory, true /* owns_writer */, perspective, | 245 true /* owns_writer */, perspective, QuicSupportedVersions())); |
| 246 true /* is_secuire */, QuicSupportedVersions())); | |
| 247 | 246 |
| 248 scoped_ptr<QuicP2PSession> result(new QuicP2PSession( | 247 scoped_ptr<QuicP2PSession> result(new QuicP2PSession( |
| 249 config_, crypto_config, quic_connection1.Pass(), socket.Pass())); | 248 config_, crypto_config, quic_connection1.Pass(), socket.Pass())); |
| 250 result->Initialize(); | 249 result->Initialize(); |
| 251 return result.Pass(); | 250 return result.Pass(); |
| 252 } | 251 } |
| 253 | 252 |
| 254 void TestStreamConnection(QuicP2PSession* from_session, | 253 void TestStreamConnection(QuicP2PSession* from_session, |
| 255 QuicP2PSession* to_session, | 254 QuicP2PSession* to_session, |
| 256 QuicStreamId expected_stream_id); | 255 QuicStreamId expected_stream_id); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 EXPECT_TRUE(stream_delegate.is_closed()); | 382 EXPECT_TRUE(stream_delegate.is_closed()); |
| 384 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); | 383 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); |
| 385 EXPECT_TRUE(session_delegate.is_closed()); | 384 EXPECT_TRUE(session_delegate.is_closed()); |
| 386 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); | 385 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); |
| 387 | 386 |
| 388 // Verify that the socket was destroyed. | 387 // Verify that the socket was destroyed. |
| 389 EXPECT_FALSE(socket1_); | 388 EXPECT_FALSE(socket1_); |
| 390 } | 389 } |
| 391 | 390 |
| 392 } // namespace net | 391 } // namespace net |
| OLD | NEW |