| 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/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 13 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "net/quic/crypto/quic_random.h" | 16 #include "net/quic/crypto/quic_random.h" |
| 16 #include "net/quic/p2p/quic_p2p_crypto_config.h" | 17 #include "net/quic/p2p/quic_p2p_crypto_config.h" |
| 17 #include "net/quic/p2p/quic_p2p_stream.h" | 18 #include "net/quic/p2p/quic_p2p_stream.h" |
| 18 #include "net/quic/quic_connection_helper.h" | 19 #include "net/quic/quic_connection_helper.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (peer_socket_) { | 96 if (peer_socket_) { |
| 96 base::ThreadTaskRunnerHandle::Get()->PostTask( | 97 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 97 FROM_HERE, | 98 FROM_HERE, |
| 98 base::Bind(&FakeP2PDatagramSocket::AppendInputPacket, peer_socket_, | 99 base::Bind(&FakeP2PDatagramSocket::AppendInputPacket, peer_socket_, |
| 99 std::vector<char>(buf->data(), buf->data() + buf_len))); | 100 std::vector<char>(buf->data(), buf->data() + buf_len))); |
| 100 } | 101 } |
| 101 | 102 |
| 102 return buf_len; | 103 return buf_len; |
| 103 } | 104 } |
| 104 | 105 |
| 105 int SetReceiveBufferSize(int32 size) override { | 106 int SetReceiveBufferSize(int32_t size) override { |
| 106 NOTIMPLEMENTED(); | 107 NOTIMPLEMENTED(); |
| 107 return ERR_NOT_IMPLEMENTED; | 108 return ERR_NOT_IMPLEMENTED; |
| 108 } | 109 } |
| 109 int SetSendBufferSize(int32 size) override { | 110 int SetSendBufferSize(int32_t size) override { |
| 110 NOTIMPLEMENTED(); | 111 NOTIMPLEMENTED(); |
| 111 return ERR_NOT_IMPLEMENTED; | 112 return ERR_NOT_IMPLEMENTED; |
| 112 } | 113 } |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 int read_error_ = OK; | 116 int read_error_ = OK; |
| 116 int write_error_ = OK; | 117 int write_error_ = OK; |
| 117 | 118 |
| 118 scoped_refptr<IOBuffer> read_buffer_; | 119 scoped_refptr<IOBuffer> read_buffer_; |
| 119 int read_buffer_size_; | 120 int read_buffer_size_; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_TRUE(stream_delegate.is_closed()); | 386 EXPECT_TRUE(stream_delegate.is_closed()); |
| 386 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); | 387 EXPECT_EQ(QUIC_PACKET_READ_ERROR, stream_delegate.error()); |
| 387 EXPECT_TRUE(session_delegate.is_closed()); | 388 EXPECT_TRUE(session_delegate.is_closed()); |
| 388 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); | 389 EXPECT_EQ(QUIC_PACKET_READ_ERROR, session_delegate.error()); |
| 389 | 390 |
| 390 // Verify that the socket was destroyed. | 391 // Verify that the socket was destroyed. |
| 391 EXPECT_FALSE(socket1_); | 392 EXPECT_FALSE(socket1_); |
| 392 } | 393 } |
| 393 | 394 |
| 394 } // namespace net | 395 } // namespace net |
| OLD | NEW |