| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Do not let the child ignore failures. We need to propagate the | 79 // Do not let the child ignore failures. We need to propagate the |
| 80 // failure status back to the parent. | 80 // failure status back to the parent. |
| 81 new_cmd_line.AppendSwitch(kStrictFailureHandling); | 81 new_cmd_line.AppendSwitch(kStrictFailureHandling); |
| 82 | 82 |
| 83 base::ProcessHandle process_handle; | 83 base::ProcessHandle process_handle; |
| 84 if (!base::LaunchApp(new_cmd_line, false, false, &process_handle)) | 84 if (!base::LaunchApp(new_cmd_line, false, false, &process_handle)) |
| 85 return false; | 85 return false; |
| 86 | 86 |
| 87 int test_terminate_timeout_ms = kDefaultTestTimeoutMs; | 87 int test_terminate_timeout_ms = kDefaultTestTimeoutMs; |
| 88 if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) { | 88 if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) { |
| 89 std::wstring timeout_str( | 89 std::string timeout_str = |
| 90 cmd_line->GetSwitchValue(kTestTerminateTimeoutFlag)); | 90 cmd_line->GetSwitchValueASCII(kTestTerminateTimeoutFlag); |
| 91 int timeout; | 91 int timeout; |
| 92 base::StringToInt(WideToUTF8(timeout_str), &timeout); | 92 base::StringToInt(timeout_str, &timeout); |
| 93 test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout); | 93 test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int exit_code = 0; | 96 int exit_code = 0; |
| 97 if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code, | 97 if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code, |
| 98 test_terminate_timeout_ms)) { | 98 test_terminate_timeout_ms)) { |
| 99 LOG(ERROR) << "Test timeout (" << test_terminate_timeout_ms | 99 LOG(ERROR) << "Test timeout (" << test_terminate_timeout_ms |
| 100 << " ms) exceeded for " << test_name; | 100 << " ms) exceeded for " << test_name; |
| 101 | 101 |
| 102 exit_code = -1; // Set a non-zero exit code to signal a failure. | 102 exit_code = -1; // Set a non-zero exit code to signal a failure. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 "Starting tests...\n" | 203 "Starting tests...\n" |
| 204 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" | 204 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" |
| 205 "For debugging a test inside a debugger, use the\n" | 205 "For debugging a test inside a debugger, use the\n" |
| 206 "--gtest_filter=<your_test_name> flag along with either\n" | 206 "--gtest_filter=<your_test_name> flag along with either\n" |
| 207 "--single_process (to run all tests in one launcher/browser process) or\n" | 207 "--single_process (to run all tests in one launcher/browser process) or\n" |
| 208 "--single-process (to do the above, and also run Chrome in single-\n" | 208 "--single-process (to do the above, and also run Chrome in single-\n" |
| 209 "process mode).\n"); | 209 "process mode).\n"); |
| 210 OutOfProcTestRunnerFactory test_runner_factory; | 210 OutOfProcTestRunnerFactory test_runner_factory; |
| 211 return tests::RunTests(test_runner_factory) ? 0 : 1; | 211 return tests::RunTests(test_runner_factory) ? 0 : 1; |
| 212 } | 212 } |
| OLD | NEW |