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

Side by Side Diff: net/test/local_test_server.cc

Issue 12033057: Make PPAPI test servers start in parallel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make RemoteTestServer compile Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/test/local_test_server.h" 5 #include "net/test/local_test_server.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 bool LocalTestServer::GetTestServerPath(FilePath* testserver_path) const { 97 bool LocalTestServer::GetTestServerPath(FilePath* testserver_path) const {
98 if (!GetTestServerDirectory(testserver_path)) 98 if (!GetTestServerDirectory(testserver_path))
99 return false; 99 return false;
100 *testserver_path = testserver_path->Append(FILE_PATH_LITERAL( 100 *testserver_path = testserver_path->Append(FILE_PATH_LITERAL(
101 "testserver.py")); 101 "testserver.py"));
102 return true; 102 return true;
103 } 103 }
104 104
105 bool LocalTestServer::Start() { 105 bool LocalTestServer::Start() {
106 return StartInBackground() && BlockUntilStarted();
107 }
108
109 bool LocalTestServer::StartInBackground() {
106 // Get path to Python server script. 110 // Get path to Python server script.
107 FilePath testserver_path; 111 FilePath testserver_path;
108 if (!GetTestServerPath(&testserver_path)) 112 if (!GetTestServerPath(&testserver_path))
109 return false; 113 return false;
110 114
111 if (!SetPythonPath()) 115 if (!SetPythonPath())
112 return false; 116 return false;
113 117
114 if (!LaunchPython(testserver_path)) 118 if (!LaunchPython(testserver_path))
115 return false; 119 return false;
116 120
121 return true;
122 }
123
124 bool LocalTestServer::BlockUntilStarted() {
117 if (!WaitToStart()) { 125 if (!WaitToStart()) {
118 Stop(); 126 Stop();
119 return false; 127 return false;
120 } 128 }
121 129
122 return SetupWhenServerStarted(); 130 return SetupWhenServerStarted();
123 } 131 }
124 132
125 bool LocalTestServer::Stop() { 133 bool LocalTestServer::Stop() {
126 CleanUpWhenStoppingServer(); 134 CleanUpWhenStoppingServer();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 break; 268 break;
261 default: 269 default:
262 NOTREACHED(); 270 NOTREACHED();
263 return false; 271 return false;
264 } 272 }
265 273
266 return true; 274 return true;
267 } 275 }
268 276
269 } // namespace net 277 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698