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

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

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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) 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 26 matching lines...) Expand all
37 std::string challenge = "Basic realm=\"Atlantis\""; 37 std::string challenge = "Basic realm=\"Atlantis\"";
38 scoped_ptr<HttpAuthHandler> basic; 38 scoped_ptr<HttpAuthHandler> basic;
39 EXPECT_EQ(OK, factory.CreateAuthHandlerFromString( 39 EXPECT_EQ(OK, factory.CreateAuthHandlerFromString(
40 challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic)); 40 challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic));
41 AuthCredentials credentials(base::ASCIIToUTF16(tests[i].username), 41 AuthCredentials credentials(base::ASCIIToUTF16(tests[i].username),
42 base::ASCIIToUTF16(tests[i].password)); 42 base::ASCIIToUTF16(tests[i].password));
43 HttpRequestInfo request_info; 43 HttpRequestInfo request_info;
44 std::string auth_token; 44 std::string auth_token;
45 TestCompletionCallback callback; 45 TestCompletionCallback callback;
46 int rv = basic->GenerateAuthToken(&credentials, &request_info, 46 int rv = basic->GenerateAuthToken(&credentials, &request_info,
47 callback.callback(), &auth_token); 47 callback.callback(), &auth_token, NULL);
Bernhard Bauer 2015/05/15 15:06:16 Use nullptr instead of NULL.
aberent 2015/05/18 13:45:27 Shouldn't have been here at all! Fixed in a later
48 EXPECT_EQ(OK, rv); 48 EXPECT_EQ(OK, rv);
49 EXPECT_STREQ(tests[i].expected_credentials, auth_token.c_str()); 49 EXPECT_STREQ(tests[i].expected_credentials, auth_token.c_str());
50 } 50 }
51 } 51 }
52 52
53 TEST(HttpAuthHandlerBasicTest, HandleAnotherChallenge) { 53 TEST(HttpAuthHandlerBasicTest, HandleAnotherChallenge) {
54 static const struct { 54 static const struct {
55 const char* challenge; 55 const char* challenge;
56 HttpAuth::AuthorizationResult expected_rv; 56 HttpAuth::AuthorizationResult expected_rv;
57 } tests[] = { 57 } tests[] = {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 scoped_ptr<HttpAuthHandler> basic; 190 scoped_ptr<HttpAuthHandler> basic;
191 int rv = factory.CreateAuthHandlerFromString( 191 int rv = factory.CreateAuthHandlerFromString(
192 challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic); 192 challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic);
193 EXPECT_EQ(tests[i].expected_rv, rv); 193 EXPECT_EQ(tests[i].expected_rv, rv);
194 if (rv == OK) 194 if (rv == OK)
195 EXPECT_EQ(tests[i].expected_realm, basic->realm()); 195 EXPECT_EQ(tests[i].expected_realm, basic->realm());
196 } 196 }
197 } 197 }
198 198
199 } // namespace net 199 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698