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 20 matching lines...) Expand all Loading... |
31 STARTUPINFO startup_info = {0}; | 31 STARTUPINFO startup_info = {0}; |
32 startup_info.cb = sizeof(startup_info); | 32 startup_info.cb = sizeof(startup_info); |
33 startup_info.dwFlags = STARTF_USESHOWWINDOW; | 33 startup_info.dwFlags = STARTF_USESHOWWINDOW; |
34 startup_info.wShowWindow = start_hidden ? SW_HIDE : SW_SHOW; | 34 startup_info.wShowWindow = start_hidden ? SW_HIDE : SW_SHOW; |
35 PROCESS_INFORMATION process_info; | 35 PROCESS_INFORMATION process_info; |
36 | 36 |
37 // If this code is run under a debugger, the test server process is | 37 // If this code is run under a debugger, the test server process is |
38 // automatically associated with a job object created by the debugger. | 38 // automatically associated with a job object created by the debugger. |
39 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. | 39 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. |
40 if (!CreateProcess( | 40 if (!CreateProcess( |
41 NULL, const_cast<wchar_t*>(cmdline.command_line_string().c_str()), | 41 NULL, const_cast<wchar_t*>(cmdline.GetCommandLineString().c_str()), |
42 NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, | 42 NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, |
43 &startup_info, &process_info)) { | 43 &startup_info, &process_info)) { |
44 LOG(ERROR) << "Could not create process."; | 44 LOG(ERROR) << "Could not create process."; |
45 return false; | 45 return false; |
46 } | 46 } |
47 CloseHandle(process_info.hThread); | 47 CloseHandle(process_info.hThread); |
48 | 48 |
49 // If the caller wants the process handle, we won't close it. | 49 // If the caller wants the process handle, we won't close it. |
50 if (process_handle) { | 50 if (process_handle) { |
51 *process_handle = process_info.hProcess; | 51 *process_handle = process_info.hProcess; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // safe to truncate the handle (when passing it from 64-bit to | 176 // safe to truncate the handle (when passing it from 64-bit to |
177 // 32-bit) or sign-extend the handle (when passing it from 32-bit to | 177 // 32-bit) or sign-extend the handle (when passing it from 32-bit to |
178 // 64-bit)." | 178 // 64-bit)." |
179 python_command.AppendArg("--startup-pipe=" + | 179 python_command.AppendArg("--startup-pipe=" + |
180 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); | 180 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); |
181 | 181 |
182 if (!LaunchTestServerAsJob(python_command, | 182 if (!LaunchTestServerAsJob(python_command, |
183 true, | 183 true, |
184 &process_handle_, | 184 &process_handle_, |
185 &job_handle_)) { | 185 &job_handle_)) { |
186 LOG(ERROR) << "Failed to launch " << python_command.command_line_string(); | 186 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 return true; | 190 return true; |
191 } | 191 } |
192 | 192 |
193 bool TestServer::WaitToStart() { | 193 bool TestServer::WaitToStart() { |
194 base::win::ScopedHandle read_fd(child_read_fd_.Take()); | 194 base::win::ScopedHandle read_fd(child_read_fd_.Take()); |
195 base::win::ScopedHandle write_fd(child_write_fd_.Take()); | 195 base::win::ScopedHandle write_fd(child_write_fd_.Take()); |
196 | 196 |
(...skipping 13 matching lines...) Expand all Loading... |
210 | 210 |
211 if (!ParseServerData(server_data)) { | 211 if (!ParseServerData(server_data)) { |
212 LOG(ERROR) << "Could not parse server_data: " << server_data; | 212 LOG(ERROR) << "Could not parse server_data: " << server_data; |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 } // namespace net | 219 } // namespace net |
OLD | NEW |