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

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: Fix nit 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
« no previous file with comments | « net/test/local_test_server.h ('k') | net/test/remote_test_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return false; 84 return false;
85 } 85 }
86 testserver_dir = testserver_dir.Append(FILE_PATH_LITERAL("net")) 86 testserver_dir = testserver_dir.Append(FILE_PATH_LITERAL("net"))
87 .Append(FILE_PATH_LITERAL("tools")) 87 .Append(FILE_PATH_LITERAL("tools"))
88 .Append(FILE_PATH_LITERAL("testserver")); 88 .Append(FILE_PATH_LITERAL("testserver"));
89 *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL("testserver.py")); 89 *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL("testserver.py"));
90 return true; 90 return true;
91 } 91 }
92 92
93 bool LocalTestServer::Start() { 93 bool LocalTestServer::Start() {
94 return StartInBackground() && BlockUntilStarted();
95 }
96
97 bool LocalTestServer::StartInBackground() {
94 // Get path to Python server script. 98 // Get path to Python server script.
95 FilePath testserver_path; 99 FilePath testserver_path;
96 if (!GetTestServerPath(&testserver_path)) 100 if (!GetTestServerPath(&testserver_path))
97 return false; 101 return false;
98 102
99 if (!SetPythonPath()) 103 if (!SetPythonPath())
100 return false; 104 return false;
101 105
102 if (!LaunchPython(testserver_path)) 106 if (!LaunchPython(testserver_path))
103 return false; 107 return false;
104 108
109 return true;
110 }
111
112 bool LocalTestServer::BlockUntilStarted() {
105 if (!WaitToStart()) { 113 if (!WaitToStart()) {
106 Stop(); 114 Stop();
107 return false; 115 return false;
108 } 116 }
109 117
110 return SetupWhenServerStarted(); 118 return SetupWhenServerStarted();
111 } 119 }
112 120
113 bool LocalTestServer::Stop() { 121 bool LocalTestServer::Stop() {
114 CleanUpWhenStoppingServer(); 122 CleanUpWhenStoppingServer();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 break; 250 break;
243 default: 251 default:
244 NOTREACHED(); 252 NOTREACHED();
245 return false; 253 return false;
246 } 254 }
247 255
248 return true; 256 return true;
249 } 257 }
250 258
251 } // namespace net 259 } // namespace net
OLDNEW
« no previous file with comments | « net/test/local_test_server.h ('k') | net/test/remote_test_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698