OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 NOTREACHED(); | 229 NOTREACHED(); |
230 } | 230 } |
231 return std::string(); | 231 return std::string(); |
232 } | 232 } |
233 | 233 |
234 bool BaseTestServer::GetAddressList(AddressList* address_list) const { | 234 bool BaseTestServer::GetAddressList(AddressList* address_list) const { |
235 DCHECK(address_list); | 235 DCHECK(address_list); |
236 | 236 |
237 scoped_ptr<HostResolver> resolver(HostResolver::CreateDefaultResolver(NULL)); | 237 scoped_ptr<HostResolver> resolver(HostResolver::CreateDefaultResolver(NULL)); |
238 HostResolver::RequestInfo info(host_port_pair_); | 238 HostResolver::RequestInfo info(host_port_pair_); |
| 239 // Limit the lookup to IPv4. When started with the default |
| 240 // address of kLocalhost, testserver.py only supports IPv4. |
| 241 // If a custom hostname is used, it's possible that the test |
| 242 // server will listen on both IPv4 and IPv6, so this will |
| 243 // still work. The testserver does not support explicit |
| 244 // IPv6 literal hostnames. |
| 245 info.set_address_family(ADDRESS_FAMILY_IPV4); |
239 TestCompletionCallback callback; | 246 TestCompletionCallback callback; |
240 int rv = resolver->Resolve(info, | 247 int rv = resolver->Resolve(info, |
241 DEFAULT_PRIORITY, | 248 DEFAULT_PRIORITY, |
242 address_list, | 249 address_list, |
243 callback.callback(), | 250 callback.callback(), |
244 NULL, | 251 NULL, |
245 BoundNetLog()); | 252 BoundNetLog()); |
246 if (rv == ERR_IO_PENDING) | 253 if (rv == ERR_IO_PENDING) |
247 rv = callback.WaitForResult(); | 254 rv = callback.WaitForResult(); |
248 if (rv != OK) { | 255 if (rv != OK) { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 514 |
508 return GenerateAdditionalArguments(arguments); | 515 return GenerateAdditionalArguments(arguments); |
509 } | 516 } |
510 | 517 |
511 bool BaseTestServer::GenerateAdditionalArguments( | 518 bool BaseTestServer::GenerateAdditionalArguments( |
512 base::DictionaryValue* arguments) const { | 519 base::DictionaryValue* arguments) const { |
513 return true; | 520 return true; |
514 } | 521 } |
515 | 522 |
516 } // namespace net | 523 } // namespace net |
OLD | NEW |