Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: net/test/test_server_posix.cc

Issue 5196001: Made testserver communicate to parent process with JSON (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced to head Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/test/test_server.cc ('k') | net/test/test_server_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 return true; 133 return true;
134 } 134 }
135 135
136 bool TestServer::WaitToStart() { 136 bool TestServer::WaitToStart() {
137 file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); 137 file_util::ScopedFD child_fd_closer(child_fd_closer_.release());
138 138
139 base::TimeDelta remaining_time = base::TimeDelta::FromMilliseconds( 139 base::TimeDelta remaining_time = base::TimeDelta::FromMilliseconds(
140 TestTimeouts::action_max_timeout_ms()); 140 TestTimeouts::action_max_timeout_ms());
141 141
142 // Try to read two bytes from the pipe indicating the ephemeral port number. 142 uint32 server_data_len = 0;
143 uint16 port = 0; 143 if (!ReadData(child_fd_, sizeof(server_data_len),
144 if (!ReadData(child_fd_, sizeof(port), 144 reinterpret_cast<uint8*>(&server_data_len),
145 reinterpret_cast<uint8*>(&port), &remaining_time)) { 145 &remaining_time)) {
146 LOG(ERROR) << "Could not read port"; 146 LOG(ERROR) << "Could not read server_data_len";
147 return false;
148 }
149 std::string server_data(server_data_len, '\0');
150 if (!ReadData(child_fd_, server_data_len,
151 reinterpret_cast<uint8*>(&server_data[0]),
152 &remaining_time)) {
153 LOG(ERROR) << "Could not read server_data (" << server_data_len
154 << " bytes)";
147 return false; 155 return false;
148 } 156 }
149 157
150 host_port_pair_.set_port(port); 158 if (!ParseServerData(server_data)) {
159 LOG(ERROR) << "Could not parse server_data: " << server_data;
160 return false;
161 }
162
151 return true; 163 return true;
152 } 164 }
153 165
154 bool TestServer::CheckCATrusted() { 166 bool TestServer::CheckCATrusted() {
155 return true; 167 return true;
156 } 168 }
157 169
158 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « net/test/test_server.cc ('k') | net/test/test_server_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698