| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 HttpAuth::AUTH_SCHEME_NTLM, | 118 HttpAuth::AUTH_SCHEME_NTLM, |
| 119 #endif // defined(USE_KERBEROS) | 119 #endif // defined(USE_KERBEROS) |
| 120 "", | 120 "", |
| 121 }}; | 121 }}; |
| 122 GURL origin("http://www.example.com"); | 122 GURL origin("http://www.example.com"); |
| 123 std::set<HttpAuth::Scheme> disabled_schemes; | 123 std::set<HttpAuth::Scheme> disabled_schemes; |
| 124 MockAllowURLSecurityManager url_security_manager; | 124 MockAllowURLSecurityManager url_security_manager; |
| 125 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); | 125 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); |
| 126 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( | 126 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
| 127 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); | 127 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
| 128 http_auth_handler_factory->SetURLSecurityManager( | 128 http_auth_handler_factory->SetURLSecurityManager(kNegotiateAuthScheme, |
| 129 "negotiate", &url_security_manager); | 129 &url_security_manager); |
| 130 | 130 |
| 131 for (size_t i = 0; i < arraysize(tests); ++i) { | 131 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 132 // Make a HttpResponseHeaders object. | 132 // Make a HttpResponseHeaders object. |
| 133 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); | 133 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); |
| 134 headers_with_status_line += tests[i].headers; | 134 headers_with_status_line += tests[i].headers; |
| 135 scoped_refptr<HttpResponseHeaders> headers( | 135 scoped_refptr<HttpResponseHeaders> headers( |
| 136 HeadersFromResponseText(headers_with_status_line)); | 136 HeadersFromResponseText(headers_with_status_line)); |
| 137 | 137 |
| 138 scoped_ptr<HttpAuthHandler> handler; | 138 scoped_ptr<HttpAuthHandler> handler; |
| 139 HttpAuth::ChooseBestChallenge(http_auth_handler_factory.get(), | 139 HttpAuth::ChooseBestChallenge(http_auth_handler_factory.get(), |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 std::string name; | 259 std::string name; |
| 260 | 260 |
| 261 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 261 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
| 262 EXPECT_STREQ("Authorization", name.c_str()); | 262 EXPECT_STREQ("Authorization", name.c_str()); |
| 263 | 263 |
| 264 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 264 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
| 265 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 265 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace net | 268 } // namespace net |
| OLD | NEW |