Commit 41ffef1b authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Moved switch definition from unit_test_launcher.cc to test_switches.h

Moved the "single-process-tests" switch definition from the
unit_test_launcher.cc to base/test/test_switches.h and
base/test/test_switches.cc to conform to the convention used for other
test flags in the base project.

The motivation for this change to be able to reuse the
"single-process-tests" switch outside the base/ project.

Bug: 460513
Change-Id: If8fe29a790b51255ec128a93484e4cd494de373a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845959Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703823}
parent 6f67a97d
......@@ -46,11 +46,6 @@ namespace {
// This constant controls how many tests are run in a single batch by default.
const size_t kDefaultTestBatchLimit = 10;
const char kHelpFlag[] = "help";
// Flag to run all tests in a single process.
const char kSingleProcessTestsFlag[] = "single-process-tests";
void PrintUsage() {
fprintf(stdout,
"Runs tests using the gtest framework, each batch of tests being\n"
......@@ -155,7 +150,8 @@ int LaunchUnitTestsInternal(RunTestSuiteCallback run_test_suite,
if (CommandLine::ForCurrentProcess()->HasSwitch(kGTestHelpFlag) ||
CommandLine::ForCurrentProcess()->HasSwitch(kGTestListTestsFlag) ||
CommandLine::ForCurrentProcess()->HasSwitch(kSingleProcessTestsFlag) ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcessTests) ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kTestChildProcess) ||
force_single_process) {
......@@ -163,7 +159,7 @@ int LaunchUnitTestsInternal(RunTestSuiteCallback run_test_suite,
}
#endif
if (CommandLine::ForCurrentProcess()->HasSwitch(kHelpFlag)) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kHelpFlag)) {
PrintUsage();
return 0;
}
......@@ -313,7 +309,7 @@ CommandLine DefaultUnitTestPlatformDelegate::GetCommandLineForChildGTestProcess(
new_cmd_line.AppendSwitchPath(switches::kTestLauncherOutput, output_file);
new_cmd_line.AppendSwitchPath(kGTestFlagfileFlag, flag_file);
new_cmd_line.AppendSwitch(kSingleProcessTestsFlag);
new_cmd_line.AppendSwitch(switches::kSingleProcessTests);
return new_cmd_line;
}
......
......@@ -4,6 +4,13 @@
#include "base/test/test_switches.h"
// Flag to show the help message.
const char switches::kHelpFlag[] = "help";
// Flag to run all tests and the launcher in a single process. Useful for
// debugging a specific test in a debugger.
const char switches::kSingleProcessTests[] = "single-process-tests";
// Maximum number of tests to run in a single batch.
const char switches::kTestLauncherBatchLimit[] = "test-launcher-batch-limit";
......
......@@ -11,6 +11,8 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kHelpFlag[];
extern const char kSingleProcessTests[];
extern const char kTestLauncherBatchLimit[];
extern const char kTestLauncherBotMode[];
extern const char kTestLauncherDebugLauncher[];
......
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