OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/http/http_request_info.h" | 10 #include "net/http/http_request_info.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 return rv; | 66 return rv; |
67 } | 67 } |
68 | 68 |
69 void HttpAuthHandlerMock::SetGenerateExpectation(bool async, int rv) { | 69 void HttpAuthHandlerMock::SetGenerateExpectation(bool async, int rv) { |
70 generate_async_ = async; | 70 generate_async_ = async; |
71 generate_rv_ = rv; | 71 generate_rv_ = rv; |
72 } | 72 } |
73 | 73 |
74 bool HttpAuthHandlerMock::Init(HttpAuth::ChallengeTokenizer* challenge) { | 74 bool HttpAuthHandlerMock::Init(HttpAuth::ChallengeTokenizer* challenge) { |
75 auth_scheme_ = AUTH_SCHEME_BASIC; | 75 auth_scheme_ = HttpAuth::AUTH_SCHEME_MOCK; |
76 scheme_ = "mock"; | |
77 score_ = 1; | 76 score_ = 1; |
78 properties_ = connection_based_ ? IS_CONNECTION_BASED : 0; | 77 properties_ = connection_based_ ? IS_CONNECTION_BASED : 0; |
79 return true; | 78 return true; |
80 } | 79 } |
81 | 80 |
82 HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge( | 81 HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge( |
83 HttpAuth::ChallengeTokenizer* challenge) { | 82 HttpAuth::ChallengeTokenizer* challenge) { |
84 if (!is_connection_based()) | 83 if (!is_connection_based()) |
85 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 84 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
86 if (!LowerCaseEqualsASCII(challenge->scheme(), "mock")) | 85 if (!LowerCaseEqualsASCII(challenge->scheme(), "mock")) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return ERR_UNEXPECTED; | 156 return ERR_UNEXPECTED; |
158 scoped_ptr<HttpAuthHandler> tmp_handler(handlers_[target].release()); | 157 scoped_ptr<HttpAuthHandler> tmp_handler(handlers_[target].release()); |
159 if (do_init_from_challenge_ && | 158 if (do_init_from_challenge_ && |
160 !tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 159 !tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
161 return ERR_INVALID_RESPONSE; | 160 return ERR_INVALID_RESPONSE; |
162 handler->swap(tmp_handler); | 161 handler->swap(tmp_handler); |
163 return OK; | 162 return OK; |
164 } | 163 } |
165 | 164 |
166 } // namespace net | 165 } // namespace net |
OLD | NEW |