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

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

Issue 10879029: reland: Launch pywebsocket via net::TestServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed 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
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return false; 167 return false;
168 } 168 }
169 third_party_dir = third_party_dir.AppendASCII("third_party"); 169 third_party_dir = third_party_dir.AppendASCII("third_party");
170 170
171 // For simplejson. (simplejson, unlike all the other Python modules 171 // For simplejson. (simplejson, unlike all the other Python modules
172 // we include, doesn't have an extra 'simplejson' directory, so we 172 // we include, doesn't have an extra 'simplejson' directory, so we
173 // need to include its parent directory, i.e. third_party_dir). 173 // need to include its parent directory, i.e. third_party_dir).
174 AppendToPythonPath(third_party_dir); 174 AppendToPythonPath(third_party_dir);
175 175
176 AppendToPythonPath(third_party_dir.AppendASCII("tlslite")); 176 AppendToPythonPath(third_party_dir.AppendASCII("tlslite"));
177 AppendToPythonPath( 177 AppendToPythonPath(third_party_dir.AppendASCII("pyftpdlib")
178 third_party_dir.AppendASCII("pyftpdlib").AppendASCII("src")); 178 .AppendASCII("src"));
Paweł Hajdan Jr. 2012/09/12 10:32:55 nit: Not really, I prefer the _previous_ wrapping
Takashi Toyoshima 2012/09/13 07:06:23 Ah, I see. I took wrong way...
179 AppendToPythonPath(third_party_dir.AppendASCII("pywebsocket")
180 .AppendASCII("src"));
179 181
180 // Locate the Python code generated by the protocol buffers compiler. 182 // Locate the Python code generated by the protocol buffers compiler.
181 FilePath pyproto_dir; 183 FilePath pyproto_dir;
182 if (!GetPyProtoPath(&pyproto_dir)) { 184 if (!GetPyProtoPath(&pyproto_dir)) {
183 LOG(WARNING) << "Cannot find pyproto dir for generated code. " 185 LOG(WARNING) << "Cannot find pyproto dir for generated code. "
184 << "Testserver features that rely on it will not work"; 186 << "Testserver features that rely on it will not work";
185 return true; 187 return true;
186 } 188 }
187 189
188 AppendToPythonPath(pyproto_dir); 190 AppendToPythonPath(pyproto_dir);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 224 }
223 225
224 // Append the appropriate server type argument. 226 // Append the appropriate server type argument.
225 switch (type()) { 227 switch (type()) {
226 case TYPE_HTTP: 228 case TYPE_HTTP:
227 case TYPE_HTTPS: 229 case TYPE_HTTPS:
228 // The default type is HTTP, no argument required. 230 // The default type is HTTP, no argument required.
229 break; 231 break;
230 case TYPE_WS: 232 case TYPE_WS:
231 case TYPE_WSS: 233 case TYPE_WSS:
232 // TODO(toyoshim): Handle correctly. See, http://crbug.com/137639 . 234 command_line->AppendArg("--websocket");
233 break; 235 break;
234 case TYPE_FTP: 236 case TYPE_FTP:
235 command_line->AppendArg("-f"); 237 command_line->AppendArg("-f");
236 break; 238 break;
237 case TYPE_SYNC: 239 case TYPE_SYNC:
238 command_line->AppendArg("--sync"); 240 command_line->AppendArg("--sync");
239 break; 241 break;
240 case TYPE_TCP_ECHO: 242 case TYPE_TCP_ECHO:
241 command_line->AppendArg("--tcp-echo"); 243 command_line->AppendArg("--tcp-echo");
242 break; 244 break;
243 case TYPE_UDP_ECHO: 245 case TYPE_UDP_ECHO:
244 command_line->AppendArg("--udp-echo"); 246 command_line->AppendArg("--udp-echo");
245 break; 247 break;
246 case TYPE_BASIC_AUTH_PROXY: 248 case TYPE_BASIC_AUTH_PROXY:
247 command_line->AppendArg("--basic-auth-proxy"); 249 command_line->AppendArg("--basic-auth-proxy");
248 break; 250 break;
249 case TYPE_GDATA: 251 case TYPE_GDATA:
250 command_line->AppendArg( 252 command_line->AppendArg(
251 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); 253 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken);
252 break; 254 break;
253 default: 255 default:
254 NOTREACHED(); 256 NOTREACHED();
255 return false; 257 return false;
256 } 258 }
257 259
258 return true; 260 return true;
259 } 261 }
260 262
261 } // namespace net 263 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698