| 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 "net/http/http_auth_gssapi_posix.h" | 5 #include "net/http/http_auth_gssapi_posix.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup) { | 75 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup) { |
| 76 // TODO(ahendrickson): Manipulate the libraries and paths to test each of the | 76 // TODO(ahendrickson): Manipulate the libraries and paths to test each of the |
| 77 // libraries we expect, and also whether or not they have the interface | 77 // libraries we expect, and also whether or not they have the interface |
| 78 // functions we want. | 78 // functions we want. |
| 79 scoped_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary("")); | 79 scoped_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary("")); |
| 80 DCHECK(gssapi.get()); | 80 DCHECK(gssapi.get()); |
| 81 EXPECT_TRUE(gssapi.get()->Init()); | 81 EXPECT_TRUE(gssapi.get()->Init()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 #if defined(DLOPEN_KERBEROS) |
| 84 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) { | 85 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) { |
| 85 scoped_ptr<GSSAPILibrary> gssapi( | 86 scoped_ptr<GSSAPILibrary> gssapi( |
| 86 new GSSAPISharedLibrary("/this/library/does/not/exist")); | 87 new GSSAPISharedLibrary("/this/library/does/not/exist")); |
| 87 EXPECT_FALSE(gssapi.get()->Init()); | 88 EXPECT_FALSE(gssapi.get()->Init()); |
| 88 } | 89 } |
| 90 #endif // defined(DLOPEN_KERBEROS) |
| 89 | 91 |
| 90 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { | 92 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { |
| 91 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary); | 93 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary); |
| 92 DCHECK(mock_library.get()); | 94 DCHECK(mock_library.get()); |
| 93 mock_library->Init(); | 95 mock_library->Init(); |
| 94 const char kAuthResponse[] = "Mary had a little lamb"; | 96 const char kAuthResponse[] = "Mary had a little lamb"; |
| 95 test::GssContextMockImpl context1( | 97 test::GssContextMockImpl context1( |
| 96 "localhost", // Source name | 98 "localhost", // Source name |
| 97 "example.com", // Target name | 99 "example.com", // Target name |
| 98 23, // Lifetime | 100 23, // Lifetime |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 L"HTTP/intranet.google.com", | 268 L"HTTP/intranet.google.com", |
| 267 &auth_token)); | 269 &auth_token)); |
| 268 std::string second_challenge_text = "Negotiate =happyjoy="; | 270 std::string second_challenge_text = "Negotiate =happyjoy="; |
| 269 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(), | 271 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(), |
| 270 second_challenge_text.end()); | 272 second_challenge_text.end()); |
| 271 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, | 273 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, |
| 272 auth_gssapi.ParseChallenge(&second_challenge)); | 274 auth_gssapi.ParseChallenge(&second_challenge)); |
| 273 } | 275 } |
| 274 | 276 |
| 275 } // namespace net | 277 } // namespace net |
| OLD | NEW |