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

Side by Side Diff: net/socket/ssl_test_util.cc

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months 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
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/socket/ssl_test_util.h" 5 #include "net/socket/ssl_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 LOG(INFO) << "Started on port " << port_str; 224 LOG(INFO) << "Started on port " << port_str;
225 return true; 225 return true;
226 } 226 }
227 227
228 bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) { 228 bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) {
229 // Verify that the webserver is actually started. 229 // Verify that the webserver is actually started.
230 // Otherwise tests can fail if they run faster than Python can start. 230 // Otherwise tests can fail if they run faster than Python can start.
231 net::AddressList addr; 231 net::AddressList addr;
232 scoped_refptr<net::HostResolver> resolver( 232 scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver());
233 net::CreateSystemHostResolver(NULL));
234 net::HostResolver::RequestInfo info(host_name, port); 233 net::HostResolver::RequestInfo info(host_name, port);
235 int rv = resolver->Resolve(info, &addr, NULL, NULL, BoundNetLog()); 234 int rv = resolver->Resolve(info, &addr, NULL, NULL, BoundNetLog());
236 if (rv != net::OK) 235 if (rv != net::OK)
237 return false; 236 return false;
238 237
239 net::TCPPinger pinger(addr); 238 net::TCPPinger pinger(addr);
240 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(connection_timeout_), 239 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(connection_timeout_),
241 connection_attempts_); 240 connection_attempts_);
242 return rv == net::OK; 241 return rv == net::OK;
243 } 242 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 base::ProcessHandle* process_handle, 361 base::ProcessHandle* process_handle,
363 ScopedHandle* job_handle) { 362 ScopedHandle* job_handle) {
364 // Launch test server process. 363 // Launch test server process.
365 STARTUPINFO startup_info = {0}; 364 STARTUPINFO startup_info = {0};
366 startup_info.cb = sizeof(startup_info); 365 startup_info.cb = sizeof(startup_info);
367 startup_info.dwFlags = STARTF_USESHOWWINDOW; 366 startup_info.dwFlags = STARTF_USESHOWWINDOW;
368 startup_info.wShowWindow = start_hidden ? SW_HIDE : SW_SHOW; 367 startup_info.wShowWindow = start_hidden ? SW_HIDE : SW_SHOW;
369 PROCESS_INFORMATION process_info; 368 PROCESS_INFORMATION process_info;
370 369
371 // If this code is run under a debugger, the test server process is 370 // If this code is run under a debugger, the test server process is
372 // automatically associated with a job object created by the debugger. 371 // automatically associated with a job object created by the debugger.
373 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. 372 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this.
374 if (!CreateProcess(NULL, 373 if (!CreateProcess(NULL,
375 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, 374 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL,
376 FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, 375 FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL,
377 &startup_info, &process_info)) { 376 &startup_info, &process_info)) {
378 LOG(ERROR) << "Could not create process."; 377 LOG(ERROR) << "Could not create process.";
379 return false; 378 return false;
380 } 379 }
381 CloseHandle(process_info.hThread); 380 CloseHandle(process_info.hThread);
382 381
(...skipping 22 matching lines...) Expand all
405 process_info.hProcess)) { 404 process_info.hProcess)) {
406 LOG(ERROR) << "Could not AssignProcessToObject."; 405 LOG(ERROR) << "Could not AssignProcessToObject.";
407 return false; 406 return false;
408 } 407 }
409 } 408 }
410 return true; 409 return true;
411 } 410 }
412 #endif 411 #endif
413 412
414 } // namespace net 413 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698