| Index: net/http/http_proxy_client_socket_pool_unittest.cc
|
| diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
|
| index f2464919e3a72e53a9a3c66a76db1490d50b98f5..94b459392b83c5d5b83be64474e599d0bce85fd8 100644
|
| --- a/net/http/http_proxy_client_socket_pool_unittest.cc
|
| +++ b/net/http/http_proxy_client_socket_pool_unittest.cc
|
| @@ -12,6 +12,7 @@
|
| #include "net/base/test_completion_callback.h"
|
| #include "net/http/http_network_session.h"
|
| #include "net/http/http_proxy_client_socket.h"
|
| +#include "net/http/http_proxy_tunnel_delegate.h"
|
| #include "net/http/http_response_headers.h"
|
| #include "net/socket/client_socket_handle.h"
|
| #include "net/socket/client_socket_pool_histograms.h"
|
| @@ -59,7 +60,8 @@ const char kHttpProxyHost[] = "httpproxy.example.com";
|
| const char kHttpsProxyHost[] = "httpsproxy.example.com";
|
|
|
| class HttpProxyClientSocketPoolTest
|
| - : public ::testing::TestWithParam<HttpProxyClientSocketPoolTestParams> {
|
| + : public ::testing::TestWithParam<HttpProxyClientSocketPoolTestParams>,
|
| + public net::HttpProxyTunnelDelegate {
|
| protected:
|
| HttpProxyClientSocketPoolTest()
|
| : session_deps_(GetParam().protocol),
|
| @@ -88,6 +90,8 @@ class HttpProxyClientSocketPoolTest
|
| BoundNetLog().net_log()),
|
| session_(CreateNetworkSession()),
|
| http_proxy_histograms_("HttpProxyUnitTest"),
|
| + on_before_proxy_tunnel_request_called_(false),
|
| + on_before_proxy_tunnel_headers_received_called_(false),
|
| spdy_util_(GetParam().protocol),
|
| pool_(kMaxSockets,
|
| kMaxSocketsPerGroup,
|
| @@ -95,6 +99,7 @@ class HttpProxyClientSocketPoolTest
|
| NULL,
|
| &transport_socket_pool_,
|
| &ssl_socket_pool_,
|
| + this,
|
| NULL) {}
|
|
|
| virtual ~HttpProxyClientSocketPoolTest() {
|
| @@ -154,7 +159,8 @@ class HttpProxyClientSocketPoolTest
|
| session_->http_auth_cache(),
|
| session_->http_auth_handler_factory(),
|
| session_->spdy_session_pool(),
|
| - tunnel));
|
| + tunnel,
|
| + this));
|
| }
|
|
|
| scoped_refptr<HttpProxySocketParams> CreateTunnelParams() {
|
| @@ -208,6 +214,27 @@ class HttpProxyClientSocketPoolTest
|
| return transport_socket_pool_.last_request_priority();
|
| }
|
|
|
| + virtual void OnBeforeRequest(
|
| + const net::HostPortPair& proxy_server,
|
| + net::HttpRequestHeaders* extra_headers) OVERRIDE {
|
| + on_before_proxy_tunnel_request_called_ = true;
|
| + }
|
| +
|
| + virtual void OnHeadersReceived(
|
| + const net::HostPortPair& origin,
|
| + const net::HostPortPair& proxy_server,
|
| + const net::HttpResponseHeaders& response_headers) OVERRIDE {
|
| + on_before_proxy_tunnel_headers_received_called_ = true;
|
| + }
|
| +
|
| + bool on_before_proxy_tunnel_request_called() {
|
| + return on_before_proxy_tunnel_request_called_;
|
| + }
|
| +
|
| + bool on_before_proxy_tunnel_headers_received_called() {
|
| + return on_before_proxy_tunnel_headers_received_called_;
|
| + }
|
| +
|
| private:
|
| SpdySessionDependencies session_deps_;
|
|
|
| @@ -220,6 +247,8 @@ class HttpProxyClientSocketPoolTest
|
|
|
| const scoped_refptr<HttpNetworkSession> session_;
|
| ClientSocketPoolHistograms http_proxy_histograms_;
|
| + bool on_before_proxy_tunnel_request_called_;
|
| + bool on_before_proxy_tunnel_headers_received_called_;
|
|
|
| protected:
|
| SpdyTestUtil spdy_util_;
|
| @@ -264,6 +293,8 @@ TEST_P(HttpProxyClientSocketPoolTest, NoTunnel) {
|
| HttpProxyClientSocket* tunnel_socket =
|
| static_cast<HttpProxyClientSocket*>(handle_.socket());
|
| EXPECT_TRUE(tunnel_socket->IsConnected());
|
| + EXPECT_FALSE(on_before_proxy_tunnel_request_called());
|
| + EXPECT_FALSE(on_before_proxy_tunnel_headers_received_called());
|
| }
|
|
|
| // Make sure that HttpProxyConnectJob passes on its priority to its
|
| @@ -363,6 +394,8 @@ TEST_P(HttpProxyClientSocketPoolTest, HaveAuth) {
|
| HttpProxyClientSocket* tunnel_socket =
|
| static_cast<HttpProxyClientSocket*>(handle_.socket());
|
| EXPECT_TRUE(tunnel_socket->IsConnected());
|
| + EXPECT_TRUE(on_before_proxy_tunnel_request_called());
|
| + EXPECT_TRUE(on_before_proxy_tunnel_headers_received_called());
|
| }
|
|
|
| TEST_P(HttpProxyClientSocketPoolTest, AsyncHaveAuth) {
|
|
|