| Index: net/http/http_auth_handler_mock.cc
|
| diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc
|
| index f800c192ac4060e12695b8cbb5cd22e3a17daee2..b879efe8db23e350c518fea6a5adcd93928a53fb 100644
|
| --- a/net/http/http_auth_handler_mock.cc
|
| +++ b/net/http/http_auth_handler_mock.cc
|
| @@ -17,16 +17,7 @@
|
| namespace net {
|
|
|
| HttpAuthHandlerMock::HttpAuthHandlerMock()
|
| - : resolve_(RESOLVE_INIT),
|
| - generate_async_(false),
|
| - generate_rv_(OK),
|
| - auth_token_(NULL),
|
| - first_round_(true),
|
| - connection_based_(false),
|
| - allows_default_credentials_(false),
|
| - allows_explicit_credentials_(true),
|
| - weak_factory_(this) {
|
| -}
|
| + : generate_rv_(OK), weak_factory_(this) {}
|
|
|
| HttpAuthHandlerMock::~HttpAuthHandlerMock() {
|
| }
|
| @@ -80,11 +71,12 @@ void HttpAuthHandlerMock::SetGenerateExpectation(bool async, int rv) {
|
|
|
| HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge(
|
| HttpAuthChallengeTokenizer* challenge) {
|
| - // If we receive an empty challenge for a connection based scheme, or a second
|
| - // challenge for a non connection based scheme, assume it's a rejection.
|
| - if (!is_connection_based() || challenge->base64_param().empty())
|
| + // If we receive a second challenge for a regular scheme, assume it's a
|
| + // rejection. Receiving an empty second challenge when expecting multiple
|
| + // rounds is also considered a rejection.
|
| + if (!expect_multiple_challenges() || challenge->base64_param().empty())
|
| return HttpAuth::AUTHORIZATION_RESULT_REJECT;
|
| - if (!base::LowerCaseEqualsASCII(challenge->scheme(), "mock"))
|
| + if (!challenge->SchemeIs("mock"))
|
| return HttpAuth::AUTHORIZATION_RESULT_INVALID;
|
| return HttpAuth::AUTHORIZATION_RESULT_ACCEPT;
|
| }
|
| @@ -102,9 +94,7 @@ bool HttpAuthHandlerMock::AllowsExplicitCredentials() {
|
| }
|
|
|
| bool HttpAuthHandlerMock::Init(HttpAuthChallengeTokenizer* challenge) {
|
| - auth_scheme_ = HttpAuth::AUTH_SCHEME_MOCK;
|
| - score_ = 1;
|
| - properties_ = connection_based_ ? IS_CONNECTION_BASED : 0;
|
| + auth_scheme_ = "mock";
|
| return true;
|
| }
|
|
|
| @@ -164,6 +154,11 @@ void HttpAuthHandlerMock::Factory::AddMockHandler(
|
| handlers_[target].push_back(handler);
|
| }
|
|
|
| +bool HttpAuthHandlerMock::Factory::HaveAuthHandlers(
|
| + HttpAuth::Target target) const {
|
| + return !handlers_[target].empty();
|
| +}
|
| +
|
| int HttpAuthHandlerMock::Factory::CreateAuthHandler(
|
| HttpAuthChallengeTokenizer* challenge,
|
| HttpAuth::Target target,
|
|
|