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

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

Issue 10905087: Revert 154861 - Run safebrowsing_service_test through the net testserver code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/local_test_server_posix.cc » ('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 (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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 testserver_dir = testserver_dir 89 testserver_dir = testserver_dir
90 .Append(FILE_PATH_LITERAL("net")) 90 .Append(FILE_PATH_LITERAL("net"))
91 .Append(FILE_PATH_LITERAL("tools")) 91 .Append(FILE_PATH_LITERAL("tools"))
92 .Append(FILE_PATH_LITERAL("testserver")); 92 .Append(FILE_PATH_LITERAL("testserver"));
93 *directory = testserver_dir; 93 *directory = testserver_dir;
94 return true; 94 return true;
95 } 95 }
96 96
97 bool LocalTestServer::GetTestServerPath(FilePath* testserver_path) const {
98 if (!GetTestServerDirectory(testserver_path))
99 return false;
100 *testserver_path = testserver_path->Append(FILE_PATH_LITERAL(
101 "testserver.py"));
102 return true;
103 }
104
105 bool LocalTestServer::Start() { 97 bool LocalTestServer::Start() {
106 // Get path to Python server script. 98 // Get path to Python server script.
107 FilePath testserver_path; 99 FilePath testserver_path;
108 if (!GetTestServerPath(&testserver_path)) 100 if (!GetTestServerDirectory(&testserver_path))
109 return false; 101 return false;
102 testserver_path =
103 testserver_path.Append(FILE_PATH_LITERAL("testserver.py"));
110 104
111 if (!SetPythonPath()) 105 if (!SetPythonPath())
112 return false; 106 return false;
113 107
114 if (!LaunchPython(testserver_path)) 108 if (!LaunchPython(testserver_path))
115 return false; 109 return false;
116 110
117 if (!WaitToStart()) { 111 if (!WaitToStart()) {
118 Stop(); 112 Stop();
119 return false; 113 return false;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) 152 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir))
159 return false; 153 return false;
160 SetResourcePath(src_dir.Append(document_root), 154 SetResourcePath(src_dir.Append(document_root),
161 src_dir.AppendASCII("net") 155 src_dir.AppendASCII("net")
162 .AppendASCII("data") 156 .AppendASCII("data")
163 .AppendASCII("ssl") 157 .AppendASCII("ssl")
164 .AppendASCII("certificates")); 158 .AppendASCII("certificates"));
165 return true; 159 return true;
166 } 160 }
167 161
168 bool LocalTestServer::SetPythonPath() const {
169 return SetPythonPathStatic();
170 }
171
172 // static 162 // static
173 bool LocalTestServer::SetPythonPathStatic() { 163 bool LocalTestServer::SetPythonPath() {
174 FilePath third_party_dir; 164 FilePath third_party_dir;
175 if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) { 165 if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) {
176 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; 166 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT";
177 return false; 167 return false;
178 } 168 }
179 third_party_dir = third_party_dir.AppendASCII("third_party"); 169 third_party_dir = third_party_dir.AppendASCII("third_party");
180 170
181 // For simplejson. (simplejson, unlike all the other Python modules 171 // For simplejson. (simplejson, unlike all the other Python modules
182 // we include, doesn't have an extra 'simplejson' directory, so we 172 // we include, doesn't have an extra 'simplejson' directory, so we
183 // need to include its parent directory, i.e. third_party_dir). 173 // need to include its parent directory, i.e. third_party_dir).
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); 248 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken);
259 break; 249 break;
260 default: 250 default:
261 NOTREACHED(); 251 NOTREACHED();
262 return false; 252 return false;
263 } 253 }
264 254
265 return true; 255 return true;
266 } 256 }
267 257
268 void LocalTestServer::AddPythonArguments(const FilePath& testserver_path,
269 CommandLine* command_line) const {
270 // Make python stdout and stderr unbuffered, to prevent incomplete stderr on
271 // win bots, and also fix mixed up ordering of stdout and stderr.
272 command_line->AppendSwitch("-u");
273
274 command_line->AppendArgPath(testserver_path);
275 }
276
277 } // namespace net 258 } // namespace net
OLDNEW
« no previous file with comments | « net/test/local_test_server.h ('k') | net/test/local_test_server_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698