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/spawned_test_server/local_test_server.h" | 5 #include "net/test/spawned_test_server/local_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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 LOG(ERROR) << "Could not create JobObject."; | 183 LOG(ERROR) << "Could not create JobObject."; |
184 return false; | 184 return false; |
185 } | 185 } |
186 | 186 |
187 if (!base::SetJobObjectLimitFlags(job_handle_.Get(), | 187 if (!base::SetJobObjectLimitFlags(job_handle_.Get(), |
188 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE)) { | 188 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE)) { |
189 LOG(ERROR) << "Could not SetJobObjectLimitFlags."; | 189 LOG(ERROR) << "Could not SetJobObjectLimitFlags."; |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 // Add our internal python to the path so it can be used if there is | |
194 // no system python. | |
195 base::FilePath python_dir; | |
196 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_dir)) { | |
197 LOG(ERROR) << "Could not locate source root directory."; | |
198 return false; | |
199 } | |
200 python_dir = python_dir.AppendASCII("third_party").AppendASCII("python_26"); | |
201 ScopedPath python_path(python_dir); | |
202 base::LaunchOptions launch_options; | 193 base::LaunchOptions launch_options; |
203 launch_options.inherit_handles = true; | 194 launch_options.inherit_handles = true; |
204 launch_options.job_handle = job_handle_.Get(); | 195 launch_options.job_handle = job_handle_.Get(); |
205 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) { | 196 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) { |
206 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 197 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); |
207 return false; | 198 return false; |
208 } | 199 } |
209 | 200 |
210 return true; | 201 return true; |
211 } | 202 } |
(...skipping 19 matching lines...) Expand all Loading... |
231 if (!ParseServerData(server_data)) { | 222 if (!ParseServerData(server_data)) { |
232 LOG(ERROR) << "Could not parse server_data: " << server_data; | 223 LOG(ERROR) << "Could not parse server_data: " << server_data; |
233 return false; | 224 return false; |
234 } | 225 } |
235 | 226 |
236 return true; | 227 return true; |
237 } | 228 } |
238 | 229 |
239 } // namespace net | 230 } // namespace net |
240 | 231 |
OLD | NEW |