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 REMOTING_PROTOCOL_FAKE_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_ |
6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ | 6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual ~FakeSocket(); | 32 virtual ~FakeSocket(); |
33 | 33 |
34 const std::string& written_data() const { return written_data_; } | 34 const std::string& written_data() const { return written_data_; } |
35 | 35 |
36 void AppendInputData(const char* data, int data_size); | 36 void AppendInputData(const char* data, int data_size); |
37 int input_pos() const { return input_pos_; } | 37 int input_pos() const { return input_pos_; } |
38 bool read_pending() const { return read_pending_; } | 38 bool read_pending() const { return read_pending_; } |
39 | 39 |
40 // net::Socket interface. | 40 // net::Socket interface. |
41 virtual int Read(net::IOBuffer* buf, int buf_len, | 41 virtual int Read(net::IOBuffer* buf, int buf_len, |
42 net::OldCompletionCallback* callback); | 42 net::OldCompletionCallback* callback) OVERRIDE; |
43 virtual int Write(net::IOBuffer* buf, int buf_len, | 43 virtual int Write(net::IOBuffer* buf, int buf_len, |
44 net::OldCompletionCallback* callback); | 44 net::OldCompletionCallback* callback) OVERRIDE; |
45 | 45 |
46 virtual bool SetReceiveBufferSize(int32 size); | 46 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
47 virtual bool SetSendBufferSize(int32 size); | 47 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
48 | 48 |
49 // net::StreamSocket interface. | 49 // net::StreamSocket interface. |
50 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 50 virtual int Connect(net::OldCompletionCallback* 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::AddressList* address) const OVERRIDE; | 54 virtual int GetPeerAddress(net::AddressList* 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; |
(...skipping 30 matching lines...) Expand all Loading... |
88 | 88 |
89 const std::vector<std::string>& written_packets() const { | 89 const std::vector<std::string>& written_packets() const { |
90 return written_packets_; | 90 return written_packets_; |
91 } | 91 } |
92 | 92 |
93 void AppendInputPacket(const char* data, int data_size); | 93 void AppendInputPacket(const char* data, int data_size); |
94 int input_pos() const { return input_pos_; } | 94 int input_pos() const { return input_pos_; } |
95 | 95 |
96 // net::Socket interface. | 96 // net::Socket interface. |
97 virtual int Read(net::IOBuffer* buf, int buf_len, | 97 virtual int Read(net::IOBuffer* buf, int buf_len, |
98 net::OldCompletionCallback* callback); | 98 net::OldCompletionCallback* callback) OVERRIDE; |
99 virtual int Write(net::IOBuffer* buf, int buf_len, | 99 virtual int Write(net::IOBuffer* buf, int buf_len, |
100 net::OldCompletionCallback* callback); | 100 net::OldCompletionCallback* callback) OVERRIDE; |
101 | 101 |
102 virtual bool SetReceiveBufferSize(int32 size); | 102 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
103 virtual bool SetSendBufferSize(int32 size); | 103 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
104 | 104 |
105 private: | 105 private: |
106 bool read_pending_; | 106 bool read_pending_; |
107 scoped_refptr<net::IOBuffer> read_buffer_; | 107 scoped_refptr<net::IOBuffer> read_buffer_; |
108 int read_buffer_size_; | 108 int read_buffer_size_; |
109 net::OldCompletionCallback* read_callback_; | 109 net::OldCompletionCallback* read_callback_; |
110 | 110 |
111 std::vector<std::string> written_packets_; | 111 std::vector<std::string> written_packets_; |
112 std::vector<std::string> input_packets_; | 112 std::vector<std::string> input_packets_; |
113 int input_pos_; | 113 int input_pos_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 Session::Error error_; | 190 Session::Error error_; |
191 bool closed_; | 191 bool closed_; |
192 | 192 |
193 DISALLOW_COPY_AND_ASSIGN(FakeSession); | 193 DISALLOW_COPY_AND_ASSIGN(FakeSession); |
194 }; | 194 }; |
195 | 195 |
196 } // namespace protocol | 196 } // namespace protocol |
197 } // namespace remoting | 197 } // namespace remoting |
198 | 198 |
199 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ | 199 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ |
OLD | NEW |