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/local_test_server.h" | 5 #include "net/test/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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 134 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 bool LocalTestServer::WaitToStart() { | 141 bool LocalTestServer::WaitToStart() { |
142 file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); | 142 file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); |
143 | 143 |
144 base::TimeDelta remaining_time = base::TimeDelta::FromMilliseconds( | 144 base::TimeDelta remaining_time = TestTimeouts::action_timeout(); |
145 TestTimeouts::action_timeout_ms()); | |
146 | 145 |
147 uint32 server_data_len = 0; | 146 uint32 server_data_len = 0; |
148 if (!ReadData(child_fd_, sizeof(server_data_len), | 147 if (!ReadData(child_fd_, sizeof(server_data_len), |
149 reinterpret_cast<uint8*>(&server_data_len), | 148 reinterpret_cast<uint8*>(&server_data_len), |
150 &remaining_time)) { | 149 &remaining_time)) { |
151 LOG(ERROR) << "Could not read server_data_len"; | 150 LOG(ERROR) << "Could not read server_data_len"; |
152 return false; | 151 return false; |
153 } | 152 } |
154 std::string server_data(server_data_len, '\0'); | 153 std::string server_data(server_data_len, '\0'); |
155 if (!ReadData(child_fd_, server_data_len, | 154 if (!ReadData(child_fd_, server_data_len, |
156 reinterpret_cast<uint8*>(&server_data[0]), | 155 reinterpret_cast<uint8*>(&server_data[0]), |
157 &remaining_time)) { | 156 &remaining_time)) { |
158 LOG(ERROR) << "Could not read server_data (" << server_data_len | 157 LOG(ERROR) << "Could not read server_data (" << server_data_len |
159 << " bytes)"; | 158 << " bytes)"; |
160 return false; | 159 return false; |
161 } | 160 } |
162 | 161 |
163 if (!ParseServerData(server_data)) { | 162 if (!ParseServerData(server_data)) { |
164 LOG(ERROR) << "Could not parse server_data: " << server_data; | 163 LOG(ERROR) << "Could not parse server_data: " << server_data; |
165 return false; | 164 return false; |
166 } | 165 } |
167 | 166 |
168 return true; | 167 return true; |
169 } | 168 } |
170 | 169 |
171 } // namespace net | 170 } // namespace net |
OLD | NEW |