| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
| 7 #include "net/dns/mock_host_resolver.h" | 7 #include "net/dns/mock_host_resolver.h" |
| 8 #include "net/http/http_auth_handler.h" | 8 #include "net/http/http_auth_handler.h" |
| 9 #include "net/http/http_auth_handler_factory.h" | 9 #include "net/http/http_auth_handler_factory.h" |
| 10 #include "net/http/mock_allow_url_security_manager.h" | 10 #include "net/http/mock_allow_url_security_manager.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 registry_factory.CreateAuthHandlerFromString( | 94 registry_factory.CreateAuthHandlerFromString( |
| 95 "Digest", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), | 95 "Digest", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), |
| 96 &handler)); | 96 &handler)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { | 99 TEST(HttpAuthHandlerFactoryTest, DefaultFactory) { |
| 100 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); | 100 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); |
| 101 MockAllowURLSecurityManager url_security_manager; | 101 MockAllowURLSecurityManager url_security_manager; |
| 102 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( | 102 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
| 103 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); | 103 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
| 104 http_auth_handler_factory->SetURLSecurityManager( | 104 http_auth_handler_factory->SetURLSecurityManager(kNegotiateAuthScheme, |
| 105 "negotiate", &url_security_manager); | 105 &url_security_manager); |
| 106 GURL server_origin("http://www.example.com"); | 106 GURL server_origin("http://www.example.com"); |
| 107 GURL proxy_origin("http://cache.example.com:3128"); | 107 GURL proxy_origin("http://cache.example.com:3128"); |
| 108 { | 108 { |
| 109 scoped_ptr<HttpAuthHandler> handler; | 109 scoped_ptr<HttpAuthHandler> handler; |
| 110 int rv = http_auth_handler_factory->CreateAuthHandlerFromString( | 110 int rv = http_auth_handler_factory->CreateAuthHandlerFromString( |
| 111 "Basic realm=\"FooBar\"", | 111 "Basic realm=\"FooBar\"", |
| 112 HttpAuth::AUTH_SERVER, | 112 HttpAuth::AUTH_SERVER, |
| 113 server_origin, | 113 server_origin, |
| 114 BoundNetLog(), | 114 BoundNetLog(), |
| 115 &handler); | 115 &handler); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EXPECT_TRUE(handler->encrypts_identity()); | 182 EXPECT_TRUE(handler->encrypts_identity()); |
| 183 EXPECT_TRUE(handler->is_connection_based()); | 183 EXPECT_TRUE(handler->is_connection_based()); |
| 184 #else | 184 #else |
| 185 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); | 185 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); |
| 186 EXPECT_TRUE(handler.get() == NULL); | 186 EXPECT_TRUE(handler.get() == NULL); |
| 187 #endif // defined(USE_KERBEROS) && !defined(OS_ANDROID) | 187 #endif // defined(USE_KERBEROS) && !defined(OS_ANDROID) |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace net | 191 } // namespace net |
| OLD | NEW |