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

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

Issue 242135: Merge r25564 and r26588 from the trunk.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Undo an extraneous comment change Created 11 years, 2 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_basic_unittest.cc ('k') | net/http/http_auth_handler_ntlm.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/http/http_auth_handler_digest.h" 8 #include "net/http/http_auth_handler_digest.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 "15c07961ed8575c4", // cnonce 228 "15c07961ed8575c4", // cnonce
229 1, // nc 229 1, // nc
230 230
231 // Authorization 231 // Authorization
232 "Digest username=\"USER\", realm=\"Baztastic\", " 232 "Digest username=\"USER\", realm=\"Baztastic\", "
233 "nonce=\"AAAAAAAA\", uri=\"/\", algorithm=MD5-sess, " 233 "nonce=\"AAAAAAAA\", uri=\"/\", algorithm=MD5-sess, "
234 "response=\"cbc1139821ee7192069580570c541a03\", " 234 "response=\"cbc1139821ee7192069580570c541a03\", "
235 "qop=auth, nc=00000001, cnonce=\"15c07961ed8575c4\"" 235 "qop=auth, nc=00000001, cnonce=\"15c07961ed8575c4\""
236 } 236 }
237 }; 237 };
238 GURL origin("http://www.example.com");
238 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 239 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
239 scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest; 240 scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest;
240 std::string challenge = tests[i].challenge; 241 std::string challenge = tests[i].challenge;
241 EXPECT_TRUE(digest->InitFromChallenge( 242 EXPECT_TRUE(digest->InitFromChallenge(
242 challenge.begin(), challenge.end(), HttpAuth::AUTH_SERVER)); 243 challenge.begin(), challenge.end(), HttpAuth::AUTH_SERVER, origin));
243 244
244 std::string creds = digest->AssembleCredentials(tests[i].req_method, 245 std::string creds = digest->AssembleCredentials(tests[i].req_method,
245 tests[i].req_path, tests[i].username, tests[i].password, 246 tests[i].req_path, tests[i].username, tests[i].password,
246 tests[i].cnonce, tests[i].nonce_count); 247 tests[i].cnonce, tests[i].nonce_count);
247 248
248 EXPECT_STREQ(tests[i].expected_creds, creds.c_str()); 249 EXPECT_STREQ(tests[i].expected_creds, creds.c_str());
249 } 250 }
250 } 251 }
251 252
252 } // namespace net 253 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_basic_unittest.cc ('k') | net/http/http_auth_handler_ntlm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698