Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: net/http/http_auth_handler_mock.cc

Issue 1520253002: Remove ScopedVector from http_auth_handler_mock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 HttpAuthHandlerMock::Factory::Factory() 154 HttpAuthHandlerMock::Factory::Factory()
155 : do_init_from_challenge_(false) { 155 : do_init_from_challenge_(false) {
156 // TODO(cbentzel): Default do_init_from_challenge_ to true. 156 // TODO(cbentzel): Default do_init_from_challenge_ to true.
157 } 157 }
158 158
159 HttpAuthHandlerMock::Factory::~Factory() { 159 HttpAuthHandlerMock::Factory::~Factory() {
160 } 160 }
161 161
162 void HttpAuthHandlerMock::Factory::AddMockHandler( 162 void HttpAuthHandlerMock::Factory::AddMockHandler(
163 HttpAuthHandler* handler, HttpAuth::Target target) { 163 HttpAuthHandler* handler, HttpAuth::Target target) {
164 handlers_[target].push_back(handler); 164 handlers_[target].push_back(make_scoped_ptr(handler));
165 } 165 }
166 166
167 int HttpAuthHandlerMock::Factory::CreateAuthHandler( 167 int HttpAuthHandlerMock::Factory::CreateAuthHandler(
168 HttpAuthChallengeTokenizer* challenge, 168 HttpAuthChallengeTokenizer* challenge,
169 HttpAuth::Target target, 169 HttpAuth::Target target,
170 const GURL& origin, 170 const GURL& origin,
171 CreateReason reason, 171 CreateReason reason,
172 int nonce_count, 172 int nonce_count,
173 const BoundNetLog& net_log, 173 const BoundNetLog& net_log,
174 scoped_ptr<HttpAuthHandler>* handler) { 174 scoped_ptr<HttpAuthHandler>* handler) {
175 if (handlers_[target].empty()) 175 if (handlers_[target].empty())
176 return ERR_UNEXPECTED; 176 return ERR_UNEXPECTED;
177 scoped_ptr<HttpAuthHandler> tmp_handler(handlers_[target][0]); 177 scoped_ptr<HttpAuthHandler> tmp_handler = std::move(handlers_[target][0]);
178 std::vector<HttpAuthHandler*>& handlers = handlers_[target].get(); 178 std::vector<scoped_ptr<HttpAuthHandler>>& handlers = handlers_[target];
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
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698