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

Side by Side 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: Proper windows timeout Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/process/kill.h" 11 #include "base/process/kill.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/test/test_timeouts.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "net/base/host_port_pair.h" 15 #include "net/base/host_port_pair.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/test/python_utils.h" 17 #include "net/test/python_utils.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 namespace { 22 namespace {
22 23
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 120 }
120 121
121 bool LocalTestServer::Stop() { 122 bool LocalTestServer::Stop() {
122 CleanUpWhenStoppingServer(); 123 CleanUpWhenStoppingServer();
123 124
124 if (!process_handle_) 125 if (!process_handle_)
125 return true; 126 return true;
126 127
127 #if defined(OS_WIN) 128 #if defined(OS_WIN)
128 // This kills all the processes in the job object. 129 // This kills all the processes in the job object.
130 TerminateJobObject(job_handle_.Get(), 1);
131 // This is done asynchronously so wait a bit for the processes to be killed.
132 WaitForSingleObject(job_handle_.Get(),
133 TestTimeouts::action_timeout().InMilliseconds());
129 job_handle_.Close(); 134 job_handle_.Close();
130 #endif 135 #endif
131 136
132 // First check if the process has already terminated. 137 // First check if the process has already terminated.
133 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); 138 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
134 if (!ret) { 139 if (!ret) {
135 ret = base::KillProcess(process_handle_, 1, true); 140 ret = base::KillProcess(process_handle_, 1, true);
136 } 141 }
137 142
138 if (ret) { 143 if (ret) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 break; 255 break;
251 default: 256 default:
252 NOTREACHED(); 257 NOTREACHED();
253 return false; 258 return false;
254 } 259 }
255 260
256 return true; 261 return true;
257 } 262 }
258 263
259 } // namespace net 264 } // namespace net
OLDNEW
« 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