From f9ee6b5a5925d8496f05309963c42bfdd3ec1a8b Mon Sep 17 00:00:00 2001 From: "ericroman@google.com" Date: Sat, 8 Nov 2008 06:46:23 +0000 Subject: - Add preemptive authorization (new http stack only) - Check for auth identity in URL (new http stack only) - Move auth cache logic out of url request job, and hide it in the url request ftp job and http transaction classes. Note: Somehow the original codereview thread got corrupted so it was recreated. The real review comments should be under (http://codereview.chromium.org/6481) Review URL: http://codereview.chromium.org/8231 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5064 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_auth_unittest.cc | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'net/http/http_auth_unittest.cc') diff --git a/net/http/http_auth_unittest.cc b/net/http/http_auth_unittest.cc index d0a2ace..d591501 100644 --- a/net/http/http_auth_unittest.cc +++ b/net/http/http_auth_unittest.cc @@ -4,7 +4,7 @@ #include "testing/gtest/include/gtest/gtest.h" -#include "base/scoped_ptr.h" +#include "base/ref_counted.h" #include "net/http/http_auth.h" #include "net/http/http_auth_handler.h" #include "net/http/http_response_headers.h" @@ -52,10 +52,12 @@ TEST(HttpAuthTest, ChooseBestChallenge) { headers_with_status_line.c_str(), headers_with_status_line.length()))); - scoped_ptr handler(HttpAuth::ChooseBestChallenge( - headers.get(), HttpAuth::AUTH_SERVER)); + scoped_refptr handler; + HttpAuth::ChooseBestChallenge(headers.get(), + HttpAuth::AUTH_SERVER, + &handler); - if (handler.get()) { + if (handler) { EXPECT_STREQ(tests[i].challenge_realm, handler->realm().c_str()); } else { EXPECT_STREQ("", tests[i].challenge_realm); @@ -157,24 +159,27 @@ TEST(HttpAuthTest, GetAuthorizationHeaderName) { TEST(HttpAuthTest, CreateAuthHandler) { { - scoped_ptr handler( - HttpAuth::CreateAuthHandler("Basic realm=\"FooBar\"", - HttpAuth::AUTH_SERVER)); + scoped_refptr handler; + HttpAuth::CreateAuthHandler("Basic realm=\"FooBar\"", + HttpAuth::AUTH_SERVER, + &handler); EXPECT_FALSE(handler.get() == NULL); EXPECT_STREQ("basic", handler->scheme().c_str()); EXPECT_STREQ("FooBar", handler->realm().c_str()); EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target()); } { - scoped_ptr handler( - HttpAuth::CreateAuthHandler("UNSUPPORTED realm=\"FooBar\"", - HttpAuth::AUTH_SERVER)); + scoped_refptr handler; + HttpAuth::CreateAuthHandler("UNSUPPORTED realm=\"FooBar\"", + HttpAuth::AUTH_SERVER, + &handler); EXPECT_TRUE(handler.get() == NULL); } { - scoped_ptr handler(HttpAuth::CreateAuthHandler( - "Digest realm=\"FooBar\", nonce=\"xyz\"", - HttpAuth::AUTH_PROXY)); + scoped_refptr handler; + HttpAuth::CreateAuthHandler("Digest realm=\"FooBar\", nonce=\"xyz\"", + HttpAuth::AUTH_PROXY, + &handler); EXPECT_FALSE(handler.get() == NULL); EXPECT_STREQ("digest", handler->scheme().c_str()); EXPECT_STREQ("FooBar", handler->realm().c_str()); -- cgit v1.1