OLD | NEW |
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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/http/http_auth.h" | 10 #include "net/http/http_auth.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 "www-authenticate:\n", | 53 "www-authenticate:\n", |
54 | 54 |
55 // Handle null header value. | 55 // Handle null header value. |
56 "", | 56 "", |
57 "", | 57 "", |
58 }, | 58 }, |
59 { | 59 { |
60 "WWW-Authenticate: Negotiate\n" | 60 "WWW-Authenticate: Negotiate\n" |
61 "WWW-Authenticate: NTLM\n", | 61 "WWW-Authenticate: NTLM\n", |
62 | 62 |
63 // Negotiate is not currently support on non-Windows platforms, so | |
64 // the choice varies depending on platform. | |
65 #if defined(OS_WIN) | |
66 "negotiate", | 63 "negotiate", |
67 "", | 64 "", |
68 #else | |
69 "ntlm", | |
70 "", | |
71 #endif | |
72 } | 65 } |
73 }; | 66 }; |
74 GURL origin("http://www.example.com"); | 67 GURL origin("http://www.example.com"); |
75 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory( | 68 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory( |
76 HttpAuthHandlerFactory::CreateDefault()); | 69 HttpAuthHandlerFactory::CreateDefault()); |
77 | 70 |
78 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 71 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
79 // Make a HttpResponseHeaders object. | 72 // Make a HttpResponseHeaders object. |
80 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); | 73 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); |
81 headers_with_status_line += tests[i].headers; | 74 headers_with_status_line += tests[i].headers; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 std::string name; | 340 std::string name; |
348 | 341 |
349 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 342 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
350 EXPECT_STREQ("Authorization", name.c_str()); | 343 EXPECT_STREQ("Authorization", name.c_str()); |
351 | 344 |
352 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 345 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
353 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 346 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
354 } | 347 } |
355 | 348 |
356 } // namespace net | 349 } // namespace net |
OLD | NEW |