Chromium Code Reviews| 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" |
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 return SetupWhenServerStarted(); | 119 return SetupWhenServerStarted(); |
| 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. |
|
M-A Ruel
2014/03/18 19:36:04
Remove the change to lines 133-136 and replace lin
| |
| 129 job_handle_.Close(); | 130 job_handle_.Close(); |
| 130 #endif | 131 #endif |
| 131 | 132 |
| 132 // First check if the process has already terminated. | 133 // First check if the process has already terminated. |
| 133 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); | 134 bool ret = base::WaitForSingleProcess(process_handle_, |
| 134 if (!ret) { | 135 TestTimeouts::action_timeout()); |
| 136 if (!ret) | |
| 135 ret = base::KillProcess(process_handle_, 1, true); | 137 ret = base::KillProcess(process_handle_, 1, true); |
| 136 } | |
| 137 | 138 |
| 138 if (ret) { | 139 if (ret) { |
| 139 base::CloseProcessHandle(process_handle_); | 140 base::CloseProcessHandle(process_handle_); |
| 140 process_handle_ = base::kNullProcessHandle; | 141 process_handle_ = base::kNullProcessHandle; |
| 141 } else { | 142 } else { |
| 142 VLOG(1) << "Kill failed?"; | 143 VLOG(1) << "Kill failed?"; |
| 143 } | 144 } |
| 144 | 145 |
| 145 return ret; | 146 return ret; |
| 146 } | 147 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 break; | 250 break; |
| 250 default: | 251 default: |
| 251 NOTREACHED(); | 252 NOTREACHED(); |
| 252 return false; | 253 return false; |
| 253 } | 254 } |
| 254 | 255 |
| 255 return true; | 256 return true; |
| 256 } | 257 } |
| 257 | 258 |
| 258 } // namespace net | 259 } // namespace net |
| OLD | NEW |