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

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

Issue 1151843002: DO NOT LAND Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More. Created 5 years, 7 months 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 13 matching lines...) Expand all
24 namespace net { 24 namespace net {
25 25
26 namespace { 26 namespace {
27 27
28 HttpAuthHandlerMock* CreateMockHandler(bool connection_based) { 28 HttpAuthHandlerMock* CreateMockHandler(bool connection_based) {
29 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); 29 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock();
30 auth_handler->set_connection_based(connection_based); 30 auth_handler->set_connection_based(connection_based);
31 std::string challenge_text = "Basic"; 31 std::string challenge_text = "Basic";
32 HttpAuthChallengeTokenizer challenge(challenge_text.begin(), 32 HttpAuthChallengeTokenizer challenge(challenge_text.begin(),
33 challenge_text.end()); 33 challenge_text.end());
34 GURL origin("www.example.com"); 34 url::Origin origin("www.example.com");
35 EXPECT_TRUE(auth_handler->InitFromChallenge(&challenge, 35 EXPECT_TRUE(auth_handler->InitFromChallenge(&challenge,
36 HttpAuth::AUTH_SERVER, 36 HttpAuth::AUTH_SERVER,
37 origin, 37 origin,
38 BoundNetLog())); 38 BoundNetLog()));
39 return auth_handler; 39 return auth_handler;
40 } 40 }
41 41
42 HttpResponseHeaders* HeadersFromResponseText(const std::string& response) { 42 HttpResponseHeaders* HeadersFromResponseText(const std::string& response) {
43 return new HttpResponseHeaders( 43 return new HttpResponseHeaders(
44 HttpUtil::AssembleRawHeaders(response.c_str(), response.length())); 44 HttpUtil::AssembleRawHeaders(response.c_str(), response.length()));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // relies on being able to load one of the known .so files 113 // relies on being able to load one of the known .so files
114 // for gssapi. 114 // for gssapi.
115 HttpAuth::AUTH_SCHEME_NEGOTIATE, 115 HttpAuth::AUTH_SCHEME_NEGOTIATE,
116 #else 116 #else
117 // On systems that don't use Kerberos fall back to NTLM. 117 // On systems that don't use Kerberos fall back to NTLM.
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 }; 122 };
123 GURL origin("http://www.example.com"); 123 url::Origin 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(tests); ++i) { 132 for (size_t i = 0; i < arraysize(tests); ++i) {
133 // Make a HttpResponseHeaders object. 133 // Make a HttpResponseHeaders object.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698