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

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

Issue 2826273004: Enable loading gssapi library for Chromad. (Closed)
Patch Set: Enable loading gssapi library for Chromad. Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/native_library.h" 10 #include "base/native_library.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // should never be called. 76 // should never be called.
77 ADD_FAILURE(); 77 ADD_FAILURE();
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup) { 82 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup) {
83 // TODO(ahendrickson): Manipulate the libraries and paths to test each of the 83 // TODO(ahendrickson): Manipulate the libraries and paths to test each of the
84 // libraries we expect, and also whether or not they have the interface 84 // libraries we expect, and also whether or not they have the interface
85 // functions we want. 85 // functions we want.
86 std::unique_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary(std::string())); 86 std::unique_ptr<GSSAPILibrary> gssapi(
87 new GSSAPISharedLibrary(std::string(), true));
87 DCHECK(gssapi.get()); 88 DCHECK(gssapi.get());
88 EXPECT_TRUE(gssapi.get()->Init()); 89 EXPECT_TRUE(gssapi.get()->Init());
89 } 90 }
90 91
92 #if defined(OS_CHROMEOS)
93 TEST(HttpAuthGSSAPIPOSIXTest, BlockGssapiLibraryLoad) {
94 std::unique_ptr<GSSAPILibrary> gssapi(
95 new GSSAPISharedLibrary(std::string(), false));
96 DCHECK(gssapi.get());
97 EXPECT_FALSE(gssapi.get()->Init());
98 }
99 #endif
100
91 #if defined(DLOPEN_KERBEROS) 101 #if defined(DLOPEN_KERBEROS)
92 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) { 102 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) {
93 std::unique_ptr<GSSAPILibrary> gssapi( 103 std::unique_ptr<GSSAPILibrary> gssapi(
94 new GSSAPISharedLibrary("/this/library/does/not/exist")); 104 new GSSAPISharedLibrary("/this/library/does/not/exist", true));
95 EXPECT_FALSE(gssapi.get()->Init()); 105 EXPECT_FALSE(gssapi.get()->Init());
96 } 106 }
97 #endif // defined(DLOPEN_KERBEROS) 107 #endif // defined(DLOPEN_KERBEROS)
98 108
99 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { 109 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) {
100 std::unique_ptr<test::MockGSSAPILibrary> mock_library( 110 std::unique_ptr<test::MockGSSAPILibrary> mock_library(
101 new test::MockGSSAPILibrary); 111 new test::MockGSSAPILibrary);
102 DCHECK(mock_library.get()); 112 DCHECK(mock_library.get());
103 mock_library->Init(); 113 mock_library->Init();
104 const char kAuthResponse[] = "Mary had a little lamb"; 114 const char kAuthResponse[] = "Mary had a little lamb";
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 std::string(), &auth_token, 286 std::string(), &auth_token,
277 base::Bind(&UnexpectedCallback))); 287 base::Bind(&UnexpectedCallback)));
278 std::string second_challenge_text = "Negotiate =happyjoy="; 288 std::string second_challenge_text = "Negotiate =happyjoy=";
279 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), 289 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
280 second_challenge_text.end()); 290 second_challenge_text.end());
281 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, 291 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID,
282 auth_gssapi.ParseChallenge(&second_challenge)); 292 auth_gssapi.ParseChallenge(&second_challenge));
283 } 293 }
284 294
285 } // namespace net 295 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698