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

Unified Diff: net/test/spawned_test_server/local_test_server.cc

Issue 145873004: Give localserver time to shut down (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use TerminateJobObject. Restore KillProcess for Windows Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/spawned_test_server/local_test_server.cc
diff --git a/net/test/spawned_test_server/local_test_server.cc b/net/test/spawned_test_server/local_test_server.cc
index 7ee12b99f69fc5032ea477c5ca8a1915547e835f..599559709381fc732733fe18f9b48fa6f077536d 100644
--- a/net/test/spawned_test_server/local_test_server.cc
+++ b/net/test/spawned_test_server/local_test_server.cc
@@ -126,14 +126,17 @@ bool LocalTestServer::Stop() {
#if defined(OS_WIN)
// This kills all the processes in the job object.
- job_handle_.Close();
+ bool ret = TerminateJobObject(job_handle_, 0);
Paweł Hajdan Jr. 2014/02/18 19:29:54 Can this actually fail? If so, when and why? How
M-A Ruel 2014/02/18 19:39:33 Sigbjorn found out it is actually killing containe
sigbjorn 2014/02/19 09:29:13 Our tests would have random failures due to this f
Paweł Hajdan Jr. 2014/02/19 19:20:49 Could you try this instead? 1. Close the job hand
sigbjorn 2014/02/20 09:25:56 You mean like patch set 1 did? Except change the h
Paweł Hajdan Jr. 2014/02/20 19:06:20 Sounds reasonable.
sigbjorn 2014/02/21 13:02:10 Now in patch set 5
+ // If necessary, wait for the processes to terminate.
+ if (!ret)
+ ret = base::WaitForSingleProcess(process_handle_,
+ base::TimeDelta::FromSeconds(60));
+#else
+ bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
#endif
- // First check if the process has already terminated.
- bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
- if (!ret) {
+ if (!ret)
ret = base::KillProcess(process_handle_, 1, true);
- }
if (ret) {
base::CloseProcessHandle(process_handle_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698