| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 LOG(ERROR) << "Could not SetInformationJobObject."; | 406 LOG(ERROR) << "Could not SetInformationJobObject."; |
| 407 return false; | 407 return false; |
| 408 } | 408 } |
| 409 | 409 |
| 410 options.inherit_handles = true; | 410 options.inherit_handles = true; |
| 411 options.job_handle = job_handle_.Get(); | 411 options.job_handle = job_handle_.Get(); |
| 412 #endif | 412 #endif |
| 413 | 413 |
| 414 // Launch a new WebSocket server process. | 414 // Launch a new WebSocket server process. |
| 415 if (!base::LaunchProcess(*cmd_line.get(), options, &process_handle)) { | 415 if (!base::LaunchProcess(*cmd_line.get(), options, &process_handle)) { |
| 416 LOG(ERROR) << "Unable to launch websocket server."; | 416 LOG(ERROR) << "Unable to launch websocket server:\n" |
| 417 << cmd_line.get()->GetCommandLineString(); |
| 417 return false; | 418 return false; |
| 418 } | 419 } |
| 419 #if defined(OS_POSIX) | 420 #if defined(OS_POSIX) |
| 420 process_group_id_ = process_handle; | 421 process_group_id_ = process_handle; |
| 421 #endif | 422 #endif |
| 422 int exit_code; | 423 int exit_code; |
| 423 bool wait_success = base::WaitForExitCodeWithTimeout( | 424 bool wait_success = base::WaitForExitCodeWithTimeout( |
| 424 process_handle, | 425 process_handle, |
| 425 &exit_code, | 426 &exit_code, |
| 426 TestTimeouts::action_max_timeout()); | 427 TestTimeouts::action_max_timeout()); |
| 427 base::CloseProcessHandle(process_handle); | 428 base::CloseProcessHandle(process_handle); |
| 428 | 429 |
| 429 if (!wait_success || exit_code != 0) { | 430 if (!wait_success || exit_code != 0) { |
| 430 LOG(ERROR) << "Failed to run new-run-webkit-websocketserver: " | 431 LOG(ERROR) << "Failed to run new-run-webkit-websocketserver: " |
| 431 << "wait_success = " << wait_success << ", " | 432 << "wait_success = " << wait_success << ", " |
| 432 << "exit_code = " << exit_code; | 433 << "exit_code = " << exit_code << ", " |
| 434 << "command_line = " << cmd_line.get()->GetCommandLineString(); |
| 433 return false; | 435 return false; |
| 434 } | 436 } |
| 435 | 437 |
| 436 started_ = true; | 438 started_ = true; |
| 437 return true; | 439 return true; |
| 438 } | 440 } |
| 439 | 441 |
| 440 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { | 442 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { |
| 441 // Note: Python's first argument must be the script; do not append CommandLine | 443 // Note: Python's first argument must be the script; do not append CommandLine |
| 442 // switches, as they would precede the script path and break this CommandLine. | 444 // switches, as they would precede the script path and break this CommandLine. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 base::LaunchProcess(*cmd_line.get(), options, NULL); | 490 base::LaunchProcess(*cmd_line.get(), options, NULL); |
| 489 | 491 |
| 490 #if defined(OS_POSIX) | 492 #if defined(OS_POSIX) |
| 491 // Just to make sure that the server process terminates certainly. | 493 // Just to make sure that the server process terminates certainly. |
| 492 if (process_group_id_ != base::kNullProcessHandle) | 494 if (process_group_id_ != base::kNullProcessHandle) |
| 493 base::KillProcessGroup(process_group_id_); | 495 base::KillProcessGroup(process_group_id_); |
| 494 #endif | 496 #endif |
| 495 } | 497 } |
| 496 | 498 |
| 497 } // namespace content | 499 } // namespace content |
| OLD | NEW |