OLD | NEW |
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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 "", | 344 "", |
345 false, | 345 false, |
346 HttpAuthHandlerDigest::ALGORITHM_UNSPECIFIED, | 346 HttpAuthHandlerDigest::ALGORITHM_UNSPECIFIED, |
347 HttpAuthHandlerDigest::QOP_UNSPECIFIED | 347 HttpAuthHandlerDigest::QOP_UNSPECIFIED |
348 }, | 348 }, |
349 }; | 349 }; |
350 | 350 |
351 GURL origin("http://www.example.com"); | 351 GURL origin("http://www.example.com"); |
352 scoped_ptr<HttpAuthHandlerDigest::Factory> factory( | 352 scoped_ptr<HttpAuthHandlerDigest::Factory> factory( |
353 new HttpAuthHandlerDigest::Factory()); | 353 new HttpAuthHandlerDigest::Factory()); |
354 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 354 for (size_t i = 0; i < arraysize(tests); ++i) { |
355 scoped_ptr<HttpAuthHandler> handler; | 355 scoped_ptr<HttpAuthHandler> handler; |
356 int rv = factory->CreateAuthHandlerFromString(tests[i].challenge, | 356 int rv = factory->CreateAuthHandlerFromString(tests[i].challenge, |
357 HttpAuth::AUTH_SERVER, | 357 HttpAuth::AUTH_SERVER, |
358 origin, | 358 origin, |
359 BoundNetLog(), | 359 BoundNetLog(), |
360 &handler); | 360 &handler); |
361 if (tests[i].parsed_success) { | 361 if (tests[i].parsed_success) { |
362 EXPECT_EQ(OK, rv); | 362 EXPECT_EQ(OK, rv); |
363 } else { | 363 } else { |
364 EXPECT_NE(OK, rv); | 364 EXPECT_NE(OK, rv); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // Authorization | 509 // Authorization |
510 "Digest username=\"USER\", realm=\"Baztastic\", " | 510 "Digest username=\"USER\", realm=\"Baztastic\", " |
511 "nonce=\"AAAAAAAA\", uri=\"/\", algorithm=MD5-sess, " | 511 "nonce=\"AAAAAAAA\", uri=\"/\", algorithm=MD5-sess, " |
512 "response=\"cbc1139821ee7192069580570c541a03\", " | 512 "response=\"cbc1139821ee7192069580570c541a03\", " |
513 "qop=auth, nc=00000001, cnonce=\"15c07961ed8575c4\"" | 513 "qop=auth, nc=00000001, cnonce=\"15c07961ed8575c4\"" |
514 } | 514 } |
515 }; | 515 }; |
516 GURL origin("http://www.example.com"); | 516 GURL origin("http://www.example.com"); |
517 scoped_ptr<HttpAuthHandlerDigest::Factory> factory( | 517 scoped_ptr<HttpAuthHandlerDigest::Factory> factory( |
518 new HttpAuthHandlerDigest::Factory()); | 518 new HttpAuthHandlerDigest::Factory()); |
519 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 519 for (size_t i = 0; i < arraysize(tests); ++i) { |
520 scoped_ptr<HttpAuthHandler> handler; | 520 scoped_ptr<HttpAuthHandler> handler; |
521 int rv = factory->CreateAuthHandlerFromString(tests[i].challenge, | 521 int rv = factory->CreateAuthHandlerFromString(tests[i].challenge, |
522 HttpAuth::AUTH_SERVER, | 522 HttpAuth::AUTH_SERVER, |
523 origin, | 523 origin, |
524 BoundNetLog(), | 524 BoundNetLog(), |
525 &handler); | 525 &handler); |
526 EXPECT_EQ(OK, rv); | 526 EXPECT_EQ(OK, rv); |
527 ASSERT_TRUE(handler != NULL); | 527 ASSERT_TRUE(handler != NULL); |
528 | 528 |
529 HttpAuthHandlerDigest* digest = | 529 HttpAuthHandlerDigest* digest = |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " | 689 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " |
690 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " | 690 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " |
691 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", " | 691 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", " |
692 "opaque=\"opaque text\", " | 692 "opaque=\"opaque text\", " |
693 "qop=auth, nc=00000001, cnonce=\"client_nonce\"", | 693 "qop=auth, nc=00000001, cnonce=\"client_nonce\"", |
694 auth_token); | 694 auth_token); |
695 } | 695 } |
696 | 696 |
697 | 697 |
698 } // namespace net | 698 } // namespace net |
OLD | NEW |