| 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/proxy/mock_proxy_resolver.h" | 5 #include "net/proxy/mock_proxy_resolver.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // May delete |this|. | 23 // May delete |this|. |
| 24 resolver_->RemovePendingRequest(this); | 24 resolver_->RemovePendingRequest(this); |
| 25 | 25 |
| 26 callback.Run(rv); | 26 callback.Run(rv); |
| 27 } | 27 } |
| 28 | 28 |
| 29 MockAsyncProxyResolver::Request::~Request() {} | 29 MockAsyncProxyResolver::Request::~Request() {} |
| 30 | 30 |
| 31 MockAsyncProxyResolver::~MockAsyncProxyResolver() {} | 31 MockAsyncProxyResolver::~MockAsyncProxyResolver() {} |
| 32 | 32 |
| 33 int MockAsyncProxyResolver::GetProxyForURL(const GURL& url, | 33 int MockAsyncProxyResolver::GetProxyForURL( |
| 34 ProxyInfo* results, | 34 const GURL& url, |
| 35 const CompletionCallback& callback, | 35 ProxyInfo* results, |
| 36 RequestHandle* request_handle, | 36 const CompletionCallback& callback, |
| 37 const BoundNetLog& /*net_log*/) { | 37 RequestHandle* request_handle, |
| 38 const NetLogWithSource& /*net_log*/) { |
| 38 scoped_refptr<Request> request = new Request(this, url, results, callback); | 39 scoped_refptr<Request> request = new Request(this, url, results, callback); |
| 39 pending_requests_.push_back(request); | 40 pending_requests_.push_back(request); |
| 40 | 41 |
| 41 if (request_handle) | 42 if (request_handle) |
| 42 *request_handle = reinterpret_cast<RequestHandle>(request.get()); | 43 *request_handle = reinterpret_cast<RequestHandle>(request.get()); |
| 43 | 44 |
| 44 // Test code completes the request by calling request->CompleteNow(). | 45 // Test code completes the request by calling request->CompleteNow(). |
| 45 return ERR_IO_PENDING; | 46 return ERR_IO_PENDING; |
| 46 } | 47 } |
| 47 | 48 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 154 } |
| 154 | 155 |
| 155 ForwardingProxyResolver::ForwardingProxyResolver(ProxyResolver* impl) | 156 ForwardingProxyResolver::ForwardingProxyResolver(ProxyResolver* impl) |
| 156 : impl_(impl) { | 157 : impl_(impl) { |
| 157 } | 158 } |
| 158 | 159 |
| 159 int ForwardingProxyResolver::GetProxyForURL(const GURL& query_url, | 160 int ForwardingProxyResolver::GetProxyForURL(const GURL& query_url, |
| 160 ProxyInfo* results, | 161 ProxyInfo* results, |
| 161 const CompletionCallback& callback, | 162 const CompletionCallback& callback, |
| 162 RequestHandle* request, | 163 RequestHandle* request, |
| 163 const BoundNetLog& net_log) { | 164 const NetLogWithSource& net_log) { |
| 164 return impl_->GetProxyForURL(query_url, results, callback, request, net_log); | 165 return impl_->GetProxyForURL(query_url, results, callback, request, net_log); |
| 165 } | 166 } |
| 166 | 167 |
| 167 void ForwardingProxyResolver::CancelRequest(RequestHandle request) { | 168 void ForwardingProxyResolver::CancelRequest(RequestHandle request) { |
| 168 impl_->CancelRequest(request); | 169 impl_->CancelRequest(request); |
| 169 } | 170 } |
| 170 | 171 |
| 171 LoadState ForwardingProxyResolver::GetLoadState(RequestHandle request) const { | 172 LoadState ForwardingProxyResolver::GetLoadState(RequestHandle request) const { |
| 172 return impl_->GetLoadState(request); | 173 return impl_->GetLoadState(request); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace net | 176 } // namespace net |
| OLD | NEW |