| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 virtual ~OutOfProcTestRunner() { | 26 virtual ~OutOfProcTestRunner() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool Init() { | 29 bool Init() { |
| 30 return true; | 30 return true; |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Returns true if the test succeeded, false if it failed. | 33 // Returns true if the test succeeded, false if it failed. |
| 34 bool RunTest(const std::string& test_name) { | 34 bool RunTest(const std::string& test_name) { |
| 35 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 35 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 36 #if defined(OS_WIN) | |
| 37 CommandLine new_cmd_line = | |
| 38 CommandLine::FromString(cmd_line->command_line_string()); | |
| 39 #else | |
| 40 CommandLine new_cmd_line(cmd_line->argv()); | 36 CommandLine new_cmd_line(cmd_line->argv()); |
| 41 #endif | |
| 42 // Always enable disabled tests. This method is not called with disabled | 37 // Always enable disabled tests. This method is not called with disabled |
| 43 // tests unless this flag was specified to the browser test executable. | 38 // tests unless this flag was specified to the browser test executable. |
| 44 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); | 39 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
| 45 new_cmd_line.AppendSwitchWithValue("gtest_filter", test_name); | 40 new_cmd_line.AppendSwitchWithValue("gtest_filter", test_name); |
| 46 new_cmd_line.AppendSwitch(kChildProcessFlag); | 41 new_cmd_line.AppendSwitch(kChildProcessFlag); |
| 47 | 42 |
| 48 base::ProcessHandle process_handle; | 43 base::ProcessHandle process_handle; |
| 49 bool r = base::LaunchApp(new_cmd_line, false, false, &process_handle); | 44 bool r = base::LaunchApp(new_cmd_line, false, false, &process_handle); |
| 50 if (!r) | 45 if (!r) |
| 51 return false; | 46 return false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 | 77 |
| 83 if (command_line->HasSwitch(kChildProcessFlag)) | 78 if (command_line->HasSwitch(kChildProcessFlag)) |
| 84 return ChromeTestSuite(argc, argv).Run(); | 79 return ChromeTestSuite(argc, argv).Run(); |
| 85 | 80 |
| 86 if (command_line->HasSwitch(kGTestListTestsFlag)) | 81 if (command_line->HasSwitch(kGTestListTestsFlag)) |
| 87 return ChromeTestSuite(argc, argv).Run(); | 82 return ChromeTestSuite(argc, argv).Run(); |
| 88 | 83 |
| 89 OutOfProcTestRunnerFactory test_runner_factory; | 84 OutOfProcTestRunnerFactory test_runner_factory; |
| 90 return tests::RunTests(test_runner_factory) ? 0 : 1; | 85 return tests::RunTests(test_runner_factory) ? 0 : 1; |
| 91 } | 86 } |
| OLD | NEW |