| 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/dns/mojo_host_resolver_impl.h" | 5 #include "net/dns/mojo_host_resolver_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 new MojoHostResolverImpl(&mock_host_resolver_, BoundNetLog())); | 136 new MojoHostResolverImpl(&mock_host_resolver_, BoundNetLog())); |
| 137 } | 137 } |
| 138 | 138 |
| 139 interfaces::HostResolverRequestInfoPtr CreateRequest(const std::string& host, | 139 interfaces::HostResolverRequestInfoPtr CreateRequest(const std::string& host, |
| 140 uint16_t port, | 140 uint16_t port, |
| 141 bool is_my_ip_address) { | 141 bool is_my_ip_address) { |
| 142 interfaces::HostResolverRequestInfoPtr request = | 142 interfaces::HostResolverRequestInfoPtr request = |
| 143 interfaces::HostResolverRequestInfo::New(); | 143 interfaces::HostResolverRequestInfo::New(); |
| 144 request->host = host; | 144 request->host = host; |
| 145 request->port = port; | 145 request->port = port; |
| 146 request->address_family = interfaces::ADDRESS_FAMILY_IPV4; | 146 request->address_family = interfaces::AddressFamily::IPV4; |
| 147 request->is_my_ip_address = is_my_ip_address; | 147 request->is_my_ip_address = is_my_ip_address; |
| 148 return request; | 148 return request; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Wait until the mock resolver has received |num| resolve requests. | 151 // Wait until the mock resolver has received |num| resolve requests. |
| 152 void WaitForRequests(size_t num) { | 152 void WaitForRequests(size_t num) { |
| 153 while (mock_host_resolver_.num_resolve() < num) { | 153 while (mock_host_resolver_.num_resolve() < num) { |
| 154 base::RunLoop run_loop; | 154 base::RunLoop run_loop; |
| 155 mock_host_resolver_.SetResolveCallback(run_loop.QuitClosure()); | 155 mock_host_resolver_.SetResolveCallback(run_loop.QuitClosure()); |
| 156 run_loop.Run(); | 156 run_loop.Run(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 WaitForRequests(1); | 279 WaitForRequests(1); |
| 280 | 280 |
| 281 client.reset(); | 281 client.reset(); |
| 282 base::RunLoop().RunUntilIdle(); | 282 base::RunLoop().RunUntilIdle(); |
| 283 | 283 |
| 284 mock_host_resolver_.ResolveAllPending(); | 284 mock_host_resolver_.ResolveAllPending(); |
| 285 base::RunLoop().RunUntilIdle(); | 285 base::RunLoop().RunUntilIdle(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace net | 288 } // namespace net |
| OLD | NEW |