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

Unified Diff: chrome/test/ui_test_utils.cc

Issue 6042009: Added WARN_UNUSED_RESULT to ScopedTempDir methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with trunk Created 9 years, 11 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_test_utils.h ('k') | chrome/worker/worker_uitest.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 7eba05c0c90435166b3b57fcf5c023687c98ddf5..028e718eb7f6ce5de2c1ccf8de76dfbbafdefe26 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -799,17 +799,30 @@ void AppendToPythonPath(const FilePath& dir) {
} // anonymous namespace
-TestWebSocketServer::TestWebSocketServer(const FilePath& root_directory) {
+TestWebSocketServer::TestWebSocketServer() : started_(false) {
+}
+
+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()) {
+ 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_);
SetPythonPath();
- base::LaunchApp(*cmd_line.get(), true, false, NULL);
+ if (!base::LaunchApp(*cmd_line.get(), true, false, NULL)) {
+ LOG(ERROR) << "Unable to launch websocket server.";
+ return false;
+ }
+ started_ = true;
+ return true;
}
CommandLine* TestWebSocketServer::CreatePythonCommandLine() {
@@ -846,6 +859,8 @@ CommandLine* TestWebSocketServer::CreateWebSocketServerCommandLine() {
}
TestWebSocketServer::~TestWebSocketServer() {
+ if (!started_)
+ return;
scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine());
cmd_line->AppendSwitchASCII("server", "stop");
cmd_line->AppendSwitch("chromium");
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698