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

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

Issue 8863: Add some extra unit-tests to make sure we cover all permutations of {basic_au... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « net/http/http_auth_handler_basic_unittest.cc ('k') | no next file » | 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 1, // nc 150 1, // nc
151 151
152 // Authorization 152 // Authorization
153 "Digest username=\"foo bar\", realm=\"DRealm1\", " 153 "Digest username=\"foo bar\", realm=\"DRealm1\", "
154 "nonce=\"Ure30oRXBAA=7eca98bbf521ac6642820b11b86bd2d9ed7edc70\", " 154 "nonce=\"Ure30oRXBAA=7eca98bbf521ac6642820b11b86bd2d9ed7edc70\", "
155 "uri=\"/test/drealm1/\", algorithm=MD5, " 155 "uri=\"/test/drealm1/\", algorithm=MD5, "
156 "response=\"93c9c6d5930af3b0eb26c745e02b04a0\", " 156 "response=\"93c9c6d5930af3b0eb26c745e02b04a0\", "
157 "qop=auth, nc=00000001, cnonce=\"082c875dcb2ca740\"" 157 "qop=auth, nc=00000001, cnonce=\"082c875dcb2ca740\""
158 }, 158 },
159 159
160 { // MD5 with no username.
161 "GET",
162 "/test/drealm1/",
163
164 // Challenge
165 "Digest realm=\"DRealm1\", "
166 "nonce=\"7thGplhaBAA=41fb92453c49799cf353c8cd0aabee02d61a98a8\", "
167 "algorithm=MD5, qop=\"auth\"",
168
169 "", "pass", // Username/password
170 "6509bc74daed8263", // cnonce
171 1, // nc
172
173 // Authorization
174 "Digest username=\"\", realm=\"DRealm1\", "
175 "nonce=\"7thGplhaBAA=41fb92453c49799cf353c8cd0aabee02d61a98a8\", "
176 "uri=\"/test/drealm1/\", algorithm=MD5, "
177 "response=\"bc597110f41a62d07f8b70b6977fcb61\", "
178 "qop=auth, nc=00000001, cnonce=\"6509bc74daed8263\""
179 },
180
181 { // MD5 with no username and no password.
182 "GET",
183 "/test/drealm1/",
184
185 // Challenge
186 "Digest realm=\"DRealm1\", "
187 "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\", "
188 "algorithm=MD5, qop=\"auth\"",
189
190 "", "", // Username/password
191 "1522e61005789929", // cnonce
192 1, // nc
193
194 // Authorization
195 "Digest username=\"\", realm=\"DRealm1\", "
196 "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\", "
197 "uri=\"/test/drealm1/\", algorithm=MD5, "
198 "response=\"22cfa2b30cb500a9591c6d55ec5590a8\", "
199 "qop=auth, nc=00000001, cnonce=\"1522e61005789929\""
200 },
201
160 { // No algorithm, and no qop. 202 { // No algorithm, and no qop.
161 "GET", 203 "GET",
162 "/", 204 "/",
163 205
164 // Challenge 206 // Challenge
165 "Digest realm=\"Oblivion\", nonce=\"nonce-value\"", 207 "Digest realm=\"Oblivion\", nonce=\"nonce-value\"",
166 208
167 "FooBar", "pass", // Username/password 209 "FooBar", "pass", // Username/password
168 "", // cnonce 210 "", // cnonce
169 1, // nc 211 1, // nc
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 243
202 std::string creds = digest.AssembleCredentials(tests[i].req_method, 244 std::string creds = digest.AssembleCredentials(tests[i].req_method,
203 tests[i].req_path, tests[i].username, tests[i].password, 245 tests[i].req_path, tests[i].username, tests[i].password,
204 tests[i].cnonce, tests[i].nonce_count); 246 tests[i].cnonce, tests[i].nonce_count);
205 247
206 EXPECT_STREQ(tests[i].expected_creds, creds.c_str()); 248 EXPECT_STREQ(tests[i].expected_creds, creds.c_str());
207 } 249 }
208 } 250 }
209 251
210 } // namespace net 252 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_basic_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698