OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/spawned_test_server/local_test_server.h" | 5 #include "net/test/spawned_test_server/local_test_server.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 } | 119 } |
120 | 120 |
121 bool LocalTestServer::Stop() { | 121 bool LocalTestServer::Stop() { |
122 CleanUpWhenStoppingServer(); | 122 CleanUpWhenStoppingServer(); |
123 | 123 |
124 if (!process_handle_) | 124 if (!process_handle_) |
125 return true; | 125 return true; |
126 | 126 |
127 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
128 // This kills all the processes in the job object. | 128 // This kills all the processes in the job object. |
129 job_handle_.Close(); | 129 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
| |
130 // If necessary, wait for the processes to terminate. | |
131 if (!ret) | |
132 ret = base::WaitForSingleProcess(process_handle_, | |
133 base::TimeDelta::FromSeconds(60)); | |
134 #else | |
135 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); | |
130 #endif | 136 #endif |
131 | 137 |
132 // First check if the process has already terminated. | 138 if (!ret) |
133 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); | |
134 if (!ret) { | |
135 ret = base::KillProcess(process_handle_, 1, true); | 139 ret = base::KillProcess(process_handle_, 1, true); |
136 } | |
137 | 140 |
138 if (ret) { | 141 if (ret) { |
139 base::CloseProcessHandle(process_handle_); | 142 base::CloseProcessHandle(process_handle_); |
140 process_handle_ = base::kNullProcessHandle; | 143 process_handle_ = base::kNullProcessHandle; |
141 } else { | 144 } else { |
142 VLOG(1) << "Kill failed?"; | 145 VLOG(1) << "Kill failed?"; |
143 } | 146 } |
144 | 147 |
145 return ret; | 148 return ret; |
146 } | 149 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 break; | 252 break; |
250 default: | 253 default: |
251 NOTREACHED(); | 254 NOTREACHED(); |
252 return false; | 255 return false; |
253 } | 256 } |
254 | 257 |
255 return true; | 258 return true; |
256 } | 259 } |
257 | 260 |
258 } // namespace net | 261 } // namespace net |
OLD | NEW |