| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual int Read(net::IOBuffer* buf, int buf_len, | 59 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 60 const net::CompletionCallback& callback) OVERRIDE; | 60 const net::CompletionCallback& callback) OVERRIDE; |
| 61 virtual int Write(net::IOBuffer* buf, int buf_len, | 61 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 62 const net::CompletionCallback& callback) OVERRIDE; | 62 const net::CompletionCallback& 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(const net::CompletionCallback& callback) OVERRIDE; | 65 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
| 66 virtual void Disconnect() OVERRIDE; | 66 virtual void Disconnect() OVERRIDE; |
| 67 virtual bool IsConnected() const OVERRIDE; | 67 virtual bool IsConnected() const OVERRIDE; |
| 68 virtual bool IsConnectedAndIdle() const OVERRIDE; | 68 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 69 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 69 virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; |
| 70 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 70 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
| 71 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 71 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
| 72 virtual void SetSubresourceSpeculation() OVERRIDE; | 72 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 73 virtual void SetOmniboxSpeculation() OVERRIDE; | 73 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 74 virtual bool WasEverUsed() const OVERRIDE; | 74 virtual bool WasEverUsed() const OVERRIDE; |
| 75 virtual bool UsingTCPFastOpen() const OVERRIDE; | 75 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 76 virtual int64 NumBytesRead() const OVERRIDE; | 76 virtual int64 NumBytesRead() const OVERRIDE; |
| 77 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 77 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 78 virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; | 78 virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; |
| 79 | 79 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool FakeSocket::IsConnected() const { | 175 bool FakeSocket::IsConnected() const { |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool FakeSocket::IsConnectedAndIdle() const { | 179 bool FakeSocket::IsConnectedAndIdle() const { |
| 180 return false; | 180 return false; |
| 181 } | 181 } |
| 182 | 182 |
| 183 int FakeSocket::GetPeerAddress(net::AddressList* address) const { | 183 int FakeSocket::GetPeerAddress(net::IPEndPoint* address) const { |
| 184 *address = net::AddressList::CreateFromIPAddress(peer_address_.address(), | 184 *address = peer_address_; |
| 185 peer_address_.port()); | |
| 186 return net::OK; | 185 return net::OK; |
| 187 } | 186 } |
| 188 | 187 |
| 189 int FakeSocket::GetLocalAddress(net::IPEndPoint* address) const { | 188 int FakeSocket::GetLocalAddress(net::IPEndPoint* address) const { |
| 190 *address = local_address_; | 189 *address = local_address_; |
| 191 return net::OK; | 190 return net::OK; |
| 192 } | 191 } |
| 193 | 192 |
| 194 const net::BoundNetLog& FakeSocket::NetLog() const { | 193 const net::BoundNetLog& FakeSocket::NetLog() const { |
| 195 NOTREACHED(); | 194 NOTREACHED(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 return false; | 278 return false; |
| 280 P2PMsg_OnIncomingTcpConnection::Param params; | 279 P2PMsg_OnIncomingTcpConnection::Param params; |
| 281 P2PMsg_OnIncomingTcpConnection::Read( | 280 P2PMsg_OnIncomingTcpConnection::Read( |
| 282 arg, ¶ms); | 281 arg, ¶ms); |
| 283 return params.b == address; | 282 return params.b == address; |
| 284 } | 283 } |
| 285 | 284 |
| 286 } // namespace | 285 } // namespace |
| 287 | 286 |
| 288 #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 |