| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "net/quic/crypto/quic_random.h" | 18 #include "net/quic/crypto/quic_random.h" |
| 19 #include "net/quic/p2p/quic_p2p_crypto_config.h" | 19 #include "net/quic/p2p/quic_p2p_crypto_config.h" |
| 20 #include "net/quic/p2p/quic_p2p_stream.h" | 20 #include "net/quic/p2p/quic_p2p_stream.h" |
| 21 #include "net/quic/quic_connection_helper.h" | 21 #include "net/quic/quic_chromium_connection_helper.h" |
| 22 #include "net/quic/quic_default_packet_writer.h" | 22 #include "net/quic/quic_default_packet_writer.h" |
| 23 #include "net/socket/socket.h" | 23 #include "net/socket/socket.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const char kTestSharedKey[] = "Shared key exchanged out of bound."; | 30 const char kTestSharedKey[] = "Shared key exchanged out of bound."; |
| 31 | 31 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 std::move(socket))); | 238 std::move(socket))); |
| 239 result->Initialize(); | 239 result->Initialize(); |
| 240 return result; | 240 return result; |
| 241 } | 241 } |
| 242 | 242 |
| 243 void TestStreamConnection(QuicP2PSession* from_session, | 243 void TestStreamConnection(QuicP2PSession* from_session, |
| 244 QuicP2PSession* to_session, | 244 QuicP2PSession* to_session, |
| 245 QuicStreamId expected_stream_id); | 245 QuicStreamId expected_stream_id); |
| 246 | 246 |
| 247 QuicClock quic_clock_; | 247 QuicClock quic_clock_; |
| 248 QuicConnectionHelper quic_helper_; | 248 QuicChromiumConnectionHelper quic_helper_; |
| 249 QuicConfig config_; | 249 QuicConfig config_; |
| 250 | 250 |
| 251 base::WeakPtr<FakeP2PDatagramSocket> socket1_; | 251 base::WeakPtr<FakeP2PDatagramSocket> socket1_; |
| 252 scoped_ptr<QuicP2PSession> session1_; | 252 scoped_ptr<QuicP2PSession> session1_; |
| 253 | 253 |
| 254 base::WeakPtr<FakeP2PDatagramSocket> socket2_; | 254 base::WeakPtr<FakeP2PDatagramSocket> socket2_; |
| 255 scoped_ptr<QuicP2PSession> session2_; | 255 scoped_ptr<QuicP2PSession> session2_; |
| 256 }; | 256 }; |
| 257 | 257 |
| 258 void QuicP2PSessionTest::OnWriteResult(int result) { | 258 void QuicP2PSessionTest::OnWriteResult(int result) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 EXPECT_TRUE(stream_delegate.is_closed()); | 375 EXPECT_TRUE(stream_delegate.is_closed()); |
| 376 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); | 376 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); |
| 377 EXPECT_TRUE(session_delegate.is_closed()); | 377 EXPECT_TRUE(session_delegate.is_closed()); |
| 378 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); | 378 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); |
| 379 | 379 |
| 380 // Verify that the socket was destroyed. | 380 // Verify that the socket was destroyed. |
| 381 EXPECT_FALSE(socket1_); | 381 EXPECT_FALSE(socket1_); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace net | 384 } // namespace net |
| OLD | NEW |