diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 19:29:40 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 19:29:40 +0000 |
commit | cf91137171be1d57336ac897a9777259657fa381 (patch) | |
tree | c80448e76e2ee68e2d515099c91f8e668c4c46e0 /chrome | |
parent | 36be54667a4b5624e19abf70394089bc08ace740 (diff) | |
download | chromium_src-cf91137171be1d57336ac897a9777259657fa381.zip chromium_src-cf91137171be1d57336ac897a9777259657fa381.tar.gz chromium_src-cf91137171be1d57336ac897a9777259657fa381.tar.bz2 |
Adds support for the gtest_also_run_disabled_tests flag in the browser tests.
BUG=None
TEST=Run the browser tests with the --gtest_also_run_disabled_tests flag. Disabled tests should be run.
Review URL: http://codereview.chromium.org/155112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/test/browser/browser_test_launcher_in_proc.cc | 7 | ||||
-rw-r--r-- | chrome/test/browser/browser_test_launcher_out_of_proc.cc | 3 | ||||
-rw-r--r-- | chrome/test/browser/browser_test_runner.cc | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/chrome/test/browser/browser_test_launcher_in_proc.cc b/chrome/test/browser/browser_test_launcher_in_proc.cc index ed2a473..bff4ca4 100644 --- a/chrome/test/browser/browser_test_launcher_in_proc.cc +++ b/chrome/test/browser/browser_test_launcher_in_proc.cc @@ -68,10 +68,13 @@ class InProcBrowserTestRunner : public browser_tests::BrowserTestRunner { bool RunTest(const std::string& test_name) { std::string filter_flag = StringPrintf("--gtest_filter=%s", test_name.c_str()); - char* argv[2]; + char* argv[3]; argv[0] = const_cast<char*>(""); argv[1] = const_cast<char*>(filter_flag.c_str()); - return RunAsIs(2, argv) == 0; + // Always enable disabled tests. This method is not called with disabled + // tests unless this flag was specified to the browser test executable. + argv[2] = "--gtest_also_run_disabled_tests"; + return RunAsIs(3, argv) == 0; } // Calls-in to GTest with the arguments we were started with. diff --git a/chrome/test/browser/browser_test_launcher_out_of_proc.cc b/chrome/test/browser/browser_test_launcher_out_of_proc.cc index 5fe3944..61f0cd7 100644 --- a/chrome/test/browser/browser_test_launcher_out_of_proc.cc +++ b/chrome/test/browser/browser_test_launcher_out_of_proc.cc @@ -35,6 +35,9 @@ class OutOfProcBrowserTestRunner : public browser_tests::BrowserTestRunner { bool RunTest(const std::string& test_name) { const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); CommandLine new_cmd_line(cmd_line->argv()); + // Always enable disabled tests. This method is not called with disabled + // tests unless this flag was specified to the browser test executable. + new_cmd_line.AppendSwitch(L"gtest_also_run_disabled_tests"); new_cmd_line.AppendSwitchWithValue(L"gtest_filter", ASCIIToWide(test_name)); new_cmd_line.AppendSwitch(kChildProcessFlag); diff --git a/chrome/test/browser/browser_test_runner.cc b/chrome/test/browser/browser_test_runner.cc index b32e64e..bd0e2fe 100644 --- a/chrome/test/browser/browser_test_runner.cc +++ b/chrome/test/browser/browser_test_runner.cc @@ -15,6 +15,8 @@ namespace { const wchar_t* const kGTestListTestsFlag = L"gtest_list_tests"; +const wchar_t* const kGTestRunDisabledTestsFlag = + L"gtest_also_run_disabled_tests"; // Retrieves the list of tests to run by running gtest with the // --gtest_list_tests flag in a forked process and parsing its output. @@ -58,7 +60,8 @@ bool GetTestList(const CommandLine& command_line, continue; } - if (line.find("DISABLED") != std::string::npos) + if (!command_line.HasSwitch(kGTestRunDisabledTestsFlag) && + line.find("DISABLED") != std::string::npos) continue; // Skip disabled tests. // We are dealing with a test. |