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

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

Issue 6248021: Reapply r72562 with willchan's nits + locally tested shlib fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix path Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler_negotiate_unittest.cc ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "net/base/mock_host_resolver.h" 11 #include "net/base/mock_host_resolver.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/http/http_auth.h" 13 #include "net/http/http_auth.h"
14 #include "net/http/http_auth_filter.h" 14 #include "net/http/http_auth_filter.h"
15 #include "net/http/http_auth_handler.h" 15 #include "net/http/http_auth_handler.h"
16 #include "net/http/http_auth_handler_factory.h" 16 #include "net/http/http_auth_handler_factory.h"
17 #include "net/http/http_auth_handler_mock.h" 17 #include "net/http/http_auth_handler_mock.h"
18 #include "net/http/http_response_headers.h" 18 #include "net/http/http_response_headers.h"
19 #include "net/http/http_util.h" 19 #include "net/http/http_util.h"
20 #include "net/http/mock_allow_url_security_manager.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace net { 23 namespace net {
23 24
24 namespace { 25 namespace {
25 26
26 HttpAuthHandlerMock* CreateMockHandler(bool connection_based) { 27 HttpAuthHandlerMock* CreateMockHandler(bool connection_based) {
27 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); 28 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock();
28 auth_handler->set_connection_based(connection_based); 29 auth_handler->set_connection_based(connection_based);
29 std::string challenge_text = "Basic"; 30 std::string challenge_text = "Basic";
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // for gssapi. 109 // for gssapi.
109 "WWW-Authenticate: Negotiate\n" 110 "WWW-Authenticate: Negotiate\n"
110 "WWW-Authenticate: NTLM\n", 111 "WWW-Authenticate: NTLM\n",
111 112
112 HttpAuth::AUTH_SCHEME_NEGOTIATE, 113 HttpAuth::AUTH_SCHEME_NEGOTIATE,
113 "", 114 "",
114 } 115 }
115 }; 116 };
116 GURL origin("http://www.example.com"); 117 GURL origin("http://www.example.com");
117 std::set<HttpAuth::Scheme> disabled_schemes; 118 std::set<HttpAuth::Scheme> disabled_schemes;
118 URLSecurityManagerAllow url_security_manager; 119 MockAllowURLSecurityManager url_security_manager;
119 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); 120 scoped_ptr<HostResolver> host_resolver(new MockHostResolver());
120 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( 121 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory(
121 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); 122 HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
122 http_auth_handler_factory->SetURLSecurityManager( 123 http_auth_handler_factory->SetURLSecurityManager(
123 "negotiate", &url_security_manager); 124 "negotiate", &url_security_manager);
124 125
125 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 126 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
126 // Make a HttpResponseHeaders object. 127 // Make a HttpResponseHeaders object.
127 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); 128 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n");
128 headers_with_status_line += tests[i].headers; 129 headers_with_status_line += tests[i].headers;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 std::string name; 421 std::string name;
421 422
422 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); 423 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER);
423 EXPECT_STREQ("Authorization", name.c_str()); 424 EXPECT_STREQ("Authorization", name.c_str());
424 425
425 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); 426 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY);
426 EXPECT_STREQ("Proxy-Authorization", name.c_str()); 427 EXPECT_STREQ("Proxy-Authorization", name.c_str());
427 } 428 }
428 429
429 } // namespace net 430 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_negotiate_unittest.cc ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698