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 "net/http/http_auth_handler_mock.h" | 5 #include "net/http/http_auth_handler_mock.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 generate_async_ = async; | 76 generate_async_ = async; |
77 generate_rv_ = rv; | 77 generate_rv_ = rv; |
78 } | 78 } |
79 | 79 |
80 HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge( | 80 HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge( |
81 HttpAuthChallengeTokenizer* challenge) { | 81 HttpAuthChallengeTokenizer* challenge) { |
82 // If we receive an empty challenge for a connection based scheme, or a second | 82 // If we receive an empty challenge for a connection based scheme, or a second |
83 // challenge for a non connection based scheme, assume it's a rejection. | 83 // challenge for a non connection based scheme, assume it's a rejection. |
84 if (!is_connection_based() || challenge->base64_param().empty()) | 84 if (!is_connection_based() || challenge->base64_param().empty()) |
85 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 85 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
86 if (!LowerCaseEqualsASCII(challenge->scheme(), "mock")) | 86 if (!base::LowerCaseEqualsASCII(challenge->scheme(), "mock")) |
87 return HttpAuth::AUTHORIZATION_RESULT_INVALID; | 87 return HttpAuth::AUTHORIZATION_RESULT_INVALID; |
88 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; | 88 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; |
89 } | 89 } |
90 | 90 |
91 bool HttpAuthHandlerMock::NeedsIdentity() { | 91 bool HttpAuthHandlerMock::NeedsIdentity() { |
92 return first_round_; | 92 return first_round_; |
93 } | 93 } |
94 | 94 |
95 bool HttpAuthHandlerMock::AllowsDefaultCredentials() { | 95 bool HttpAuthHandlerMock::AllowsDefaultCredentials() { |
96 return allows_default_credentials_; | 96 return allows_default_credentials_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 std::vector<HttpAuthHandler*>& handlers = handlers_[target].get(); | 178 std::vector<HttpAuthHandler*>& handlers = handlers_[target].get(); |
179 handlers.erase(handlers.begin()); | 179 handlers.erase(handlers.begin()); |
180 if (do_init_from_challenge_ && | 180 if (do_init_from_challenge_ && |
181 !tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 181 !tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
182 return ERR_INVALID_RESPONSE; | 182 return ERR_INVALID_RESPONSE; |
183 handler->swap(tmp_handler); | 183 handler->swap(tmp_handler); |
184 return OK; | 184 return OK; |
185 } | 185 } |
186 | 186 |
187 } // namespace net | 187 } // namespace net |
OLD | NEW |