| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 NET_SOCKET_SOCKET_TEST_UTIL_H_ | 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ | 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 net::SSLCertRequestInfo* cert_request_info); | 240 net::SSLCertRequestInfo* cert_request_info); |
| 241 virtual void Disconnect(); | 241 virtual void Disconnect(); |
| 242 virtual bool IsConnected() const; | 242 virtual bool IsConnected() const; |
| 243 virtual bool IsConnectedAndIdle() const; | 243 virtual bool IsConnectedAndIdle() const; |
| 244 | 244 |
| 245 // Socket methods: | 245 // Socket methods: |
| 246 virtual int Read(net::IOBuffer* buf, int buf_len, | 246 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 247 net::CompletionCallback* callback) = 0; | 247 net::CompletionCallback* callback) = 0; |
| 248 virtual int Write(net::IOBuffer* buf, int buf_len, | 248 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 249 net::CompletionCallback* callback) = 0; | 249 net::CompletionCallback* callback) = 0; |
| 250 virtual bool SetReceiveBufferSize(int32 size) { return true; }; |
| 251 virtual bool SetSendBufferSize(int32 size) { return true; }; |
| 250 | 252 |
| 251 #if defined(OS_LINUX) | 253 #if defined(OS_LINUX) |
| 252 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); | 254 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); |
| 253 #endif | 255 #endif |
| 254 | 256 |
| 255 protected: | 257 protected: |
| 256 void RunCallbackAsync(net::CompletionCallback* callback, int result); | 258 void RunCallbackAsync(net::CompletionCallback* callback, int result); |
| 257 void RunCallback(int result); | 259 void RunCallback(int result); |
| 258 | 260 |
| 259 ScopedRunnableMethodFactory<MockClientSocket> method_factory_; | 261 ScopedRunnableMethodFactory<MockClientSocket> method_factory_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 void ReleaseAllConnections(KeepAlive keep_alive); | 384 void ReleaseAllConnections(KeepAlive keep_alive); |
| 383 | 385 |
| 384 ScopedVector<TestSocketRequest> requests_; | 386 ScopedVector<TestSocketRequest> requests_; |
| 385 std::vector<TestSocketRequest*> request_order_; | 387 std::vector<TestSocketRequest*> request_order_; |
| 386 size_t completion_count_; | 388 size_t completion_count_; |
| 387 }; | 389 }; |
| 388 | 390 |
| 389 } // namespace net | 391 } // namespace net |
| 390 | 392 |
| 391 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 393 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |