| 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 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool Init() { | 30 bool Init() { |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Returns true if the test succeeded, false if it failed. | 34 // Returns true if the test succeeded, false if it failed. |
| 35 bool RunTest(const std::string& test_name) { | 35 bool RunTest(const std::string& test_name) { |
| 36 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 36 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 37 CommandLine new_cmd_line(cmd_line->argv()); | 37 CommandLine new_cmd_line(cmd_line->argv()); |
| 38 // Always enable disabled tests. This method is not called with disabled |
| 39 // tests unless this flag was specified to the browser test executable. |
| 40 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
| 38 new_cmd_line.AppendSwitchWithValue(L"gtest_filter", ASCIIToWide(test_name)); | 41 new_cmd_line.AppendSwitchWithValue(L"gtest_filter", ASCIIToWide(test_name)); |
| 39 new_cmd_line.AppendSwitch(kChildProcessFlag); | 42 new_cmd_line.AppendSwitch(kChildProcessFlag); |
| 40 | 43 |
| 41 base::ProcessHandle process_handle; | 44 base::ProcessHandle process_handle; |
| 42 bool r = base::LaunchApp(new_cmd_line, false, false, &process_handle); | 45 bool r = base::LaunchApp(new_cmd_line, false, false, &process_handle); |
| 43 if (!r) | 46 if (!r) |
| 44 return false; | 47 return false; |
| 45 | 48 |
| 46 int exit_code = 0; | 49 int exit_code = 0; |
| 47 r = base::WaitForExitCode(process_handle, &exit_code); | 50 r = base::WaitForExitCode(process_handle, &exit_code); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 76 | 79 |
| 77 if (command_line->HasSwitch(kChildProcessFlag)) | 80 if (command_line->HasSwitch(kChildProcessFlag)) |
| 78 return ChromeTestSuite(argc, argv).Run(); | 81 return ChromeTestSuite(argc, argv).Run(); |
| 79 | 82 |
| 80 if (command_line->HasSwitch(kGTestListTestsFlag)) | 83 if (command_line->HasSwitch(kGTestListTestsFlag)) |
| 81 return ChromeTestSuite(argc, argv).Run(); | 84 return ChromeTestSuite(argc, argv).Run(); |
| 82 | 85 |
| 83 OutOfProcBrowserTestRunnerFactory test_runner_factory; | 86 OutOfProcBrowserTestRunnerFactory test_runner_factory; |
| 84 return browser_tests::RunTests(test_runner_factory) ? 0 : 1; | 87 return browser_tests::RunTests(test_runner_factory) ? 0 : 1; |
| 85 } | 88 } |
| OLD | NEW |