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) | |
85 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) { | 84 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) { |
86 scoped_ptr<GSSAPILibrary> gssapi( | 85 scoped_ptr<GSSAPILibrary> gssapi( |
87 new GSSAPISharedLibrary("/this/library/does/not/exist")); | 86 new GSSAPISharedLibrary("/this/library/does/not/exist")); |
88 EXPECT_FALSE(gssapi.get()->Init()); | 87 EXPECT_FALSE(gssapi.get()->Init()); |
89 } | 88 } |
90 #endif // defined(DLOPEN_KERBEROS) | |
91 | 89 |
92 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { | 90 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { |
93 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary); | 91 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary); |
94 DCHECK(mock_library.get()); | 92 DCHECK(mock_library.get()); |
95 mock_library->Init(); | 93 mock_library->Init(); |
96 const char kAuthResponse[] = "Mary had a little lamb"; | 94 const char kAuthResponse[] = "Mary had a little lamb"; |
97 test::GssContextMockImpl context1( | 95 test::GssContextMockImpl context1( |
98 "localhost", // Source name | 96 "localhost", // Source name |
99 "example.com", // Target name | 97 "example.com", // Target name |
100 23, // Lifetime | 98 23, // Lifetime |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 L"HTTP/intranet.google.com", | 266 L"HTTP/intranet.google.com", |
269 &auth_token)); | 267 &auth_token)); |
270 std::string second_challenge_text = "Negotiate =happyjoy="; | 268 std::string second_challenge_text = "Negotiate =happyjoy="; |
271 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(), | 269 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(), |
272 second_challenge_text.end()); | 270 second_challenge_text.end()); |
273 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, | 271 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, |
274 auth_gssapi.ParseChallenge(&second_challenge)); | 272 auth_gssapi.ParseChallenge(&second_challenge)); |
275 } | 273 } |
276 | 274 |
277 } // namespace net | 275 } // namespace net |
OLD | NEW |