| 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( | |
| 180 third_party_dir.AppendASCII("pywebsocket").AppendASCII("src")); | |
| 181 | 179 |
| 182 // Locate the Python code generated by the protocol buffers compiler. | 180 // Locate the Python code generated by the protocol buffers compiler. |
| 183 FilePath pyproto_dir; | 181 FilePath pyproto_dir; |
| 184 if (!GetPyProtoPath(&pyproto_dir)) { | 182 if (!GetPyProtoPath(&pyproto_dir)) { |
| 185 LOG(WARNING) << "Cannot find pyproto dir for generated code. " | 183 LOG(WARNING) << "Cannot find pyproto dir for generated code. " |
| 186 << "Testserver features that rely on it will not work"; | 184 << "Testserver features that rely on it will not work"; |
| 187 return true; | 185 return true; |
| 188 } | 186 } |
| 189 | 187 |
| 190 AppendToPythonPath(pyproto_dir); | 188 AppendToPythonPath(pyproto_dir); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 222 } |
| 225 | 223 |
| 226 // Append the appropriate server type argument. | 224 // Append the appropriate server type argument. |
| 227 switch (type()) { | 225 switch (type()) { |
| 228 case TYPE_HTTP: | 226 case TYPE_HTTP: |
| 229 case TYPE_HTTPS: | 227 case TYPE_HTTPS: |
| 230 // The default type is HTTP, no argument required. | 228 // The default type is HTTP, no argument required. |
| 231 break; | 229 break; |
| 232 case TYPE_WS: | 230 case TYPE_WS: |
| 233 case TYPE_WSS: | 231 case TYPE_WSS: |
| 234 command_line->AppendArg("--websocket"); | 232 // TODO(toyoshim): Handle correctly. See, http://crbug.com/137639 . |
| 235 break; | 233 break; |
| 236 case TYPE_FTP: | 234 case TYPE_FTP: |
| 237 command_line->AppendArg("-f"); | 235 command_line->AppendArg("-f"); |
| 238 break; | 236 break; |
| 239 case TYPE_SYNC: | 237 case TYPE_SYNC: |
| 240 command_line->AppendArg("--sync"); | 238 command_line->AppendArg("--sync"); |
| 241 break; | 239 break; |
| 242 case TYPE_TCP_ECHO: | 240 case TYPE_TCP_ECHO: |
| 243 command_line->AppendArg("--tcp-echo"); | 241 command_line->AppendArg("--tcp-echo"); |
| 244 break; | 242 break; |
| 245 case TYPE_UDP_ECHO: | 243 case TYPE_UDP_ECHO: |
| 246 command_line->AppendArg("--udp-echo"); | 244 command_line->AppendArg("--udp-echo"); |
| 247 break; | 245 break; |
| 248 case TYPE_BASIC_AUTH_PROXY: | 246 case TYPE_BASIC_AUTH_PROXY: |
| 249 command_line->AppendArg("--basic-auth-proxy"); | 247 command_line->AppendArg("--basic-auth-proxy"); |
| 250 break; | 248 break; |
| 251 case TYPE_GDATA: | 249 case TYPE_GDATA: |
| 252 command_line->AppendArg( | 250 command_line->AppendArg( |
| 253 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); | 251 std::string("--auth-token") + "=" + BaseTestServer::kGDataAuthToken); |
| 254 break; | 252 break; |
| 255 default: | 253 default: |
| 256 NOTREACHED(); | 254 NOTREACHED(); |
| 257 return false; | 255 return false; |
| 258 } | 256 } |
| 259 | 257 |
| 260 return true; | 258 return true; |
| 261 } | 259 } |
| 262 | 260 |
| 263 } // namespace net | 261 } // namespace net |
| OLD | NEW |