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

Side by Side Diff: net/test/spawned_test_server/local_test_server.cc

Issue 74253002: Stop using third_party\python_26 for many tests. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Fix android, make it cleaner Created 7 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
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"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 return SetupWhenServerStarted(); 118 return SetupWhenServerStarted();
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)
128 // This kills all the processes in the job object.
129 job_handle_.Close();
130 #endif
131
127 // First check if the process has already terminated. 132 // First check if the process has already terminated.
128 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); 133 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
129 if (!ret) 134 if (!ret) {
130 ret = base::KillProcess(process_handle_, 1, true); 135 ret = base::KillProcess(process_handle_, 1, true);
136 }
131 137
132 if (ret) { 138 if (ret) {
133 base::CloseProcessHandle(process_handle_); 139 base::CloseProcessHandle(process_handle_);
134 process_handle_ = base::kNullProcessHandle; 140 process_handle_ = base::kNullProcessHandle;
135 } else { 141 } else {
136 VLOG(1) << "Kill failed?"; 142 VLOG(1) << "Kill failed?";
137 } 143 }
138 144
139 return ret; 145 return ret;
140 } 146 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 break; 249 break;
244 default: 250 default:
245 NOTREACHED(); 251 NOTREACHED();
246 return false; 252 return false;
247 } 253 }
248 254
249 return true; 255 return true;
250 } 256 }
251 257
252 } // namespace net 258 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698