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