diff options
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r-- | net/socket/socket_test_util.h | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index f710820..bd7c437 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -10,13 +10,10 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/scoped_ptr.h" #include "net/base/address_list.h" -#include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/ssl_config_service.h" #include "net/socket/client_socket_factory.h" -#include "net/socket/ssl_client_socket.h" namespace net { @@ -203,88 +200,6 @@ class MockClientSocketFactory : public ClientSocketFactory { MockSocketArray<MockSSLSocket> mock_ssl_sockets_; }; -class MockClientSocket : public net::SSLClientSocket { - public: - MockClientSocket(); - - // ClientSocket methods: - virtual int Connect(net::CompletionCallback* callback) = 0; - - // SSLClientSocket methods: - virtual void GetSSLInfo(net::SSLInfo* ssl_info); - virtual void GetSSLCertRequestInfo( - net::SSLCertRequestInfo* cert_request_info); - virtual void Disconnect(); - virtual bool IsConnected() const; - virtual bool IsConnectedAndIdle() const; - - // Socket methods: - virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) = 0; - virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) = 0; - -#if defined(OS_LINUX) - virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); -#endif - - protected: - void RunCallbackAsync(net::CompletionCallback* callback, int result); - void RunCallback(int result); - - ScopedRunnableMethodFactory<MockClientSocket> method_factory_; - net::CompletionCallback* callback_; - bool connected_; -}; - -class MockTCPClientSocket : public MockClientSocket { - public: - MockTCPClientSocket(const net::AddressList& addresses, - net::MockSocket* socket); - - // ClientSocket methods: - virtual int Connect(net::CompletionCallback* callback); - - // Socket methods: - virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); - virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); - - private: - net::MockSocket* data_; - int read_offset_; - net::MockRead read_data_; - bool need_read_data_; -}; - -class MockSSLClientSocket : public MockClientSocket { - public: - MockSSLClientSocket( - net::ClientSocket* transport_socket, - const std::string& hostname, - const net::SSLConfig& ssl_config, - net::MockSSLSocket* socket); - ~MockSSLClientSocket(); - - virtual void GetSSLInfo(net::SSLInfo* ssl_info); - - virtual int Connect(net::CompletionCallback* callback); - virtual void Disconnect(); - - // Socket methods: - virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); - virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); - - private: - class ConnectCallback; - - scoped_ptr<ClientSocket> transport_; - net::MockSSLSocket* data_; -}; - } // namespace net #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |