| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 | 7 |
| 8 #include "net/socket/ssl_test_util.h" | 8 #include "net/socket/ssl_test_util.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 LOG(INFO) << "Started on port " << port_str; | 259 LOG(INFO) << "Started on port " << port_str; |
| 260 return true; | 260 return true; |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) { | 263 bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) { |
| 264 // Verify that the webserver is actually started. | 264 // Verify that the webserver is actually started. |
| 265 // Otherwise tests can fail if they run faster than Python can start. | 265 // Otherwise tests can fail if they run faster than Python can start. |
| 266 net::AddressList addr; | 266 net::AddressList addr; |
| 267 scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver()); | 267 scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver()); |
| 268 net::HostResolver::RequestInfo info(host_name, port); | 268 net::HostResolver::RequestInfo info(host_name, port); |
| 269 int rv = resolver->Resolve(info, &addr, NULL, NULL); | 269 int rv = resolver->Resolve(NULL, info, &addr, NULL, NULL); |
| 270 if (rv != net::OK) | 270 if (rv != net::OK) |
| 271 return false; | 271 return false; |
| 272 | 272 |
| 273 net::TCPPinger pinger(addr); | 273 net::TCPPinger pinger(addr); |
| 274 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(connection_timeout_), | 274 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(connection_timeout_), |
| 275 connection_attempts_); | 275 connection_attempts_); |
| 276 return rv == net::OK; | 276 return rv == net::OK; |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool TestServerLauncher::WaitToFinish(int timeout_ms) { | 279 bool TestServerLauncher::WaitToFinish(int timeout_ms) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 "certificate to your trusted roots for this test to work. " | 376 "certificate to your trusted roots for this test to work. " |
| 377 "For more info visit:\n" | 377 "For more info visit:\n" |
| 378 "http://dev.chromium.org/developers/testing\n"; | 378 "http://dev.chromium.org/developers/testing\n"; |
| 379 return false; | 379 return false; |
| 380 } | 380 } |
| 381 #endif | 381 #endif |
| 382 return true; | 382 return true; |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace net | 385 } // namespace net |
| OLD | NEW |