Chromium Code Reviews| Index: chrome/test/ui_test_utils.cc |
| diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc |
| index 0be4bd8f7cdc87f3254ceb2fa14f5f0089889ee0..45035135bd1863a11f6256ef746f9bc7871db089 100644 |
| --- a/chrome/test/ui_test_utils.cc |
| +++ b/chrome/test/ui_test_utils.cc |
| @@ -707,17 +707,27 @@ void AppendToPythonPath(const FilePath& dir) { |
| } // anonymous namespace |
| -TestWebSocketServer::TestWebSocketServer(const FilePath& root_directory) { |
| +TestWebSocketServer::TestWebSocketServer() |
| + : started_(false) { |
|
Paweł Hajdan Jr.
2011/01/11 13:01:10
nit: Can we fit it in the previous line?
cbentzel
2011/01/11 19:56:38
Done.
|
| +} |
| + |
| +bool TestWebSocketServer::Start(const FilePath& root_directory) { |
| + if (started_) |
| + return true; |
| 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); |
| - temp_dir_.CreateUniqueTempDir(); |
| + if (!temp_dir_.CreateUniqueTempDir()) |
|
Paweł Hajdan Jr.
2011/01/11 13:01:10
LOG messages would be useful for all error cases h
cbentzel
2011/01/11 19:56:38
Done.
|
| + return false; |
| websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); |
| cmd_line->AppendSwitchPath("pidfile", websocket_pid_file_); |
| SetPythonPath(); |
| - base::LaunchApp(*cmd_line.get(), true, false, NULL); |
| + if (!base::LaunchApp(*cmd_line.get(), true, false, NULL)) |
|
Paweł Hajdan Jr.
2011/01/11 13:01:10
nit: maybe just started_ = LaunchApp; return start
cbentzel
2011/01/11 19:56:38
I added a LOG in failure case, so kept the old ver
|
| + return false; |
| + started_ = true; |
| + return true; |
| } |
| CommandLine* TestWebSocketServer::CreatePythonCommandLine() { |
| @@ -754,6 +764,8 @@ CommandLine* TestWebSocketServer::CreateWebSocketServerCommandLine() { |
| } |
| TestWebSocketServer::~TestWebSocketServer() { |
| + if (!started_) |
| + return; |
| scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); |
| cmd_line->AppendSwitchASCII("server", "stop"); |
| cmd_line->AppendSwitch("chromium"); |