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

Unified Diff: chrome/test/ui_test_utils.cc

Issue 6526040: CommandLine refactoring and cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits, merge changes. 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
« no previous file with comments | « chrome/test/ui/ui_test.cc ('k') | net/test/test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui_test_utils.cc
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index e7c84aa41622b5d23e47d8e25c3f2ae758d02996..77ce4ff8e63fd6d558eb0ddd8ed8700456c12101 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -750,17 +750,20 @@ TestWebSocketServer::TestWebSocketServer() : started_(false) {
bool TestWebSocketServer::Start(const FilePath& root_directory) {
if (started_)
return true;
+ // Append CommandLine arguments after the server script, switches won't work.
scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine());
- cmd_line->AppendSwitchASCII("server", "start");
- cmd_line->AppendSwitch("chromium");
- cmd_line->AppendSwitch("register_cygwin");
- cmd_line->AppendSwitchPath("root", root_directory);
+ cmd_line->AppendArg("--server=start");
+ cmd_line->AppendArg("--chromium");
+ cmd_line->AppendArg("--register_cygwin");
+ cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") +
+ root_directory.value());
if (!temp_dir_.CreateUniqueTempDir()) {
LOG(ERROR) << "Unable to create a temporary directory.";
return false;
}
websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid");
- cmd_line->AppendSwitchPath("pidfile", websocket_pid_file_);
+ cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") +
+ websocket_pid_file_.value());
SetPythonPath();
if (!base::LaunchApp(*cmd_line.get(), true, false, NULL)) {
LOG(ERROR) << "Unable to launch websocket server.";
@@ -771,6 +774,8 @@ bool TestWebSocketServer::Start(const FilePath& root_directory) {
}
CommandLine* TestWebSocketServer::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")));
}
@@ -806,10 +811,12 @@ CommandLine* TestWebSocketServer::CreateWebSocketServerCommandLine() {
TestWebSocketServer::~TestWebSocketServer() {
if (!started_)
return;
+ // Append CommandLine arguments after the server script, switches won't work.
scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine());
- cmd_line->AppendSwitchASCII("server", "stop");
- cmd_line->AppendSwitch("chromium");
- cmd_line->AppendSwitchPath("pidfile", websocket_pid_file_);
+ cmd_line->AppendArg("--server=stop");
+ cmd_line->AppendArg("--chromium");
+ cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") +
+ websocket_pid_file_.value());
base::LaunchApp(*cmd_line.get(), true, false, NULL);
}
« no previous file with comments | « chrome/test/ui/ui_test.cc ('k') | net/test/test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698