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 28 matching lines...) Expand all Loading... |
39 virtual ~MockIPCSender(); | 39 virtual ~MockIPCSender(); |
40 | 40 |
41 MOCK_METHOD1(Send, bool(IPC::Message* msg)); | 41 MOCK_METHOD1(Send, bool(IPC::Message* msg)); |
42 }; | 42 }; |
43 | 43 |
44 MockIPCSender::MockIPCSender() { } | 44 MockIPCSender::MockIPCSender() { } |
45 MockIPCSender::~MockIPCSender() { } | 45 MockIPCSender::~MockIPCSender() { } |
46 | 46 |
47 class FakeSocket : public net::StreamSocket { | 47 class FakeSocket : public net::StreamSocket { |
48 public: | 48 public: |
49 FakeSocket(std::string* written_data); | 49 explicit FakeSocket(std::string* written_data); |
50 virtual ~FakeSocket(); | 50 virtual ~FakeSocket(); |
51 | 51 |
52 void AppendInputData(const char* data, int data_size); | 52 void AppendInputData(const char* data, int data_size); |
53 int input_pos() const { return input_pos_; } | 53 int input_pos() const { return input_pos_; } |
54 bool read_pending() const { return read_pending_; } | 54 bool read_pending() const { return read_pending_; } |
55 void SetPeerAddress(const net::IPEndPoint& peer_address); | 55 void SetPeerAddress(const net::IPEndPoint& peer_address); |
56 void SetLocalAddress(const net::IPEndPoint& local_address); | 56 void SetLocalAddress(const net::IPEndPoint& local_address); |
57 | 57 |
58 // net::Socket implementation. | 58 // net::Socket implementation. |
59 virtual int Read(net::IOBuffer* buf, int buf_len, | 59 virtual int Read(net::IOBuffer* buf, int buf_len, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 return false; | 288 return false; |
289 P2PMsg_OnIncomingTcpConnection::Param params; | 289 P2PMsg_OnIncomingTcpConnection::Param params; |
290 P2PMsg_OnIncomingTcpConnection::Read( | 290 P2PMsg_OnIncomingTcpConnection::Read( |
291 arg, ¶ms); | 291 arg, ¶ms); |
292 return params.b == address; | 292 return params.b == address; |
293 } | 293 } |
294 | 294 |
295 } // namespace | 295 } // namespace |
296 | 296 |
297 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 297 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |