OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_auth_controller.h" | 5 #include "net/http/http_auth_controller.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // Should only succeed if we are using the AUTH_SCHEME_MOCK MockHandler. | 217 // Should only succeed if we are using the AUTH_SCHEME_MOCK MockHandler. |
218 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( | 218 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( |
219 &request, CompletionCallback(), dummy_log)); | 219 &request, CompletionCallback(), dummy_log)); |
220 controller->AddAuthorizationHeader(&request_headers); | 220 controller->AddAuthorizationHeader(&request_headers); |
221 | 221 |
222 // Once a token is generated, simulate the receipt of a server response | 222 // Once a token is generated, simulate the receipt of a server response |
223 // indicating that the authentication attempt was rejected. | 223 // indicating that the authentication attempt was rejected. |
224 ASSERT_EQ(OK, | 224 ASSERT_EQ(OK, |
225 controller->HandleAuthChallenge(headers, false, false, dummy_log)); | 225 controller->HandleAuthChallenge(headers, false, false, dummy_log)); |
226 ASSERT_TRUE(controller->HaveAuthHandler()); | 226 ASSERT_TRUE(controller->HaveAuthHandler()); |
227 controller->ResetAuth(AuthCredentials(ASCIIToUTF16("Hello"), | 227 controller->ResetAuth(AuthCredentials(base::ASCIIToUTF16("Hello"), |
228 base::string16())); | 228 base::string16())); |
229 EXPECT_TRUE(controller->HaveAuth()); | 229 EXPECT_TRUE(controller->HaveAuth()); |
230 EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK)); | 230 EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK)); |
231 EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC)); | 231 EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC)); |
232 | 232 |
233 // Should only succeed if we are using the AUTH_SCHEME_BASIC MockHandler. | 233 // Should only succeed if we are using the AUTH_SCHEME_BASIC MockHandler. |
234 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( | 234 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( |
235 &request, CompletionCallback(), dummy_log)); | 235 &request, CompletionCallback(), dummy_log)); |
236 } | 236 } |
237 | 237 |
238 } // namespace net | 238 } // namespace net |
OLD | NEW |