Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: net/http/http_auth_unittest.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing Chromeos includes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698