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 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 FakeSocket(); | 31 FakeSocket(); |
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 implementation. |
41 virtual int Read(net::IOBuffer* buf, int buf_len, | 41 virtual int Read(net::IOBuffer* buf, int buf_len, |
42 net::OldCompletionCallback* callback) OVERRIDE; | 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) OVERRIDE; | 44 net::OldCompletionCallback* callback) OVERRIDE; |
45 | 45 |
46 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 46 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
47 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 47 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
48 | 48 |
49 // net::StreamSocket interface. | 49 // net::StreamSocket implementation. |
50 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 50 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
| 51 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
51 virtual void Disconnect() OVERRIDE; | 52 virtual void Disconnect() OVERRIDE; |
52 virtual bool IsConnected() const OVERRIDE; | 53 virtual bool IsConnected() const OVERRIDE; |
53 virtual bool IsConnectedAndIdle() const OVERRIDE; | 54 virtual bool IsConnectedAndIdle() const OVERRIDE; |
54 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 55 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
55 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 56 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
56 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 57 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
57 virtual void SetSubresourceSpeculation() OVERRIDE; | 58 virtual void SetSubresourceSpeculation() OVERRIDE; |
58 virtual void SetOmniboxSpeculation() OVERRIDE; | 59 virtual void SetOmniboxSpeculation() OVERRIDE; |
59 virtual bool WasEverUsed() const OVERRIDE; | 60 virtual bool WasEverUsed() const OVERRIDE; |
60 virtual bool UsingTCPFastOpen() const OVERRIDE; | 61 virtual bool UsingTCPFastOpen() const OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... |
86 FakeUdpSocket(); | 87 FakeUdpSocket(); |
87 virtual ~FakeUdpSocket(); | 88 virtual ~FakeUdpSocket(); |
88 | 89 |
89 const std::vector<std::string>& written_packets() const { | 90 const std::vector<std::string>& written_packets() const { |
90 return written_packets_; | 91 return written_packets_; |
91 } | 92 } |
92 | 93 |
93 void AppendInputPacket(const char* data, int data_size); | 94 void AppendInputPacket(const char* data, int data_size); |
94 int input_pos() const { return input_pos_; } | 95 int input_pos() const { return input_pos_; } |
95 | 96 |
96 // net::Socket interface. | 97 // net::Socket implementation. |
97 virtual int Read(net::IOBuffer* buf, int buf_len, | 98 virtual int Read(net::IOBuffer* buf, int buf_len, |
98 net::OldCompletionCallback* callback) OVERRIDE; | 99 net::OldCompletionCallback* callback) OVERRIDE; |
99 virtual int Write(net::IOBuffer* buf, int buf_len, | 100 virtual int Write(net::IOBuffer* buf, int buf_len, |
100 net::OldCompletionCallback* callback) OVERRIDE; | 101 net::OldCompletionCallback* callback) OVERRIDE; |
101 | 102 |
102 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 103 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
103 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 104 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
104 | 105 |
105 private: | 106 private: |
106 bool read_pending_; | 107 bool read_pending_; |
(...skipping 23 matching lines...) Expand all Loading... |
130 message_loop_ = message_loop; | 131 message_loop_ = message_loop; |
131 } | 132 } |
132 | 133 |
133 void set_error(Session::Error error) { error_ = error; } | 134 void set_error(Session::Error error) { error_ = error; } |
134 | 135 |
135 bool is_closed() const { return closed_; } | 136 bool is_closed() const { return closed_; } |
136 | 137 |
137 FakeSocket* GetStreamChannel(const std::string& name); | 138 FakeSocket* GetStreamChannel(const std::string& name); |
138 FakeUdpSocket* GetDatagramChannel(const std::string& name); | 139 FakeUdpSocket* GetDatagramChannel(const std::string& name); |
139 | 140 |
140 // Session interface. | 141 // Session implementation. |
141 virtual void SetStateChangeCallback( | 142 virtual void SetStateChangeCallback( |
142 const StateChangeCallback& callback) OVERRIDE; | 143 const StateChangeCallback& callback) OVERRIDE; |
143 | 144 |
144 virtual Session::Error error() OVERRIDE; | 145 virtual Session::Error error() OVERRIDE; |
145 | 146 |
146 virtual void CreateStreamChannel( | 147 virtual void CreateStreamChannel( |
147 const std::string& name, const StreamChannelCallback& callback) OVERRIDE; | 148 const std::string& name, const StreamChannelCallback& callback) OVERRIDE; |
148 virtual void CreateDatagramChannel( | 149 virtual void CreateDatagramChannel( |
149 const std::string& name, | 150 const std::string& name, |
150 const DatagramChannelCallback& callback) OVERRIDE; | 151 const DatagramChannelCallback& callback) OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
172 Session::Error error_; | 173 Session::Error error_; |
173 bool closed_; | 174 bool closed_; |
174 | 175 |
175 DISALLOW_COPY_AND_ASSIGN(FakeSession); | 176 DISALLOW_COPY_AND_ASSIGN(FakeSession); |
176 }; | 177 }; |
177 | 178 |
178 } // namespace protocol | 179 } // namespace protocol |
179 } // namespace remoting | 180 } // namespace remoting |
180 | 181 |
181 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ | 182 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ |
OLD | NEW |