| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 | 7 |
| 8 #include "net/base/ssl_test_util.h" | 8 #include "net/base/ssl_test_util.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)); | 145 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)); |
| 146 third_party_dir = third_party_dir.Append(FILE_PATH_LITERAL("third_party")); | 146 third_party_dir = third_party_dir.Append(FILE_PATH_LITERAL("third_party")); |
| 147 | 147 |
| 148 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("tlslite"))); | 148 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("tlslite"))); |
| 149 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("pyftpdlib"))); | 149 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("pyftpdlib"))); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool TestServerLauncher::Start(Protocol protocol, | 152 bool TestServerLauncher::Start(Protocol protocol, |
| 153 const std::string& host_name, int port, | 153 const std::string& host_name, int port, |
| 154 const FilePath& document_root, | 154 const FilePath& document_root, |
| 155 const FilePath& cert_path) { | 155 const FilePath& cert_path, |
| 156 const std::wstring& file_root_url) { |
| 156 if (!cert_path.value().empty()) { | 157 if (!cert_path.value().empty()) { |
| 157 if (!LoadTestRootCert()) | 158 if (!LoadTestRootCert()) |
| 158 return false; | 159 return false; |
| 159 if (!CheckCATrusted()) | 160 if (!CheckCATrusted()) |
| 160 return false; | 161 return false; |
| 161 } | 162 } |
| 162 | 163 |
| 163 std::string port_str = IntToString(port); | 164 std::string port_str = IntToString(port); |
| 164 | 165 |
| 165 // Get path to python server script | 166 // Get path to python server script |
| (...skipping 25 matching lines...) Expand all Loading... |
| 191 L"\"" + testserver_path.ToWStringHack() + | 192 L"\"" + testserver_path.ToWStringHack() + |
| 192 L"\" --port=" + UTF8ToWide(port_str) + | 193 L"\" --port=" + UTF8ToWide(port_str) + |
| 193 L" --data-dir=\"" + document_root_dir_.ToWStringHack() + L"\""; | 194 L" --data-dir=\"" + document_root_dir_.ToWStringHack() + L"\""; |
| 194 if (protocol == ProtoFTP) | 195 if (protocol == ProtoFTP) |
| 195 command_line.append(L" -f"); | 196 command_line.append(L" -f"); |
| 196 if (!cert_path.value().empty()) { | 197 if (!cert_path.value().empty()) { |
| 197 command_line.append(L" --https=\""); | 198 command_line.append(L" --https=\""); |
| 198 command_line.append(cert_path.ToWStringHack()); | 199 command_line.append(cert_path.ToWStringHack()); |
| 199 command_line.append(L"\""); | 200 command_line.append(L"\""); |
| 200 } | 201 } |
| 202 if (!file_root_url.empty()) { |
| 203 command_line.append(L" --file-root-url=\""); |
| 204 command_line.append(file_root_url); |
| 205 command_line.append(L"\""); |
| 206 } |
| 201 | 207 |
| 202 if (!base::LaunchApp(command_line, false, true, &process_handle_)) { | 208 if (!base::LaunchApp(command_line, false, true, &process_handle_)) { |
| 203 LOG(ERROR) << "Failed to launch " << command_line; | 209 LOG(ERROR) << "Failed to launch " << command_line; |
| 204 return false; | 210 return false; |
| 205 } | 211 } |
| 206 #elif defined(OS_POSIX) | 212 #elif defined(OS_POSIX) |
| 207 std::vector<std::string> command_line; | 213 std::vector<std::string> command_line; |
| 208 command_line.push_back("python"); | 214 command_line.push_back("python"); |
| 209 command_line.push_back(WideToUTF8(testserver_path.ToWStringHack())); | 215 command_line.push_back(WideToUTF8(testserver_path.ToWStringHack())); |
| 210 command_line.push_back("--port=" + port_str); | 216 command_line.push_back("--port=" + port_str); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 "certificate to your trusted roots for this test to work. " | 356 "certificate to your trusted roots for this test to work. " |
| 351 "For more info visit:\n" | 357 "For more info visit:\n" |
| 352 "http://dev.chromium.org/developers/testing\n"; | 358 "http://dev.chromium.org/developers/testing\n"; |
| 353 return false; | 359 return false; |
| 354 } | 360 } |
| 355 #endif | 361 #endif |
| 356 return true; | 362 return true; |
| 357 } | 363 } |
| 358 | 364 |
| 359 } // namespace net | 365 } // namespace net |
| OLD | NEW |