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/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 handlers_[target].push_back(base::WrapUnique(handler)); | 166 handlers_[target].push_back(base::WrapUnique(handler)); |
167 } | 167 } |
168 | 168 |
169 int HttpAuthHandlerMock::Factory::CreateAuthHandler( | 169 int HttpAuthHandlerMock::Factory::CreateAuthHandler( |
170 HttpAuthChallengeTokenizer* challenge, | 170 HttpAuthChallengeTokenizer* challenge, |
171 HttpAuth::Target target, | 171 HttpAuth::Target target, |
172 const SSLInfo& ssl_info, | 172 const SSLInfo& ssl_info, |
173 const GURL& origin, | 173 const GURL& origin, |
174 CreateReason reason, | 174 CreateReason reason, |
175 int nonce_count, | 175 int nonce_count, |
176 const BoundNetLog& net_log, | 176 const NetLogWithSource& net_log, |
177 std::unique_ptr<HttpAuthHandler>* handler) { | 177 std::unique_ptr<HttpAuthHandler>* handler) { |
178 if (handlers_[target].empty()) | 178 if (handlers_[target].empty()) |
179 return ERR_UNEXPECTED; | 179 return ERR_UNEXPECTED; |
180 std::unique_ptr<HttpAuthHandler> tmp_handler = | 180 std::unique_ptr<HttpAuthHandler> tmp_handler = |
181 std::move(handlers_[target][0]); | 181 std::move(handlers_[target][0]); |
182 std::vector<std::unique_ptr<HttpAuthHandler>>& handlers = handlers_[target]; | 182 std::vector<std::unique_ptr<HttpAuthHandler>>& handlers = handlers_[target]; |
183 handlers.erase(handlers.begin()); | 183 handlers.erase(handlers.begin()); |
184 if (do_init_from_challenge_ && | 184 if (do_init_from_challenge_ && |
185 !tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin, | 185 !tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin, |
186 net_log)) | 186 net_log)) |
187 return ERR_INVALID_RESPONSE; | 187 return ERR_INVALID_RESPONSE; |
188 handler->swap(tmp_handler); | 188 handler->swap(tmp_handler); |
189 return OK; | 189 return OK; |
190 } | 190 } |
191 | 191 |
192 } // namespace net | 192 } // namespace net |
OLD | NEW |