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

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

Issue 7655046: Linux: allow linking directly with Kerberos instead of using dlopen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hopefully fix ChromeOS Created 9 years, 4 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_factory.cc ('k') | net/http/mock_gssapi_library_posix.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) 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 "net/http/http_auth_handler_negotiate.h" 5 #include "net/http/http_auth_handler_negotiate.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "net/base/mock_host_resolver.h" 9 #include "net/base/mock_host_resolver.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/base/test_completion_callback.h" 11 #include "net/base/test_completion_callback.h"
12 #include "net/http/http_request_info.h" 12 #include "net/http/http_request_info.h"
13 #include "net/http/mock_allow_url_security_manager.h" 13 #include "net/http/mock_allow_url_security_manager.h"
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 #include "net/http/mock_sspi_library_win.h" 15 #include "net/http/mock_sspi_library_win.h"
16 #elif defined(OS_POSIX) 16 #elif defined(OS_POSIX)
17 #include "net/http/mock_gssapi_library_posix.h" 17 #include "net/http/mock_gssapi_library_posix.h"
18 #include "net/third_party/gssapi/gssapi.h"
19 #endif 18 #endif
20 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
21 #include "testing/platform_test.h" 20 #include "testing/platform_test.h"
22 21
23 #if defined(OS_WIN) 22 #if defined(OS_WIN)
24 typedef net::MockSSPILibrary MockAuthLibrary; 23 typedef net::MockSSPILibrary MockAuthLibrary;
25 #elif defined(OS_POSIX) 24 #elif defined(OS_POSIX)
26 typedef net::test::MockGSSAPILibrary MockAuthLibrary; 25 typedef net::test::MockGSSAPILibrary MockAuthLibrary;
27 #endif 26 #endif
28 27
29
30 namespace net { 28 namespace net {
31 29
32 class HttpAuthHandlerNegotiateTest : public PlatformTest { 30 class HttpAuthHandlerNegotiateTest : public PlatformTest {
33 public: 31 public:
34 virtual void SetUp() { 32 virtual void SetUp() {
35 auth_library_ = new MockAuthLibrary(); 33 auth_library_ = new MockAuthLibrary();
36 resolver_.reset(new MockHostResolver()); 34 resolver_.reset(new MockHostResolver());
37 resolver_->rules()->AddIPLiteralRule("alias", "10.0.0.2", 35 resolver_->rules()->AddIPLiteralRule("alias", "10.0.0.2",
38 "canonical.example.com"); 36 "canonical.example.com");
39 37
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 false, false, false, "http://alias:500", &auth_handler)); 336 false, false, false, "http://alias:500", &auth_handler));
339 ASSERT_TRUE(auth_handler.get() != NULL); 337 ASSERT_TRUE(auth_handler.get() != NULL);
340 TestCompletionCallback callback; 338 TestCompletionCallback callback;
341 HttpRequestInfo request_info; 339 HttpRequestInfo request_info;
342 std::string token; 340 std::string token;
343 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 341 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
344 NULL, NULL, &request_info, &callback, &token)); 342 NULL, NULL, &request_info, &callback, &token));
345 EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult()); 343 EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult());
346 } 344 }
347 345
346 #if defined(DLOPEN_KERBEROS)
348 TEST_F(HttpAuthHandlerNegotiateTest, MissingGSSAPI) { 347 TEST_F(HttpAuthHandlerNegotiateTest, MissingGSSAPI) {
349 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); 348 scoped_ptr<HostResolver> host_resolver(new MockHostResolver());
350 MockAllowURLSecurityManager url_security_manager; 349 MockAllowURLSecurityManager url_security_manager;
351 scoped_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory( 350 scoped_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory(
352 new HttpAuthHandlerNegotiate::Factory()); 351 new HttpAuthHandlerNegotiate::Factory());
353 negotiate_factory->set_host_resolver(host_resolver.get()); 352 negotiate_factory->set_host_resolver(host_resolver.get());
354 negotiate_factory->set_url_security_manager(&url_security_manager); 353 negotiate_factory->set_url_security_manager(&url_security_manager);
355 negotiate_factory->set_library( 354 negotiate_factory->set_library(
356 new GSSAPISharedLibrary("/this/library/does/not/exist")); 355 new GSSAPISharedLibrary("/this/library/does/not/exist"));
357 356
358 GURL gurl("http://www.example.com"); 357 GURL gurl("http://www.example.com");
359 scoped_ptr<HttpAuthHandler> generic_handler; 358 scoped_ptr<HttpAuthHandler> generic_handler;
360 int rv = negotiate_factory->CreateAuthHandlerFromString( 359 int rv = negotiate_factory->CreateAuthHandlerFromString(
361 "Negotiate", 360 "Negotiate",
362 HttpAuth::AUTH_SERVER, 361 HttpAuth::AUTH_SERVER,
363 gurl, 362 gurl,
364 BoundNetLog(), 363 BoundNetLog(),
365 &generic_handler); 364 &generic_handler);
366 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); 365 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
367 EXPECT_TRUE(generic_handler.get() == NULL); 366 EXPECT_TRUE(generic_handler.get() == NULL);
368 } 367 }
368 #endif // defined(DLOPEN_KERBEROS)
369 369
370 #endif // defined(OS_POSIX) 370 #endif // defined(OS_POSIX)
371 371
372 } // namespace net 372 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_factory.cc ('k') | net/http/mock_gssapi_library_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698