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

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

Issue 1800003: Auto-format style pass over files. (Closed)
Patch Set: Remove trailing whitespace. Created 10 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
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/http/http_auth_handler_ntlm_portable.cc » ('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 "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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 "xyz", 56 "xyz",
57 "", 57 "",
58 "", 58 "",
59 false, 59 false,
60 HttpAuthHandlerDigest::ALGORITHM_MD5, 60 HttpAuthHandlerDigest::ALGORITHM_MD5,
61 HttpAuthHandlerDigest::QOP_UNSPECIFIED 61 HttpAuthHandlerDigest::QOP_UNSPECIFIED
62 }, 62 },
63 63
64 { // Check that md5-sess is recognized, as is single QOP 64 { // Check that md5-sess is recognized, as is single QOP
65 "Digest nonce=\"xyz\", algorithm=\"md5-sess\", " 65 "Digest nonce=\"xyz\", algorithm=\"md5-sess\", "
66 "realm=\"Oblivion\", qop=\"auth\"", 66 "realm=\"Oblivion\", qop=\"auth\"",
67 true, 67 true,
68 "Oblivion", 68 "Oblivion",
69 "xyz", 69 "xyz",
70 "", 70 "",
71 "", 71 "",
72 false, 72 false,
73 HttpAuthHandlerDigest::ALGORITHM_MD5_SESS, 73 HttpAuthHandlerDigest::ALGORITHM_MD5_SESS,
74 HttpAuthHandlerDigest::QOP_AUTH 74 HttpAuthHandlerDigest::QOP_AUTH
75 }, 75 },
76 76
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 }; 251 };
252 GURL origin("http://www.example.com"); 252 GURL origin("http://www.example.com");
253 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 253 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
254 scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest; 254 scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest;
255 std::string challenge = tests[i].challenge; 255 std::string challenge = tests[i].challenge;
256 HttpAuth::ChallengeTokenizer tok(challenge.begin(), challenge.end()); 256 HttpAuth::ChallengeTokenizer tok(challenge.begin(), challenge.end());
257 EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin)); 257 EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin));
258 258
259 std::string creds = digest->AssembleCredentials(tests[i].req_method, 259 std::string creds = digest->AssembleCredentials(tests[i].req_method,
260 tests[i].req_path, tests[i].username, tests[i].password, 260 tests[i].req_path,
261 tests[i].cnonce, tests[i].nonce_count); 261 tests[i].username,
262 tests[i].password,
263 tests[i].cnonce,
264 tests[i].nonce_count);
262 265
263 EXPECT_STREQ(tests[i].expected_creds, creds.c_str()); 266 EXPECT_STREQ(tests[i].expected_creds, creds.c_str());
264 } 267 }
265 } 268 }
266 269
267 } // namespace net 270 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/http/http_auth_handler_ntlm_portable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698