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

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

Issue 10854139: Use HttpAuthController in SocketStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased and Skipped added browser test on chromeos Created 8 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
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/socket_stream/socket_stream.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) 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/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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 "http://proxy.intranet.corp.com:3128", 625 "http://proxy.intranet.corp.com:3128",
626 "https://www.example.com/path/to/resource", 626 "https://www.example.com/path/to/resource",
627 kSimpleChallenge, 627 kSimpleChallenge,
628 &auth_token)); 628 &auth_token));
629 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " 629 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", "
630 "nonce=\"nonce-value\", uri=\"www.example.com:443\", " 630 "nonce=\"nonce-value\", uri=\"www.example.com:443\", "
631 "response=\"3270da8467afbe9ddf2334a48d46e9b9\"", 631 "response=\"3270da8467afbe9ddf2334a48d46e9b9\"",
632 auth_token); 632 auth_token);
633 } 633 }
634 634
635 TEST(HttpAuthHandlerDigest, RespondToProxyChallengeWs) {
636 std::string auth_token;
637 EXPECT_TRUE(RespondToChallenge(
638 HttpAuth::AUTH_PROXY,
639 "http://proxy.intranet.corp.com:3128",
640 "ws://www.example.com/echo",
641 kSimpleChallenge,
642 &auth_token));
643 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", "
644 "nonce=\"nonce-value\", uri=\"www.example.com:80\", "
645 "response=\"aa1df184f68d5b6ab9d9aa4f88e41b4c\"",
646 auth_token);
647 }
648
649 TEST(HttpAuthHandlerDigest, RespondToProxyChallengeWss) {
650 std::string auth_token;
651 EXPECT_TRUE(RespondToChallenge(
652 HttpAuth::AUTH_PROXY,
653 "http://proxy.intranet.corp.com:3128",
654 "wss://www.example.com/echo",
655 kSimpleChallenge,
656 &auth_token));
657 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", "
658 "nonce=\"nonce-value\", uri=\"www.example.com:443\", "
659 "response=\"3270da8467afbe9ddf2334a48d46e9b9\"",
660 auth_token);
661 }
662
635 TEST(HttpAuthHandlerDigest, RespondToChallengeAuthQop) { 663 TEST(HttpAuthHandlerDigest, RespondToChallengeAuthQop) {
636 std::string auth_token; 664 std::string auth_token;
637 EXPECT_TRUE(RespondToChallenge( 665 EXPECT_TRUE(RespondToChallenge(
638 HttpAuth::AUTH_SERVER, 666 HttpAuth::AUTH_SERVER,
639 std::string(), 667 std::string(),
640 "http://www.example.com/path/to/resource", 668 "http://www.example.com/path/to/resource",
641 "Digest realm=\"Oblivion\", nonce=\"nonce-value\", qop=\"auth\"", 669 "Digest realm=\"Oblivion\", nonce=\"nonce-value\", qop=\"auth\"",
642 &auth_token)); 670 &auth_token));
643 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " 671 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", "
644 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " 672 "nonce=\"nonce-value\", uri=\"/path/to/resource\", "
(...skipping 14 matching lines...) Expand all
659 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " 687 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", "
660 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " 688 "nonce=\"nonce-value\", uri=\"/path/to/resource\", "
661 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", " 689 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", "
662 "opaque=\"opaque text\", " 690 "opaque=\"opaque text\", "
663 "qop=auth, nc=00000001, cnonce=\"client_nonce\"", 691 "qop=auth, nc=00000001, cnonce=\"client_nonce\"",
664 auth_token); 692 auth_token);
665 } 693 }
666 694
667 695
668 } // namespace net 696 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/socket_stream/socket_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698