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

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

Issue 10073033: Run safebrowsing_service_test through the net testserver code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 8 years, 8 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 // Locate the Python code generated by the protocol buffers compiler. 179 // Locate the Python code generated by the protocol buffers compiler.
180 FilePath pyproto_dir; 180 FilePath pyproto_dir;
181 if (!GetPyProtoPath(&pyproto_dir)) { 181 if (!GetPyProtoPath(&pyproto_dir)) {
182 LOG(WARNING) << "Cannot find pyproto dir for generated code. " 182 LOG(WARNING) << "Cannot find pyproto dir for generated code. "
183 << "Testserver features that rely on it will not work"; 183 << "Testserver features that rely on it will not work";
184 return true; 184 return true;
185 } 185 }
186 186
187 AppendToPythonPath(pyproto_dir); 187 AppendToPythonPath(pyproto_dir);
188 AppendToPythonPath(pyproto_dir.AppendASCII("google"));
188 AppendToPythonPath(pyproto_dir.AppendASCII("sync").AppendASCII("protocol")); 189 AppendToPythonPath(pyproto_dir.AppendASCII("sync").AppendASCII("protocol"));
189 AppendToPythonPath(pyproto_dir.AppendASCII("chrome") 190 AppendToPythonPath(pyproto_dir.AppendASCII("chrome")
190 .AppendASCII("browser") 191 .AppendASCII("browser")
191 .AppendASCII("policy") 192 .AppendASCII("policy")
192 .AppendASCII("proto")); 193 .AppendASCII("proto"));
193 194
194 return true; 195 return true;
195 } 196 }
196 197
197 bool LocalTestServer::AddCommandLineArguments(CommandLine* command_line) const { 198 bool LocalTestServer::AddCommandLineArguments(const FilePath& testserver_path,
199 CommandLine* command_line) const {
200 // Make python stdout and stderr unbuffered, to prevent incomplete stderr on
201 // win bots, and also fix mixed up ordering of stdout and stderr.
202 command_line->AppendSwitch("-u");
203
204 command_line->AppendArgPath(testserver_path);
205
198 base::DictionaryValue arguments_dict; 206 base::DictionaryValue arguments_dict;
199 if (!GenerateArguments(&arguments_dict)) 207 if (!GenerateArguments(&arguments_dict))
200 return false; 208 return false;
201 209
202 // Serialize the argument dictionary into CommandLine. 210 // Serialize the argument dictionary into CommandLine.
203 for (DictionaryValue::Iterator it(arguments_dict); it.HasNext(); 211 for (DictionaryValue::Iterator it(arguments_dict); it.HasNext();
204 it.Advance()) { 212 it.Advance()) {
205 const base::Value& value = it.value(); 213 const base::Value& value = it.value();
206 const std::string& key = it.key(); 214 const std::string& key = it.key();
207 215
(...skipping 14 matching lines...) Expand all
222 230
223 // Append the appropriate server type argument. 231 // Append the appropriate server type argument.
224 switch (type()) { 232 switch (type()) {
225 case TYPE_HTTP: 233 case TYPE_HTTP:
226 case TYPE_HTTPS: 234 case TYPE_HTTPS:
227 // The default type is HTTP, no argument required. 235 // The default type is HTTP, no argument required.
228 break; 236 break;
229 case TYPE_FTP: 237 case TYPE_FTP:
230 command_line->AppendArg("-f"); 238 command_line->AppendArg("-f");
231 break; 239 break;
240 case TYPE_SAFEBROWSING:
241 command_line->AppendArg("--safebrowsing");
242 break;
232 case TYPE_SYNC: 243 case TYPE_SYNC:
233 command_line->AppendArg("--sync"); 244 command_line->AppendArg("--sync");
234 break; 245 break;
235 case TYPE_TCP_ECHO: 246 case TYPE_TCP_ECHO:
236 command_line->AppendArg("--tcp-echo"); 247 command_line->AppendArg("--tcp-echo");
237 break; 248 break;
238 case TYPE_UDP_ECHO: 249 case TYPE_UDP_ECHO:
239 command_line->AppendArg("--udp-echo"); 250 command_line->AppendArg("--udp-echo");
240 break; 251 break;
241 case TYPE_GDATA: 252 case TYPE_GDATA:
242 command_line->AppendArg( 253 command_line->AppendArg(
243 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); 254 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken);
244 break; 255 break;
245 default: 256 default:
246 NOTREACHED(); 257 NOTREACHED();
247 return false; 258 return false;
248 } 259 }
249 260
250 return true; 261 return true;
251 } 262 }
252 263
253 } // namespace net 264 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698