| 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/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Returns true if the test succeeded, false if it failed. | 67 // Returns true if the test succeeded, false if it failed. |
| 68 bool RunTest(const std::string& test_name) { | 68 bool RunTest(const std::string& test_name) { |
| 69 std::string filter_flag = StringPrintf("--gtest_filter=%s", | 69 std::string filter_flag = StringPrintf("--gtest_filter=%s", |
| 70 test_name.c_str()); | 70 test_name.c_str()); |
| 71 char* argv[2]; | 71 char* argv[3]; |
| 72 argv[0] = const_cast<char*>(""); | 72 argv[0] = const_cast<char*>(""); |
| 73 argv[1] = const_cast<char*>(filter_flag.c_str()); | 73 argv[1] = const_cast<char*>(filter_flag.c_str()); |
| 74 return RunAsIs(2, argv) == 0; | 74 // Always enable disabled tests. This method is not called with disabled |
| 75 // tests unless this flag was specified to the browser test executable. |
| 76 argv[2] = "--gtest_also_run_disabled_tests"; |
| 77 return RunAsIs(3, argv) == 0; |
| 75 } | 78 } |
| 76 | 79 |
| 77 // Calls-in to GTest with the arguments we were started with. | 80 // Calls-in to GTest with the arguments we were started with. |
| 78 int RunAsIs(int argc, char** argv) { | 81 int RunAsIs(int argc, char** argv) { |
| 79 return (run_test_proc_)(argc, argv); | 82 return (run_test_proc_)(argc, argv); |
| 80 } | 83 } |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 typedef int (CDECL *RunTestProc)(int, char**); | 86 typedef int (CDECL *RunTestProc)(int, char**); |
| 84 | 87 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 112 if (command_line->HasSwitch(kGTestListTestsFlag)) { | 115 if (command_line->HasSwitch(kGTestListTestsFlag)) { |
| 113 InProcBrowserTestRunner test_runner; | 116 InProcBrowserTestRunner test_runner; |
| 114 if (!test_runner.Init()) | 117 if (!test_runner.Init()) |
| 115 return 1; | 118 return 1; |
| 116 return test_runner.RunAsIs(argc, argv); | 119 return test_runner.RunAsIs(argc, argv); |
| 117 } | 120 } |
| 118 | 121 |
| 119 InProcBrowserTestRunnerFactory test_runner_factory; | 122 InProcBrowserTestRunnerFactory test_runner_factory; |
| 120 return browser_tests::RunTests(test_runner_factory) ? 0 : 1; | 123 return browser_tests::RunTests(test_runner_factory) ? 0 : 1; |
| 121 } | 124 } |
| OLD | NEW |