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 22 matching lines...) Expand all Loading... |
33 virtual ~FakeSocket(); | 33 virtual ~FakeSocket(); |
34 | 34 |
35 const std::string& written_data() const { return written_data_; } | 35 const std::string& written_data() const { return written_data_; } |
36 | 36 |
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 | 40 |
41 // net::Socket implementation. | 41 // net::Socket implementation. |
42 virtual int Read(net::IOBuffer* buf, int buf_len, | 42 virtual int Read(net::IOBuffer* buf, int buf_len, |
43 net::OldCompletionCallback* callback) OVERRIDE; | |
44 virtual int Read(net::IOBuffer* buf, int buf_len, | |
45 const net::CompletionCallback& callback) OVERRIDE; | 43 const net::CompletionCallback& callback) OVERRIDE; |
46 virtual int Write(net::IOBuffer* buf, int buf_len, | 44 virtual int Write(net::IOBuffer* buf, int buf_len, |
47 net::OldCompletionCallback* callback) OVERRIDE; | 45 const net::CompletionCallback& callback) OVERRIDE; |
48 | 46 |
49 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 47 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
50 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 48 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
51 | 49 |
52 // net::StreamSocket implementation. | 50 // net::StreamSocket implementation. |
53 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | |
54 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 51 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
55 virtual void Disconnect() OVERRIDE; | 52 virtual void Disconnect() OVERRIDE; |
56 virtual bool IsConnected() const OVERRIDE; | 53 virtual bool IsConnected() const OVERRIDE; |
57 virtual bool IsConnectedAndIdle() const OVERRIDE; | 54 virtual bool IsConnectedAndIdle() const OVERRIDE; |
58 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 55 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
59 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 56 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
60 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 57 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
61 virtual void SetSubresourceSpeculation() OVERRIDE; | 58 virtual void SetSubresourceSpeculation() OVERRIDE; |
62 virtual void SetOmniboxSpeculation() OVERRIDE; | 59 virtual void SetOmniboxSpeculation() OVERRIDE; |
63 virtual bool WasEverUsed() const OVERRIDE; | 60 virtual bool WasEverUsed() const OVERRIDE; |
64 virtual bool UsingTCPFastOpen() const OVERRIDE; | 61 virtual bool UsingTCPFastOpen() const OVERRIDE; |
65 virtual int64 NumBytesRead() const OVERRIDE; | 62 virtual int64 NumBytesRead() const OVERRIDE; |
66 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 63 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
67 | 64 |
68 private: | 65 private: |
69 bool read_pending_; | 66 bool read_pending_; |
70 scoped_refptr<net::IOBuffer> read_buffer_; | 67 scoped_refptr<net::IOBuffer> read_buffer_; |
71 int read_buffer_size_; | 68 int read_buffer_size_; |
72 net::OldCompletionCallback* old_read_callback_; | |
73 net::CompletionCallback read_callback_; | 69 net::CompletionCallback read_callback_; |
74 | 70 |
75 std::string written_data_; | 71 std::string written_data_; |
76 std::string input_data_; | 72 std::string input_data_; |
77 int input_pos_; | 73 int input_pos_; |
78 | 74 |
79 net::BoundNetLog net_log_; | 75 net::BoundNetLog net_log_; |
80 | 76 |
81 MessageLoop* message_loop_; | 77 MessageLoop* message_loop_; |
82 | 78 |
(...skipping 10 matching lines...) Expand all Loading... |
93 | 89 |
94 const std::vector<std::string>& written_packets() const { | 90 const std::vector<std::string>& written_packets() const { |
95 return written_packets_; | 91 return written_packets_; |
96 } | 92 } |
97 | 93 |
98 void AppendInputPacket(const char* data, int data_size); | 94 void AppendInputPacket(const char* data, int data_size); |
99 int input_pos() const { return input_pos_; } | 95 int input_pos() const { return input_pos_; } |
100 | 96 |
101 // net::Socket implementation. | 97 // net::Socket implementation. |
102 virtual int Read(net::IOBuffer* buf, int buf_len, | 98 virtual int Read(net::IOBuffer* buf, int buf_len, |
103 net::OldCompletionCallback* callback) OVERRIDE; | |
104 virtual int Read(net::IOBuffer* buf, int buf_len, | |
105 const net::CompletionCallback& callback) OVERRIDE; | 99 const net::CompletionCallback& callback) OVERRIDE; |
106 virtual int Write(net::IOBuffer* buf, int buf_len, | 100 virtual int Write(net::IOBuffer* buf, int buf_len, |
107 net::OldCompletionCallback* callback) OVERRIDE; | 101 const net::CompletionCallback& callback) OVERRIDE; |
108 | 102 |
109 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 103 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
110 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 104 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
111 | 105 |
112 private: | 106 private: |
113 bool read_pending_; | 107 bool read_pending_; |
114 scoped_refptr<net::IOBuffer> read_buffer_; | 108 scoped_refptr<net::IOBuffer> read_buffer_; |
115 int read_buffer_size_; | 109 int read_buffer_size_; |
116 net::OldCompletionCallback* old_read_callback_; | |
117 net::CompletionCallback read_callback_; | 110 net::CompletionCallback read_callback_; |
118 | 111 |
119 std::vector<std::string> written_packets_; | 112 std::vector<std::string> written_packets_; |
120 std::vector<std::string> input_packets_; | 113 std::vector<std::string> input_packets_; |
121 int input_pos_; | 114 int input_pos_; |
122 | 115 |
123 MessageLoop* message_loop_; | 116 MessageLoop* message_loop_; |
124 | 117 |
125 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket); | 118 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket); |
126 }; | 119 }; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Session::Error error_; | 173 Session::Error error_; |
181 bool closed_; | 174 bool closed_; |
182 | 175 |
183 DISALLOW_COPY_AND_ASSIGN(FakeSession); | 176 DISALLOW_COPY_AND_ASSIGN(FakeSession); |
184 }; | 177 }; |
185 | 178 |
186 } // namespace protocol | 179 } // namespace protocol |
187 } // namespace remoting | 180 } // namespace remoting |
188 | 181 |
189 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ | 182 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ |
OLD | NEW |