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

Side by Side Diff: net/test/test_server_win.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_posix.cc ('k') | net/tools/testserver/testserver.py » ('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 <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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ScopedHandle read_fd(child_read_fd_.Take()); 194 ScopedHandle read_fd(child_read_fd_.Take());
195 ScopedHandle write_fd(child_write_fd_.Take()); 195 ScopedHandle write_fd(child_write_fd_.Take());
196 196
197 // Try to read two bytes from the pipe indicating the ephemeral port number. 197 uint32 server_data_len = 0;
198 uint16 port = 0; 198 if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len),
199 if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(port), 199 reinterpret_cast<uint8*>(&server_data_len))) {
200 reinterpret_cast<uint8*>(&port))) { 200 LOG(ERROR) << "Could not read server_data_len";
201 LOG(ERROR) << "Could not read port"; 201 return false;
202 }
203 std::string server_data(server_data_len, '\0');
204 if (!ReadData(read_fd.Get(), write_fd.Get(), server_data_len,
205 reinterpret_cast<uint8*>(&server_data[0]))) {
206 LOG(ERROR) << "Could not read server_data (" << server_data_len
207 << " bytes)";
202 return false; 208 return false;
203 } 209 }
204 210
205 host_port_pair_.set_port(port); 211 if (!ParseServerData(server_data)) {
212 LOG(ERROR) << "Could not parse server_data: " << server_data;
213 return false;
214 }
215
206 return true; 216 return true;
207 } 217 }
208 218
209 bool TestServer::CheckCATrusted() { 219 bool TestServer::CheckCATrusted() {
210 HCERTSTORE cert_store = CertOpenSystemStore(NULL, L"ROOT"); 220 HCERTSTORE cert_store = CertOpenSystemStore(NULL, L"ROOT");
211 if (!cert_store) { 221 if (!cert_store) {
212 LOG(ERROR) << " could not open trusted root CA store"; 222 LOG(ERROR) << " could not open trusted root CA store";
213 return false; 223 return false;
214 } 224 }
215 PCCERT_CONTEXT cert = 225 PCCERT_CONTEXT cert =
(...skipping 12 matching lines...) Expand all
228 "certificate to your trusted roots for this test to work. " 238 "certificate to your trusted roots for this test to work. "
229 "For more info visit:\n" 239 "For more info visit:\n"
230 "http://dev.chromium.org/developers/testing\n"; 240 "http://dev.chromium.org/developers/testing\n";
231 return false; 241 return false;
232 } 242 }
233 243
234 return true; 244 return true;
235 } 245 }
236 246
237 } // namespace net 247 } // namespace net
OLDNEW
« no previous file with comments | « net/test/test_server_posix.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698