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

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: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr Created 4 years, 4 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 HostResolver::CreateDefaultResolver(NULL)); 345 HostResolver::CreateDefaultResolver(NULL));
346 HostResolver::RequestInfo info(host_port_pair_); 346 HostResolver::RequestInfo info(host_port_pair_);
347 // Limit the lookup to IPv4. When started with the default 347 // Limit the lookup to IPv4. When started with the default
348 // address of kLocalhost, testserver.py only supports IPv4. 348 // address of kLocalhost, testserver.py only supports IPv4.
349 // If a custom hostname is used, it's possible that the test 349 // If a custom hostname is used, it's possible that the test
350 // server will listen on both IPv4 and IPv6, so this will 350 // server will listen on both IPv4 and IPv6, so this will
351 // still work. The testserver does not support explicit 351 // still work. The testserver does not support explicit
352 // IPv6 literal hostnames. 352 // IPv6 literal hostnames.
353 info.set_address_family(ADDRESS_FAMILY_IPV4); 353 info.set_address_family(ADDRESS_FAMILY_IPV4);
354 TestCompletionCallback callback; 354 TestCompletionCallback callback;
355 int rv = resolver->Resolve(info, 355 std::unique_ptr<HostResolver::Request> request;
356 DEFAULT_PRIORITY, 356 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, address_list,
357 address_list, 357 callback.callback(), &request, BoundNetLog());
358 callback.callback(),
359 NULL,
360 BoundNetLog());
361 if (rv == ERR_IO_PENDING) 358 if (rv == ERR_IO_PENDING)
362 rv = callback.WaitForResult(); 359 rv = callback.WaitForResult();
363 if (rv != OK) { 360 if (rv != OK) {
364 LOG(ERROR) << "Failed to resolve hostname: " << host_port_pair_.host(); 361 LOG(ERROR) << "Failed to resolve hostname: " << host_port_pair_.host();
365 return false; 362 return false;
366 } 363 }
367 return true; 364 return true;
368 } 365 }
369 366
370 uint16_t BaseTestServer::GetPort() { 367 uint16_t BaseTestServer::GetPort() {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 666
670 return GenerateAdditionalArguments(arguments); 667 return GenerateAdditionalArguments(arguments);
671 } 668 }
672 669
673 bool BaseTestServer::GenerateAdditionalArguments( 670 bool BaseTestServer::GenerateAdditionalArguments(
674 base::DictionaryValue* arguments) const { 671 base::DictionaryValue* arguments) const {
675 return true; 672 return true;
676 } 673 }
677 674
678 } // namespace net 675 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698