Index: net/http/http_auth_controller_unittest.cc |
diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc |
index cd97d293a1fe632d975d7c99d23607e70de27f69..3f7fe90a9838154b8168c5196eb913904981c48f 100644 |
--- a/net/http/http_auth_controller_unittest.cc |
+++ b/net/http/http_auth_controller_unittest.cc |
@@ -12,6 +12,7 @@ |
#include "net/http/http_auth_handler_mock.h" |
#include "net/http/http_request_info.h" |
#include "net/http/http_response_headers.h" |
+#include "net/http/http_response_info.h" |
#include "net/http/http_util.h" |
#include "net/log/net_log.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -56,10 +57,11 @@ void RunSingleRoundAuthTest(HandlerRunMode run_mode, |
request.method = "GET"; |
request.url = GURL("http://example.com"); |
- scoped_refptr<HttpResponseHeaders> headers(HeadersFromString( |
+ HttpResponseInfo response_info; |
+ response_info.headers = HeadersFromString( |
"HTTP/1.1 407\r\n" |
"Proxy-Authenticate: MOCK foo\r\n" |
- "\r\n")); |
+ "\r\n"); |
HttpAuthHandlerMock::Factory auth_handler_factory; |
HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
@@ -72,8 +74,8 @@ void RunSingleRoundAuthTest(HandlerRunMode run_mode, |
new HttpAuthController(HttpAuth::AUTH_PROXY, |
GURL("http://example.com"), |
&dummy_auth_cache, &auth_handler_factory)); |
- ASSERT_EQ(OK, |
- controller->HandleAuthChallenge(headers, false, false, dummy_log)); |
+ ASSERT_EQ(OK, controller->HandleAuthChallenge(response_info, false, false, |
+ dummy_log)); |
ASSERT_TRUE(controller->HaveAuthHandler()); |
controller->ResetAuth(AuthCredentials()); |
EXPECT_TRUE(controller->HaveAuth()); |
@@ -128,8 +130,9 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { |
} |
protected: |
- bool Init(HttpAuthChallengeTokenizer* challenge) override { |
- HttpAuthHandlerMock::Init(challenge); |
+ bool Init(HttpAuthChallengeTokenizer* challenge, |
+ const HttpResponseInfo& response_info) override { |
+ HttpAuthHandlerMock::Init(challenge, response_info); |
set_allows_default_credentials(true); |
set_allows_explicit_credentials(false); |
set_connection_based(true); |
@@ -167,12 +170,12 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { |
request.method = "GET"; |
request.url = GURL("http://example.com"); |
- HttpRequestHeaders request_headers; |
- scoped_refptr<HttpResponseHeaders> headers(HeadersFromString( |
+ HttpResponseInfo response_info; |
+ response_info.headers = HeadersFromString( |
"HTTP/1.1 401\r\n" |
"WWW-Authenticate: Mock\r\n" |
"WWW-Authenticate: Basic\r\n" |
- "\r\n")); |
+ "\r\n"); |
HttpAuthHandlerMock::Factory auth_handler_factory; |
@@ -209,8 +212,8 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { |
new HttpAuthController(HttpAuth::AUTH_SERVER, |
GURL("http://example.com"), |
&dummy_auth_cache, &auth_handler_factory)); |
- ASSERT_EQ(OK, |
- controller->HandleAuthChallenge(headers, false, false, dummy_log)); |
+ ASSERT_EQ(OK, controller->HandleAuthChallenge(response_info, false, false, |
+ dummy_log)); |
ASSERT_TRUE(controller->HaveAuthHandler()); |
controller->ResetAuth(AuthCredentials()); |
EXPECT_TRUE(controller->HaveAuth()); |
@@ -218,12 +221,13 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { |
// Should only succeed if we are using the AUTH_SCHEME_MOCK MockHandler. |
EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( |
&request, CompletionCallback(), dummy_log)); |
+ HttpRequestHeaders request_headers; |
controller->AddAuthorizationHeader(&request_headers); |
// Once a token is generated, simulate the receipt of a server response |
// indicating that the authentication attempt was rejected. |
- ASSERT_EQ(OK, |
- controller->HandleAuthChallenge(headers, false, false, dummy_log)); |
+ ASSERT_EQ(OK, controller->HandleAuthChallenge(response_info, false, false, |
+ dummy_log)); |
ASSERT_TRUE(controller->HaveAuthHandler()); |
controller->ResetAuth(AuthCredentials(base::ASCIIToUTF16("Hello"), |
base::string16())); |