| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mojo_proxy_resolver_impl.h" | 5 #include "net/proxy/mojo_proxy_resolver_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 std::vector<std::unique_ptr<Job>> pending_jobs_; | 163 std::vector<std::unique_ptr<Job>> pending_jobs_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 void MockProxyResolverV8Tracing::GetProxyForURL( | 166 void MockProxyResolverV8Tracing::GetProxyForURL( |
| 167 const GURL& url, | 167 const GURL& url, |
| 168 ProxyInfo* results, | 168 ProxyInfo* results, |
| 169 const CompletionCallback& callback, | 169 const CompletionCallback& callback, |
| 170 std::unique_ptr<ProxyResolver::Request>* request, | 170 std::unique_ptr<ProxyResolver::Request>* request, |
| 171 std::unique_ptr<Bindings> bindings) { | 171 std::unique_ptr<Bindings> bindings) { |
| 172 pending_jobs_.push_back(base::WrapUnique(new Job())); | 172 pending_jobs_.push_back(base::WrapUnique(new Job())); |
| 173 auto pending_job = pending_jobs_.back().get(); | 173 auto* pending_job = pending_jobs_.back().get(); |
| 174 pending_job->url = url; | 174 pending_job->url = url; |
| 175 pending_job->results = results; | 175 pending_job->results = results; |
| 176 pending_job->SetCallback(callback); | 176 pending_job->SetCallback(callback); |
| 177 request->reset(new RequestImpl(pending_job, this)); | 177 request->reset(new RequestImpl(pending_job, this)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 | 180 |
| 181 void MockProxyResolverV8Tracing::WaitForCancel() { | 181 void MockProxyResolverV8Tracing::WaitForCancel() { |
| 182 while (std::find_if(pending_jobs_.begin(), pending_jobs_.end(), | 182 while (std::find_if(pending_jobs_.begin(), pending_jobs_.end(), |
| 183 [](const std::unique_ptr<Job>& job) { | 183 [](const std::unique_ptr<Job>& job) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 interfaces::ProxyResolverRequestClientPtr client_ptr; | 333 interfaces::ProxyResolverRequestClientPtr client_ptr; |
| 334 TestRequestClient client(mojo::MakeRequest(&client_ptr)); | 334 TestRequestClient client(mojo::MakeRequest(&client_ptr)); |
| 335 | 335 |
| 336 resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); | 336 resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); |
| 337 ASSERT_EQ(1u, mock_proxy_resolver_->pending_jobs().size()); | 337 ASSERT_EQ(1u, mock_proxy_resolver_->pending_jobs().size()); |
| 338 resolver_impl_.reset(); | 338 resolver_impl_.reset(); |
| 339 client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); | 339 client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace net | 342 } // namespace net |
| OLD | NEW |