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 <poll.h> | 7 #include <poll.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 OrphanedTestServerFilter filter(testserver_path.value(), | 132 OrphanedTestServerFilter filter(testserver_path.value(), |
133 base::IntToString(GetPort())); | 133 base::IntToString(GetPort())); |
134 if (!base::KillProcesses("python", -1, &filter)) { | 134 if (!base::KillProcesses("python", -1, &filter)) { |
135 LOG(WARNING) << "Failed to clean up older orphaned testserver instances."; | 135 LOG(WARNING) << "Failed to clean up older orphaned testserver instances."; |
136 } | 136 } |
137 | 137 |
138 // Launch a new testserver process. | 138 // Launch a new testserver process. |
139 base::LaunchOptions options; | 139 base::LaunchOptions options; |
140 | 140 |
141 options.fds_to_remap = &map_write_fd; | 141 options.fds_to_remap = &map_write_fd; |
142 if (!base::LaunchProcess(python_command, options, &process_handle_)) { | 142 process_ = base::LaunchProcess(python_command, options); |
| 143 if (!process_.IsValid()) { |
143 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 144 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); |
144 return false; | 145 return false; |
145 } | 146 } |
146 | 147 |
147 return true; | 148 return true; |
148 } | 149 } |
149 | 150 |
150 bool LocalTestServer::WaitToStart() { | 151 bool LocalTestServer::WaitToStart() { |
151 base::ScopedFD our_fd(child_fd_.release()); | 152 base::ScopedFD our_fd(child_fd_.release()); |
152 | 153 |
(...skipping 17 matching lines...) Expand all Loading... |
170 | 171 |
171 if (!ParseServerData(server_data)) { | 172 if (!ParseServerData(server_data)) { |
172 LOG(ERROR) << "Could not parse server_data: " << server_data; | 173 LOG(ERROR) << "Could not parse server_data: " << server_data; |
173 return false; | 174 return false; |
174 } | 175 } |
175 | 176 |
176 return true; | 177 return true; |
177 } | 178 } |
178 | 179 |
179 } // namespace net | 180 } // namespace net |
OLD | NEW |