OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test_server.h" | 5 #include "net/test/test_server.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 return true; | 80 return true; |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 namespace net { | 85 namespace net { |
86 | 86 |
87 bool TestServer::LaunchPython(const FilePath& testserver_path) { | 87 // static |
| 88 FilePath TestServer::GetAbsolutePythonCommandPath() { |
88 FilePath python_exe; | 89 FilePath python_exe; |
89 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) | 90 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) |
90 return false; | 91 return FilePath(); |
91 python_exe = python_exe | 92 python_exe = python_exe |
92 .Append(FILE_PATH_LITERAL("third_party")) | 93 .Append(FILE_PATH_LITERAL("third_party")) |
93 .Append(FILE_PATH_LITERAL("python_26")) | 94 .Append(FILE_PATH_LITERAL("python_26")) |
94 .Append(FILE_PATH_LITERAL("python.exe")); | 95 .Append(FILE_PATH_LITERAL("python.exe")); |
| 96 return python_exe; |
| 97 } |
95 | 98 |
96 CommandLine python_command(python_exe); | 99 bool TestServer::LaunchPython(const FilePath& testserver_path) { |
| 100 CommandLine python_command(GetAbsolutePythonCommandPath()); |
97 python_command.AppendArgPath(testserver_path); | 101 python_command.AppendArgPath(testserver_path); |
98 if (!AddCommandLineArguments(&python_command)) | 102 if (!AddCommandLineArguments(&python_command)) |
99 return false; | 103 return false; |
100 | 104 |
101 HANDLE child_read = NULL; | 105 HANDLE child_read = NULL; |
102 HANDLE child_write = NULL; | 106 HANDLE child_write = NULL; |
103 if (!CreatePipe(&child_read, &child_write, NULL, 0)) { | 107 if (!CreatePipe(&child_read, &child_write, NULL, 0)) { |
104 PLOG(ERROR) << "Failed to create pipe"; | 108 PLOG(ERROR) << "Failed to create pipe"; |
105 return false; | 109 return false; |
106 } | 110 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 173 |
170 if (!ParseServerData(server_data)) { | 174 if (!ParseServerData(server_data)) { |
171 LOG(ERROR) << "Could not parse server_data: " << server_data; | 175 LOG(ERROR) << "Could not parse server_data: " << server_data; |
172 return false; | 176 return false; |
173 } | 177 } |
174 | 178 |
175 return true; | 179 return true; |
176 } | 180 } |
177 | 181 |
178 } // namespace net | 182 } // namespace net |
OLD | NEW |