| OLD | NEW |
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 178 third_party_dir.AppendASCII("pyftpdlib").AppendASCII("src")); | 178 third_party_dir.AppendASCII("pyftpdlib").AppendASCII("src")); |
| 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 Loading... |
| 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_GDATA: | 248 case TYPE_GDATA: |
| 247 command_line->AppendArg( | 249 command_line->AppendArg( |
| 248 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); | 250 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); |
| 249 break; | 251 break; |
| 250 default: | 252 default: |
| 251 NOTREACHED(); | 253 NOTREACHED(); |
| 252 return false; | 254 return false; |
| 253 } | 255 } |
| 254 | 256 |
| 255 return true; | 257 return true; |
| 256 } | 258 } |
| 257 | 259 |
| 258 } // namespace net | 260 } // namespace net |
| OLD | NEW |