Commit cf911371 authored by jcampan@chromium.org's avatar jcampan@chromium.org

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
parent 36be5466
...@@ -68,10 +68,13 @@ class InProcBrowserTestRunner : public browser_tests::BrowserTestRunner { ...@@ -68,10 +68,13 @@ class InProcBrowserTestRunner : public browser_tests::BrowserTestRunner {
bool RunTest(const std::string& test_name) { bool RunTest(const std::string& test_name) {
std::string filter_flag = StringPrintf("--gtest_filter=%s", std::string filter_flag = StringPrintf("--gtest_filter=%s",
test_name.c_str()); test_name.c_str());
char* argv[2]; char* argv[3];
argv[0] = const_cast<char*>(""); argv[0] = const_cast<char*>("");
argv[1] = const_cast<char*>(filter_flag.c_str()); 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. // Calls-in to GTest with the arguments we were started with.
......
...@@ -35,6 +35,9 @@ class OutOfProcBrowserTestRunner : public browser_tests::BrowserTestRunner { ...@@ -35,6 +35,9 @@ class OutOfProcBrowserTestRunner : public browser_tests::BrowserTestRunner {
bool RunTest(const std::string& test_name) { bool RunTest(const std::string& test_name) {
const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
CommandLine new_cmd_line(cmd_line->argv()); 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.AppendSwitchWithValue(L"gtest_filter", ASCIIToWide(test_name));
new_cmd_line.AppendSwitch(kChildProcessFlag); new_cmd_line.AppendSwitch(kChildProcessFlag);
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
namespace { namespace {
const wchar_t* const kGTestListTestsFlag = L"gtest_list_tests"; 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 // Retrieves the list of tests to run by running gtest with the
// --gtest_list_tests flag in a forked process and parsing its output. // --gtest_list_tests flag in a forked process and parsing its output.
...@@ -58,7 +60,8 @@ bool GetTestList(const CommandLine& command_line, ...@@ -58,7 +60,8 @@ bool GetTestList(const CommandLine& command_line,
continue; continue;
} }
if (line.find("DISABLED") != std::string::npos) if (!command_line.HasSwitch(kGTestRunDisabledTestsFlag) &&
line.find("DISABLED") != std::string::npos)
continue; // Skip disabled tests. continue; // Skip disabled tests.
// We are dealing with a test. // We are dealing with a test.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment