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

Side by Side Diff: net/test/spawned_test_server/base_test_server.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke's comments and rebasing Created 4 years, 5 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/spawned_test_server/base_test_server.h" 5 #include "net/test/spawned_test_server/base_test_server.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 HostResolver::CreateDefaultResolver(NULL)); 270 HostResolver::CreateDefaultResolver(NULL));
271 HostResolver::RequestInfo info(host_port_pair_); 271 HostResolver::RequestInfo info(host_port_pair_);
272 // Limit the lookup to IPv4. When started with the default 272 // Limit the lookup to IPv4. When started with the default
273 // address of kLocalhost, testserver.py only supports IPv4. 273 // address of kLocalhost, testserver.py only supports IPv4.
274 // If a custom hostname is used, it's possible that the test 274 // If a custom hostname is used, it's possible that the test
275 // server will listen on both IPv4 and IPv6, so this will 275 // server will listen on both IPv4 and IPv6, so this will
276 // still work. The testserver does not support explicit 276 // still work. The testserver does not support explicit
277 // IPv6 literal hostnames. 277 // IPv6 literal hostnames.
278 info.set_address_family(ADDRESS_FAMILY_IPV4); 278 info.set_address_family(ADDRESS_FAMILY_IPV4);
279 TestCompletionCallback callback; 279 TestCompletionCallback callback;
280 int rv = resolver->Resolve(info, 280 std::unique_ptr<HostResolver::Request> request;
281 DEFAULT_PRIORITY, 281 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, address_list,
282 address_list, 282 callback.callback(), &request, BoundNetLog());
283 callback.callback(),
284 NULL,
285 BoundNetLog());
286 if (rv == ERR_IO_PENDING) 283 if (rv == ERR_IO_PENDING)
287 rv = callback.WaitForResult(); 284 rv = callback.WaitForResult();
288 if (rv != OK) { 285 if (rv != OK) {
289 LOG(ERROR) << "Failed to resolve hostname: " << host_port_pair_.host(); 286 LOG(ERROR) << "Failed to resolve hostname: " << host_port_pair_.host();
290 return false; 287 return false;
291 } 288 }
292 return true; 289 return true;
293 } 290 }
294 291
295 uint16_t BaseTestServer::GetPort() { 292 uint16_t BaseTestServer::GetPort() {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 583
587 return GenerateAdditionalArguments(arguments); 584 return GenerateAdditionalArguments(arguments);
588 } 585 }
589 586
590 bool BaseTestServer::GenerateAdditionalArguments( 587 bool BaseTestServer::GenerateAdditionalArguments(
591 base::DictionaryValue* arguments) const { 588 base::DictionaryValue* arguments) const {
592 return true; 589 return true;
593 } 590 }
594 591
595 } // namespace net 592 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698