OLD | NEW |
1 // Copyright (c) 2009 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" |
11 | 11 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 // static | 130 // static |
131 const char TestServerLauncher::kHostName[] = "127.0.0.1"; | 131 const char TestServerLauncher::kHostName[] = "127.0.0.1"; |
132 const char TestServerLauncher::kMismatchedHostName[] = "localhost"; | 132 const char TestServerLauncher::kMismatchedHostName[] = "localhost"; |
133 const int TestServerLauncher::kOKHTTPSPort = 9443; | 133 const int TestServerLauncher::kOKHTTPSPort = 9443; |
134 const int TestServerLauncher::kBadHTTPSPort = 9666; | 134 const int TestServerLauncher::kBadHTTPSPort = 9666; |
135 | 135 |
136 // The issuer name of the cert that should be trusted for the test to work. | 136 // The issuer name of the cert that should be trusted for the test to work. |
137 const wchar_t TestServerLauncher::kCertIssuerName[] = L"Test CA"; | 137 const wchar_t TestServerLauncher::kCertIssuerName[] = L"Test CA"; |
138 | 138 |
139 TestServerLauncher::TestServerLauncher() : process_handle_(0), | 139 TestServerLauncher::TestServerLauncher() : process_handle_(NULL), |
140 forking_(false), | 140 forking_(false), |
141 connection_attempts_(10), | 141 connection_attempts_(10), |
142 connection_timeout_(1000) | 142 connection_timeout_(1000) |
143 #if defined(OS_LINUX) | 143 #if defined(OS_LINUX) |
144 , cert_(NULL) | 144 , cert_(NULL) |
145 #endif | 145 #endif |
146 { | 146 { |
147 InitCertPath(); | 147 InitCertPath(); |
148 } | 148 } |
149 | 149 |
150 TestServerLauncher::TestServerLauncher(int connection_attempts, | 150 TestServerLauncher::TestServerLauncher(int connection_attempts, |
151 int connection_timeout) | 151 int connection_timeout) |
152 : process_handle_(0), | 152 : process_handle_(NULL), |
153 forking_(false), | 153 forking_(false), |
154 connection_attempts_(connection_attempts), | 154 connection_attempts_(connection_attempts), |
155 connection_timeout_(connection_timeout) | 155 connection_timeout_(connection_timeout) |
156 #if defined(OS_LINUX) | 156 #if defined(OS_LINUX) |
157 , cert_(NULL) | 157 , cert_(NULL) |
158 #endif | 158 #endif |
159 { | 159 { |
160 InitCertPath(); | 160 InitCertPath(); |
161 } | 161 } |
162 | 162 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return rv == net::OK; | 324 return rv == net::OK; |
325 } | 325 } |
326 | 326 |
327 bool TestServerLauncher::WaitToFinish(int timeout_ms) { | 327 bool TestServerLauncher::WaitToFinish(int timeout_ms) { |
328 if (!process_handle_) | 328 if (!process_handle_) |
329 return true; | 329 return true; |
330 | 330 |
331 bool ret = base::WaitForSingleProcess(process_handle_, timeout_ms); | 331 bool ret = base::WaitForSingleProcess(process_handle_, timeout_ms); |
332 if (ret) { | 332 if (ret) { |
333 base::CloseProcessHandle(process_handle_); | 333 base::CloseProcessHandle(process_handle_); |
334 process_handle_ = 0; | 334 process_handle_ = NULL; |
335 LOG(INFO) << "Finished."; | 335 LOG(INFO) << "Finished."; |
336 } else { | 336 } else { |
337 LOG(INFO) << "Timed out."; | 337 LOG(INFO) << "Timed out."; |
338 } | 338 } |
339 return ret; | 339 return ret; |
340 } | 340 } |
341 | 341 |
342 bool TestServerLauncher::Stop() { | 342 bool TestServerLauncher::Stop() { |
343 if (!process_handle_) | 343 if (!process_handle_) |
344 return true; | 344 return true; |
345 | 345 |
346 bool ret = base::KillProcess(process_handle_, 1, true); | 346 bool ret = base::KillProcess(process_handle_, 1, true); |
347 if (ret) { | 347 if (ret) { |
348 base::CloseProcessHandle(process_handle_); | 348 base::CloseProcessHandle(process_handle_); |
349 process_handle_ = 0; | 349 process_handle_ = NULL; |
350 LOG(INFO) << "Stopped."; | 350 LOG(INFO) << "Stopped."; |
351 } else { | 351 } else { |
352 LOG(INFO) << "Kill failed?"; | 352 LOG(INFO) << "Kill failed?"; |
353 } | 353 } |
354 | 354 |
355 return ret; | 355 return ret; |
356 } | 356 } |
357 | 357 |
358 TestServerLauncher::~TestServerLauncher() { | 358 TestServerLauncher::~TestServerLauncher() { |
359 #if defined(OS_LINUX) | 359 #if defined(OS_LINUX) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 "certificate to your trusted roots for this test to work. " | 432 "certificate to your trusted roots for this test to work. " |
433 "For more info visit:\n" | 433 "For more info visit:\n" |
434 "http://dev.chromium.org/developers/testing\n"; | 434 "http://dev.chromium.org/developers/testing\n"; |
435 return false; | 435 return false; |
436 } | 436 } |
437 #endif | 437 #endif |
438 return true; | 438 return true; |
439 } | 439 } |
440 | 440 |
441 } // namespace net | 441 } // namespace net |
OLD | NEW |