diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-15 14:25:50 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-15 14:25:50 +0000 |
commit | fa55e1931013409ddbce59ed39f8b12a351fd0c4 (patch) | |
tree | 1ff77c48d22f36173c1fa63ae8acb1faf896aa0d /net/http/http_auth_handler_digest_unittest.cc | |
parent | e8da0a0066695284dbf698c9900617b3b159f33b (diff) | |
download | chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.zip chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.gz chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.bz2 |
Added factories for HttpAuthHandler.
The driving rationale for this change was to prevent choosing an AuthHandler when it
is not supported on the system due to a missing runtime component (such as not being
able to locate a gssapi shared library when seeing a Negotiate scheme).
It also has the advantage (currently unused) of determining some per-auth-scheme properties
only the first time that a challenge for that scheme is seen (such as maximum token length for
the SSPI implementation of NTLM).
Finally, it may make unit tests easier to generate since the factory can be easily mocked.
BUG=34795
TEST=New unit test for HttpAuthHandlerDispatchFactory.
Review URL: http://codereview.chromium.org/582007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_digest_unittest.cc')
-rw-r--r-- | net/http/http_auth_handler_digest_unittest.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc index eb5649b..e75ada4 100644 --- a/net/http/http_auth_handler_digest_unittest.cc +++ b/net/http/http_auth_handler_digest_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -104,7 +104,8 @@ TEST(HttpAuthHandlerDigestTest, ParseChallenge) { std::string challenge(tests[i].challenge); scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest; - bool ok = digest->ParseChallenge(challenge.begin(), challenge.end()); + HttpAuth::ChallengeTokenizer tok(challenge.begin(), challenge.end()); + bool ok = digest->ParseChallenge(&tok); EXPECT_EQ(tests[i].parsed_success, ok); EXPECT_STREQ(tests[i].parsed_realm, digest->realm_.c_str()); @@ -252,8 +253,8 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest; std::string challenge = tests[i].challenge; - EXPECT_TRUE(digest->InitFromChallenge( - challenge.begin(), challenge.end(), HttpAuth::AUTH_SERVER, origin)); + HttpAuth::ChallengeTokenizer tok(challenge.begin(), challenge.end()); + EXPECT_TRUE(digest->InitFromChallenge(&tok, HttpAuth::AUTH_SERVER, origin)); std::string creds = digest->AssembleCredentials(tests[i].req_method, tests[i].req_path, tests[i].username, tests[i].password, |