OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/http/http_auth_handler_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 GURL gurl(url_string); | 209 GURL gurl(url_string); |
210 | 210 |
211 // Note: This is a little tricky because CreateAuthHandlerFromString | 211 // Note: This is a little tricky because CreateAuthHandlerFromString |
212 // expects a std::unique_ptr<HttpAuthHandler>* rather than a | 212 // expects a std::unique_ptr<HttpAuthHandler>* rather than a |
213 // std::unique_ptr<HttpAuthHandlerNegotiate>*. This needs to do the cast | 213 // std::unique_ptr<HttpAuthHandlerNegotiate>*. This needs to do the cast |
214 // after creating the handler, and make sure that generic_handler | 214 // after creating the handler, and make sure that generic_handler |
215 // no longer holds on to the HttpAuthHandlerNegotiate object. | 215 // no longer holds on to the HttpAuthHandlerNegotiate object. |
216 std::unique_ptr<HttpAuthHandler> generic_handler; | 216 std::unique_ptr<HttpAuthHandler> generic_handler; |
217 SSLInfo null_ssl_info; | 217 SSLInfo null_ssl_info; |
218 int rv = factory_->CreateAuthHandlerFromString( | 218 int rv = factory_->CreateAuthHandlerFromString( |
219 "Negotiate", HttpAuth::AUTH_SERVER, null_ssl_info, gurl, BoundNetLog(), | 219 "Negotiate", HttpAuth::AUTH_SERVER, null_ssl_info, gurl, |
220 &generic_handler); | 220 NetLogWithSource(), &generic_handler); |
221 if (rv != OK) | 221 if (rv != OK) |
222 return rv; | 222 return rv; |
223 HttpAuthHandlerNegotiate* negotiate_handler = | 223 HttpAuthHandlerNegotiate* negotiate_handler = |
224 static_cast<HttpAuthHandlerNegotiate*>(generic_handler.release()); | 224 static_cast<HttpAuthHandlerNegotiate*>(generic_handler.release()); |
225 handler->reset(negotiate_handler); | 225 handler->reset(negotiate_handler); |
226 return rv; | 226 return rv; |
227 } | 227 } |
228 | 228 |
229 MockAuthLibrary* AuthLibrary() { return auth_library_; } | 229 MockAuthLibrary* AuthLibrary() { return auth_library_; } |
230 | 230 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 std::unique_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory( | 374 std::unique_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory( |
375 new HttpAuthHandlerNegotiate::Factory()); | 375 new HttpAuthHandlerNegotiate::Factory()); |
376 negotiate_factory->set_host_resolver(host_resolver); | 376 negotiate_factory->set_host_resolver(host_resolver); |
377 negotiate_factory->set_http_auth_preferences(&http_auth_preferences); | 377 negotiate_factory->set_http_auth_preferences(&http_auth_preferences); |
378 negotiate_factory->set_library( | 378 negotiate_factory->set_library( |
379 base::MakeUnique<GSSAPISharedLibrary>("/this/library/does/not/exist")); | 379 base::MakeUnique<GSSAPISharedLibrary>("/this/library/does/not/exist")); |
380 | 380 |
381 GURL gurl("http://www.example.com"); | 381 GURL gurl("http://www.example.com"); |
382 std::unique_ptr<HttpAuthHandler> generic_handler; | 382 std::unique_ptr<HttpAuthHandler> generic_handler; |
383 int rv = negotiate_factory->CreateAuthHandlerFromString( | 383 int rv = negotiate_factory->CreateAuthHandlerFromString( |
384 "Negotiate", | 384 "Negotiate", HttpAuth::AUTH_SERVER, gurl, NetLogWithSource(), |
385 HttpAuth::AUTH_SERVER, | |
386 gurl, | |
387 BoundNetLog(), | |
388 &generic_handler); | 385 &generic_handler); |
389 EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME)); | 386 EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME)); |
390 EXPECT_TRUE(generic_handler.get() == NULL); | 387 EXPECT_TRUE(generic_handler.get() == NULL); |
391 } | 388 } |
392 #endif // defined(DLOPEN_KERBEROS) | 389 #endif // defined(DLOPEN_KERBEROS) |
393 | 390 |
394 #endif // defined(OS_POSIX) | 391 #endif // defined(OS_POSIX) |
395 | 392 |
396 } // namespace net | 393 } // namespace net |
OLD | NEW |