Chromium Code Reviews| Index: net/http/http_proxy_client_socket_pool_unittest.cc |
| =================================================================== |
| --- net/http/http_proxy_client_socket_pool_unittest.cc (revision 117986) |
| +++ net/http/http_proxy_client_socket_pool_unittest.cc (working copy) |
| @@ -131,7 +131,9 @@ |
| session_->http_auth_cache(), |
| session_->http_auth_handler_factory(), |
| session_->spdy_session_pool(), |
| - tunnel)); |
| + tunnel, |
| + base::Bind(&HttpProxyClientSocketPoolTest::OnNeedsProxyAuthCallback, |
| + base::Unretained(this)))); |
| } |
| scoped_refptr<HttpProxySocketParams> GetTunnelParams() { |
| @@ -191,6 +193,14 @@ |
| return new HttpNetworkSession(params); |
| } |
| + void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, |
| + HttpAuthController* auth_controller, |
| + CompletionCallback cb) { |
| + // Don't add any auth, just run the callback |
|
vandebo (ex-Chrome)
2012/01/20 20:49:29
Do you expect this to ever be run? If not, a NOT_
Ryan Hamilton
2012/01/20 21:51:35
Yes, it is actually used in the NeedAuth test.
|
| + cb.Run(OK); |
| + } |
| + |
| + |
| private: |
| SSLConfig ssl_config_; |
| @@ -258,9 +268,21 @@ |
| CreateMockWrite(*req, 0, true), |
| CreateMockWrite(*rst, 2, true), |
| }; |
| + static const char* const kAuthChallenge[] = { |
| + "status", "407 Proxy Authentication Required", |
| + "version", "HTTP/1.1", |
| + "proxy-authenticate", "Basic realm=\"MyRealm1\"", |
| + }; |
| scoped_ptr<spdy::SpdyFrame> resp( |
| - ConstructSpdySynReplyError( |
| - "407 Proxy Authentication Required", NULL, 0, 1)); |
| + ConstructSpdyControlFrame(NULL, |
| + 0, |
| + false, |
| + 1, |
| + LOWEST, |
| + spdy::SYN_REPLY, |
| + spdy::CONTROL_FLAG_NONE, |
| + kAuthChallenge, |
| + arraysize(kAuthChallenge))); |
| MockRead spdy_reads[] = { |
| CreateMockWrite(*resp, 1, true), |
| MockRead(true, 0, 3) |
| @@ -277,21 +299,16 @@ |
| EXPECT_FALSE(handle_.is_initialized()); |
| EXPECT_FALSE(handle_.socket()); |
| - data_->RunFor(4); |
| + data_->RunFor(GetParam() == SPDY ? 2 : 4); |
| rv = callback_.WaitForResult(); |
| + EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv); |
| + EXPECT_TRUE(handle_.is_initialized()); |
| + ASSERT_TRUE(handle_.socket()); |
| if (GetParam() != SPDY) { |
| - EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv); |
| - EXPECT_TRUE(handle_.is_initialized()); |
| - ASSERT_TRUE(handle_.socket()); |
| HttpProxyClientSocket* tunnel_socket = |
| static_cast<HttpProxyClientSocket*>(handle_.socket()); |
| EXPECT_FALSE(tunnel_socket->IsConnected()); |
| EXPECT_FALSE(tunnel_socket->using_spdy()); |
| - } else { |
| - // Proxy auth is not really implemented for SPDY yet |
| - EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| - EXPECT_FALSE(handle_.is_initialized()); |
| - EXPECT_FALSE(handle_.socket()); |
| } |
| } |