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

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

Issue 4560001: Support specifying the GSSAPI library that will be used. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix library handling on Windows; port to ToT Created 10 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/native_library.h" 9 #include "base/native_library.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 in_buffer, 69 in_buffer,
70 out_buffer); 70 out_buffer);
71 } 71 }
72 72
73 } // namespace 73 } // namespace
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 GSSAPILibrary* gssapi = GSSAPILibrary::GetDefault(); 79 scoped_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary(""));
80 DCHECK(gssapi); 80 DCHECK(gssapi.get());
81 gssapi->Init(); 81 DCHECK(gssapi.get()->Init());
82 }
83
84 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPILoadCustomLibrary) {
85 scoped_ptr<GSSAPILibrary> gssapi(
86 new GSSAPISharedLibrary("/this/library/does/not/exist"));
87 DCHECK(!gssapi.get()->Init());
82 } 88 }
83 89
84 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) { 90 TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) {
85 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary); 91 scoped_ptr<test::MockGSSAPILibrary> mock_library(new test::MockGSSAPILibrary);
86 DCHECK(mock_library.get()); 92 DCHECK(mock_library.get());
87 mock_library->Init(); 93 mock_library->Init();
88 const char kAuthResponse[] = "Mary had a little lamb"; 94 const char kAuthResponse[] = "Mary had a little lamb";
89 test::GssContextMockImpl context1( 95 test::GssContextMockImpl context1(
90 "localhost", // Source name 96 "localhost", // Source name
91 "example.com", // Target name 97 "example.com", // Target name
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 L"HTTP/intranet.google.com", 267 L"HTTP/intranet.google.com",
262 &auth_token)); 268 &auth_token));
263 std::string second_challenge_text = "Negotiate =happyjoy="; 269 std::string second_challenge_text = "Negotiate =happyjoy=";
264 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(), 270 HttpAuth::ChallengeTokenizer second_challenge(second_challenge_text.begin(),
265 second_challenge_text.end()); 271 second_challenge_text.end());
266 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, 272 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID,
267 auth_gssapi.ParseChallenge(&second_challenge)); 273 auth_gssapi.ParseChallenge(&second_challenge));
268 } 274 }
269 275
270 } // namespace net 276 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698