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

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

Issue 7719024: Revert 97925 - Linux: allow linking directly with Kerberos instead of using dlopen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
18 #endif 19 #endif
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "testing/platform_test.h" 21 #include "testing/platform_test.h"
21 22
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 typedef net::MockSSPILibrary MockAuthLibrary; 24 typedef net::MockSSPILibrary MockAuthLibrary;
24 #elif defined(OS_POSIX) 25 #elif defined(OS_POSIX)
25 typedef net::test::MockGSSAPILibrary MockAuthLibrary; 26 typedef net::test::MockGSSAPILibrary MockAuthLibrary;
26 #endif 27 #endif
27 28
29
28 namespace net { 30 namespace net {
29 31
30 class HttpAuthHandlerNegotiateTest : public PlatformTest { 32 class HttpAuthHandlerNegotiateTest : public PlatformTest {
31 public: 33 public:
32 virtual void SetUp() { 34 virtual void SetUp() {
33 auth_library_ = new MockAuthLibrary(); 35 auth_library_ = new MockAuthLibrary();
34 resolver_.reset(new MockHostResolver()); 36 resolver_.reset(new MockHostResolver());
35 resolver_->rules()->AddIPLiteralRule("alias", "10.0.0.2", 37 resolver_->rules()->AddIPLiteralRule("alias", "10.0.0.2",
36 "canonical.example.com"); 38 "canonical.example.com");
37 39
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 false, false, false, "http://alias:500", &auth_handler)); 338 false, false, false, "http://alias:500", &auth_handler));
337 ASSERT_TRUE(auth_handler.get() != NULL); 339 ASSERT_TRUE(auth_handler.get() != NULL);
338 TestCompletionCallback callback; 340 TestCompletionCallback callback;
339 HttpRequestInfo request_info; 341 HttpRequestInfo request_info;
340 std::string token; 342 std::string token;
341 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 343 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
342 NULL, NULL, &request_info, &callback, &token)); 344 NULL, NULL, &request_info, &callback, &token));
343 EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult()); 345 EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult());
344 } 346 }
345 347
346 #if defined(DLOPEN_KERBEROS)
347 TEST_F(HttpAuthHandlerNegotiateTest, MissingGSSAPI) { 348 TEST_F(HttpAuthHandlerNegotiateTest, MissingGSSAPI) {
348 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); 349 scoped_ptr<HostResolver> host_resolver(new MockHostResolver());
349 MockAllowURLSecurityManager url_security_manager; 350 MockAllowURLSecurityManager url_security_manager;
350 scoped_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory( 351 scoped_ptr<HttpAuthHandlerNegotiate::Factory> negotiate_factory(
351 new HttpAuthHandlerNegotiate::Factory()); 352 new HttpAuthHandlerNegotiate::Factory());
352 negotiate_factory->set_host_resolver(host_resolver.get()); 353 negotiate_factory->set_host_resolver(host_resolver.get());
353 negotiate_factory->set_url_security_manager(&url_security_manager); 354 negotiate_factory->set_url_security_manager(&url_security_manager);
354 negotiate_factory->set_library( 355 negotiate_factory->set_library(
355 new GSSAPISharedLibrary("/this/library/does/not/exist")); 356 new GSSAPISharedLibrary("/this/library/does/not/exist"));
356 357
357 GURL gurl("http://www.example.com"); 358 GURL gurl("http://www.example.com");
358 scoped_ptr<HttpAuthHandler> generic_handler; 359 scoped_ptr<HttpAuthHandler> generic_handler;
359 int rv = negotiate_factory->CreateAuthHandlerFromString( 360 int rv = negotiate_factory->CreateAuthHandlerFromString(
360 "Negotiate", 361 "Negotiate",
361 HttpAuth::AUTH_SERVER, 362 HttpAuth::AUTH_SERVER,
362 gurl, 363 gurl,
363 BoundNetLog(), 364 BoundNetLog(),
364 &generic_handler); 365 &generic_handler);
365 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); 366 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
366 EXPECT_TRUE(generic_handler.get() == NULL); 367 EXPECT_TRUE(generic_handler.get() == NULL);
367 } 368 }
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