diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-25 16:00:05 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-25 16:00:05 +0000 |
commit | 8dbf33e8cf8658a02aebdde2202cd882c488211d (patch) | |
tree | 61090c9ba6eecee4b05a60568950d37f4ea4ffed /net/socket/socket_test_util.h | |
parent | 381ea555123f1cdb465ea8d542fa2145121ac3e1 (diff) | |
download | chromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.zip chromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.tar.gz chromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.tar.bz2 |
Add support for speaking SSL to an HTTP Proxy, to
HttpProxyClientSocketPool (and friends)
More information about an HTTPS Proxy can be found here:
http://dev.chromium.org/spdy/spdy-proxy
This implementation supports both http:// and https:// requests,
as well as support for both Proxy and Server auth.
BUG=29625
TEST=none
Review URL: http://codereview.chromium.org/3110006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57333 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r-- | net/socket/socket_test_util.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 533a18d..e62e12b 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -30,6 +30,7 @@ #include "net/socket/client_socket_handle.h" #include "net/socket/socks_client_socket_pool.h" #include "net/socket/ssl_client_socket.h" +#include "net/socket/ssl_client_socket_pool.h" #include "net/socket/tcp_client_socket_pool.h" #include "testing/gtest/include/gtest/gtest.h" @@ -867,6 +868,62 @@ extern const int kSOCKS5OkRequestLength; extern const char kSOCKS5OkResponse[]; extern const int kSOCKS5OkResponseLength; +class MockSSLClientSocketPool : public SSLClientSocketPool { + public: + class MockConnectJob { + public: + MockConnectJob(ClientSocket* socket, ClientSocketHandle* handle, + CompletionCallback* callback); + + int Connect(); + bool CancelHandle(const ClientSocketHandle* handle); + + private: + void OnConnect(int rv); + + scoped_ptr<ClientSocket> socket_; + ClientSocketHandle* handle_; + CompletionCallback* user_callback_; + CompletionCallbackImpl<MockConnectJob> connect_callback_; + + DISALLOW_COPY_AND_ASSIGN(MockConnectJob); + }; + + MockSSLClientSocketPool( + int max_sockets, + int max_sockets_per_group, + const scoped_refptr<ClientSocketPoolHistograms>& histograms, + ClientSocketFactory* socket_factory); + + int release_count() const { return release_count_; } + int cancel_count() const { return cancel_count_; } + + // SSLClientSocketPool methods. + virtual int RequestSocket(const std::string& group_name, + const void* socket_params, + RequestPriority priority, + ClientSocketHandle* handle, + CompletionCallback* callback, + const BoundNetLog& net_log); + + virtual void CancelRequest(const std::string& group_name, + ClientSocketHandle* handle); + virtual void ReleaseSocket(const std::string& group_name, + ClientSocket* socket, int id); + + protected: + virtual ~MockSSLClientSocketPool(); + + private: + ClientSocketFactory* client_socket_factory_; + int release_count_; + int cancel_count_; + ScopedVector<MockConnectJob> job_list_; + + DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocketPool); +}; + + } // namespace net #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |