| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void SetLocalAddress(const net::IPEndPoint& local_address); | 56 void SetLocalAddress(const net::IPEndPoint& local_address); |
| 57 | 57 |
| 58 // net::Socket interface. | 58 // net::Socket interface. |
| 59 virtual int Read(net::IOBuffer* buf, int buf_len, | 59 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 60 net::OldCompletionCallback* callback) OVERRIDE; | 60 net::OldCompletionCallback* callback) OVERRIDE; |
| 61 virtual int Write(net::IOBuffer* buf, int buf_len, | 61 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 62 net::OldCompletionCallback* callback) OVERRIDE; | 62 net::OldCompletionCallback* callback) OVERRIDE; |
| 63 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 63 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 64 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 64 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 65 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 65 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
| 66 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
| 66 virtual void Disconnect() OVERRIDE; | 67 virtual void Disconnect() OVERRIDE; |
| 67 virtual bool IsConnected() const OVERRIDE; | 68 virtual bool IsConnected() const OVERRIDE; |
| 68 virtual bool IsConnectedAndIdle() const OVERRIDE; | 69 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 69 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 70 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
| 70 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 71 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
| 71 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 72 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
| 72 virtual void SetSubresourceSpeculation() OVERRIDE; | 73 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 73 virtual void SetOmniboxSpeculation() OVERRIDE; | 74 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 74 virtual bool WasEverUsed() const OVERRIDE; | 75 virtual bool WasEverUsed() const OVERRIDE; |
| 75 virtual bool UsingTCPFastOpen() const OVERRIDE; | 76 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 161 } |
| 161 bool FakeSocket::SetSendBufferSize(int32 size) { | 162 bool FakeSocket::SetSendBufferSize(int32 size) { |
| 162 NOTIMPLEMENTED(); | 163 NOTIMPLEMENTED(); |
| 163 return false; | 164 return false; |
| 164 } | 165 } |
| 165 | 166 |
| 166 int FakeSocket::Connect(net::OldCompletionCallback* callback) { | 167 int FakeSocket::Connect(net::OldCompletionCallback* callback) { |
| 167 return 0; | 168 return 0; |
| 168 } | 169 } |
| 169 | 170 |
| 171 int FakeSocket::Connect(const net::CompletionCallback& callback) { |
| 172 return 0; |
| 173 } |
| 174 |
| 170 void FakeSocket::Disconnect() { | 175 void FakeSocket::Disconnect() { |
| 171 NOTREACHED(); | 176 NOTREACHED(); |
| 172 } | 177 } |
| 173 | 178 |
| 174 bool FakeSocket::IsConnected() const { | 179 bool FakeSocket::IsConnected() const { |
| 175 return true; | 180 return true; |
| 176 } | 181 } |
| 177 | 182 |
| 178 bool FakeSocket::IsConnectedAndIdle() const { | 183 bool FakeSocket::IsConnectedAndIdle() const { |
| 179 return false; | 184 return false; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 return false; | 278 return false; |
| 274 P2PMsg_OnIncomingTcpConnection::Param params; | 279 P2PMsg_OnIncomingTcpConnection::Param params; |
| 275 P2PMsg_OnIncomingTcpConnection::Read( | 280 P2PMsg_OnIncomingTcpConnection::Read( |
| 276 arg, ¶ms); | 281 arg, ¶ms); |
| 277 return params.b == address; | 282 return params.b == address; |
| 278 } | 283 } |
| 279 | 284 |
| 280 } // namespace | 285 } // namespace |
| 281 | 286 |
| 282 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 287 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
| OLD | NEW |