| 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 <poll.h> | 7 #include <poll.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 python_command.AppendArg("--startup-pipe=" + base::IntToString(pipefd[1])); | 115 python_command.AppendArg("--startup-pipe=" + base::IntToString(pipefd[1])); |
| 116 | 116 |
| 117 // Try to kill any orphaned testserver processes that may be running. | 117 // Try to kill any orphaned testserver processes that may be running. |
| 118 OrphanedTestServerFilter filter(testserver_path.value(), | 118 OrphanedTestServerFilter filter(testserver_path.value(), |
| 119 base::IntToString(host_port_pair_.port())); | 119 base::IntToString(host_port_pair_.port())); |
| 120 if (!base::KillProcesses("python", -1, &filter)) { | 120 if (!base::KillProcesses("python", -1, &filter)) { |
| 121 LOG(WARNING) << "Failed to clean up older orphaned testserver instances."; | 121 LOG(WARNING) << "Failed to clean up older orphaned testserver instances."; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Launch a new testserver process. | 124 // Launch a new testserver process. |
| 125 if (!base::LaunchApp(python_command.argv(), map_write_fd, false, | 125 base::LaunchOptions options; |
| 126 &process_handle_)) { | 126 options.fds_to_remap = &map_write_fd; |
| 127 LOG(ERROR) << "Failed to launch " << python_command.command_line_string() | 127 options.process_handle = &process_handle_; |
| 128 << " ..."; | 128 if (!base::LaunchProcess(python_command, options)) { |
| 129 LOG(ERROR) << "Failed to launch " << python_command.command_line_string(); |
| 129 return false; | 130 return false; |
| 130 } | 131 } |
| 131 | 132 |
| 132 return true; | 133 return true; |
| 133 } | 134 } |
| 134 | 135 |
| 135 bool TestServer::WaitToStart() { | 136 bool TestServer::WaitToStart() { |
| 136 file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); | 137 file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); |
| 137 | 138 |
| 138 base::TimeDelta remaining_time = base::TimeDelta::FromMilliseconds( | 139 base::TimeDelta remaining_time = base::TimeDelta::FromMilliseconds( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 156 | 157 |
| 157 if (!ParseServerData(server_data)) { | 158 if (!ParseServerData(server_data)) { |
| 158 LOG(ERROR) << "Could not parse server_data: " << server_data; | 159 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 159 return false; | 160 return false; |
| 160 } | 161 } |
| 161 | 162 |
| 162 return true; | 163 return true; |
| 163 } | 164 } |
| 164 | 165 |
| 165 } // namespace net | 166 } // namespace net |
| OLD | NEW |