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" | |
| 12 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/values.h" | 12 #include "base/values.h" |
| 14 #include "net/base/host_port_pair.h" | 13 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 16 #include "net/test/python_utils.h" | 15 #include "net/test/python_utils.h" |
| 17 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 18 | 17 |
| 19 namespace net { | 18 namespace net { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 bool LocalTestServer::Stop() { | 120 bool LocalTestServer::Stop() { |
| 122 CleanUpWhenStoppingServer(); | 121 CleanUpWhenStoppingServer(); |
| 123 | 122 |
| 124 if (!process_.IsValid()) | 123 if (!process_.IsValid()) |
| 125 return true; | 124 return true; |
| 126 | 125 |
| 127 // First check if the process has already terminated. | 126 // First check if the process has already terminated. |
| 128 int exit_code; | 127 int exit_code; |
| 129 bool ret = process_.WaitForExitWithTimeout(base::TimeDelta(), &exit_code); | 128 bool ret = process_.WaitForExitWithTimeout(base::TimeDelta(), &exit_code); |
| 130 if (!ret) | 129 if (!ret) |
| 131 ret = base::KillProcess(process_.Handle(), 1, true); | 130 ret = process_.Terminate(1, true); |
|
cpu_(ooo_6.6-7.5)
2015/03/17 20:36:31
seems buggy, there is a explicit timeout above so
rvargas (doing something else)
2015/03/17 22:40:53
The timeout above is 0, so it's not waiting.
| |
| 132 | 131 |
| 133 if (ret) | 132 if (ret) |
| 134 process_.Close(); | 133 process_.Close(); |
| 135 else | 134 else |
| 136 VLOG(1) << "Kill failed?"; | 135 VLOG(1) << "Kill failed?"; |
| 137 | 136 |
| 138 return ret; | 137 return ret; |
| 139 } | 138 } |
| 140 | 139 |
| 141 bool LocalTestServer::Init(const base::FilePath& document_root) { | 140 bool LocalTestServer::Init(const base::FilePath& document_root) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 break; | 241 break; |
| 243 default: | 242 default: |
| 244 NOTREACHED(); | 243 NOTREACHED(); |
| 245 return false; | 244 return false; |
| 246 } | 245 } |
| 247 | 246 |
| 248 return true; | 247 return true; |
| 249 } | 248 } |
| 250 | 249 |
| 251 } // namespace net | 250 } // namespace net |
| OLD | NEW |