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 "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 void set_async_write(bool async_write) { async_write_ = async_write; } | 36 void set_async_write(bool async_write) { async_write_ = async_write; } |
37 void AppendInputData(const char* data, int data_size); | 37 void AppendInputData(const char* data, int data_size); |
38 int input_pos() const { return input_pos_; } | 38 int input_pos() const { return input_pos_; } |
39 bool read_pending() const { return read_pending_; } | 39 bool read_pending() const { return read_pending_; } |
40 void SetPeerAddress(const net::IPEndPoint& peer_address); | 40 void SetPeerAddress(const net::IPEndPoint& peer_address); |
41 void SetLocalAddress(const net::IPEndPoint& local_address); | 41 void SetLocalAddress(const net::IPEndPoint& local_address); |
42 | 42 |
43 // net::Socket implementation. | 43 // net::Socket implementation. |
44 virtual int Read(net::IOBuffer* buf, int buf_len, | 44 virtual int Read(net::IOBuffer* buf, int buf_len, |
45 const net::CompletionCallback& callback) OVERRIDE; | 45 const net::CompletionCallback& callback) override; |
46 virtual int Write(net::IOBuffer* buf, int buf_len, | 46 virtual int Write(net::IOBuffer* buf, int buf_len, |
47 const net::CompletionCallback& callback) OVERRIDE; | 47 const net::CompletionCallback& callback) override; |
48 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; | 48 virtual int SetReceiveBufferSize(int32 size) override; |
49 virtual int SetSendBufferSize(int32 size) OVERRIDE; | 49 virtual int SetSendBufferSize(int32 size) override; |
50 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 50 virtual int Connect(const net::CompletionCallback& callback) override; |
51 virtual void Disconnect() OVERRIDE; | 51 virtual void Disconnect() override; |
52 virtual bool IsConnected() const OVERRIDE; | 52 virtual bool IsConnected() const override; |
53 virtual bool IsConnectedAndIdle() const OVERRIDE; | 53 virtual bool IsConnectedAndIdle() const override; |
54 virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; | 54 virtual int GetPeerAddress(net::IPEndPoint* address) const override; |
55 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 55 virtual int GetLocalAddress(net::IPEndPoint* address) const override; |
56 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 56 virtual const net::BoundNetLog& NetLog() const override; |
57 virtual void SetSubresourceSpeculation() OVERRIDE; | 57 virtual void SetSubresourceSpeculation() override; |
58 virtual void SetOmniboxSpeculation() OVERRIDE; | 58 virtual void SetOmniboxSpeculation() override; |
59 virtual bool WasEverUsed() const OVERRIDE; | 59 virtual bool WasEverUsed() const override; |
60 virtual bool UsingTCPFastOpen() const OVERRIDE; | 60 virtual bool UsingTCPFastOpen() const override; |
61 virtual bool WasNpnNegotiated() const OVERRIDE; | 61 virtual bool WasNpnNegotiated() const override; |
62 virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; | 62 virtual net::NextProto GetNegotiatedProtocol() const override; |
63 virtual bool GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; | 63 virtual bool GetSSLInfo(net::SSLInfo* ssl_info) override; |
64 | 64 |
65 private: | 65 private: |
66 void DoAsyncWrite(scoped_refptr<net::IOBuffer> buf, int buf_len, | 66 void DoAsyncWrite(scoped_refptr<net::IOBuffer> buf, int buf_len, |
67 const net::CompletionCallback& callback); | 67 const net::CompletionCallback& callback); |
68 | 68 |
69 bool read_pending_; | 69 bool read_pending_; |
70 scoped_refptr<net::IOBuffer> read_buffer_; | 70 scoped_refptr<net::IOBuffer> read_buffer_; |
71 int read_buffer_size_; | 71 int read_buffer_size_; |
72 net::CompletionCallback read_callback_; | 72 net::CompletionCallback read_callback_; |
73 | 73 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 MATCHER_P(MatchIncomingSocketMessage, address, "") { | 106 MATCHER_P(MatchIncomingSocketMessage, address, "") { |
107 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) | 107 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) |
108 return false; | 108 return false; |
109 P2PMsg_OnIncomingTcpConnection::Param params; | 109 P2PMsg_OnIncomingTcpConnection::Param params; |
110 P2PMsg_OnIncomingTcpConnection::Read( | 110 P2PMsg_OnIncomingTcpConnection::Read( |
111 arg, ¶ms); | 111 arg, ¶ms); |
112 return params.b == address; | 112 return params.b == address; |
113 } | 113 } |
114 | 114 |
115 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ | 115 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ |
OLD | NEW |