Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: chrome/test/ui/ui_test.cc

Issue 6526040: CommandLine refactoring and cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix program_path_, add and update comments. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/ui/ui_test.cc
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index dbcd00f614873b57a241bc78e6d9975911da7afe..e10d4e18f8e02a222733e8f6c0d25946fe37cd28 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -522,6 +522,8 @@ ProxyLauncher* UITest::CreateProxyLauncher() {
}
static CommandLine* CreatePythonCommandLine() {
+ // Note: Python's first argument must be the script; do not append CommandLine
+ // switches, as they would precede the script path and break this CommandLine.
return new CommandLine(FilePath(FILE_PATH_LITERAL("python")));
}
@@ -548,11 +550,13 @@ void UITest::StartHttpServer(const FilePath& root_directory) {
void UITest::StartHttpServerWithPort(const FilePath& root_directory,
int port) {
+ // Append CommandLine arguments after the server script, switches won't work.
scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine());
ASSERT_TRUE(cmd_line.get());
- cmd_line->AppendSwitchASCII("server", "start");
- cmd_line->AppendSwitch("register_cygwin");
- cmd_line->AppendSwitchPath("root", root_directory);
+ cmd_line->AppendArg("--server=start");
+ cmd_line->AppendArg("--register_cygwin");
+ cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") +
+ root_directory.value());
FilePath layout_tests_dir;
PathService::Get(base::DIR_SOURCE_ROOT, &layout_tests_dir);
@@ -561,18 +565,19 @@ void UITest::StartHttpServerWithPort(const FilePath& root_directory,
.AppendASCII("data")
.AppendASCII("layout_tests")
.AppendASCII("LayoutTests");
- cmd_line->AppendSwitchPath("layout_tests_dir", layout_tests_dir);
+ cmd_line->AppendArgNative(FILE_PATH_LITERAL("--layout_tests_dir=") +
+ layout_tests_dir.value());
// For Windows 7, if we start the lighttpd server on the foreground mode,
// it will mess up with the command window and cause conhost.exe to crash. To
// work around this, we start the http server on the background mode.
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
- cmd_line->AppendSwitch("run_background");
+ cmd_line->AppendArg("--run_background");
#endif
if (port)
- cmd_line->AppendSwitchASCII("port", base::IntToString(port));
+ cmd_line->AppendArg("--port=" + base::IntToString(port));
#if defined(OS_WIN)
// TODO(phajdan.jr): is this needed?
@@ -586,9 +591,10 @@ void UITest::StartHttpServerWithPort(const FilePath& root_directory,
}
void UITest::StopHttpServer() {
+ // Append CommandLine arguments after the server script, switches won't work.
scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine());
ASSERT_TRUE(cmd_line.get());
- cmd_line->AppendSwitchASCII("server", "stop");
+ cmd_line->AppendArg("--server=stop");
#if defined(OS_WIN)
// TODO(phajdan.jr): is this needed?

Powered by Google App Engine
This is Rietveld 408576698