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

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

Issue 3360017: Fix multi-round authentication.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: SocketStream fix Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/http/http_auth_handler_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 tests[i].req_path, 284 tests[i].req_path,
285 ASCIIToUTF16(tests[i].username), 285 ASCIIToUTF16(tests[i].username),
286 ASCIIToUTF16(tests[i].password), 286 ASCIIToUTF16(tests[i].password),
287 tests[i].cnonce, 287 tests[i].cnonce,
288 tests[i].nonce_count); 288 tests[i].nonce_count);
289 289
290 EXPECT_STREQ(tests[i].expected_creds, creds.c_str()); 290 EXPECT_STREQ(tests[i].expected_creds, creds.c_str());
291 } 291 }
292 } 292 }
293 293
294 TEST(HttpAuthHandlerDigest, HandleAnotherChallenge_Failed) {
295 scoped_ptr<HttpAuthHandlerDigest::Factory> factory(
296 new HttpAuthHandlerDigest::Factory());
297 scoped_ptr<HttpAuthHandler> handler;
298 std::string default_challenge =
299 "Digest realm=\"Oblivion\", nonce=\"nonce-value\"";
300 GURL origin("intranet.google.com");
301 int rv = factory->CreateAuthHandlerFromString(
302 default_challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog(),
303 &handler);
304 EXPECT_EQ(OK, rv);
305
306 HttpAuth::ChallengeTokenizer tok_default(default_challenge.begin(),
307 default_challenge.end());
308 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
309 handler->HandleAnotherChallenge(&tok_default));
310
311 std::string stale_challenge = default_challenge + ", stale=true";
312 HttpAuth::ChallengeTokenizer tok_stale(stale_challenge.begin(),
313 stale_challenge.end());
314 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_STALE,
315 handler->HandleAnotherChallenge(&tok_stale));
316
317 std::string stale_false_challenge = default_challenge + ", stale=false";
318 HttpAuth::ChallengeTokenizer tok_stale_false(stale_false_challenge.begin(),
319 stale_false_challenge.end());
320 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
321 handler->HandleAnotherChallenge(&tok_stale_false));
322 }
323
294 } // namespace net 324 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/http/http_auth_handler_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698