| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sandbox/win/tests/common/controller.h" | 5 #include "sandbox/win/tests/common/controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 ::CloseHandle(target.hThread); | 240 ::CloseHandle(target.hThread); |
| 241 return SBOX_TEST_SUCCEEDED; | 241 return SBOX_TEST_SUCCEEDED; |
| 242 } | 242 } |
| 243 | 243 |
| 244 if (::IsDebuggerPresent()) { | 244 if (::IsDebuggerPresent()) { |
| 245 // Don't kill the target process on a time-out while we are debugging. | 245 // Don't kill the target process on a time-out while we are debugging. |
| 246 timeout_ = INFINITE; | 246 timeout_ = INFINITE; |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (WAIT_TIMEOUT == ::WaitForSingleObject(target.hProcess, timeout_)) { | 249 if (WAIT_TIMEOUT == ::WaitForSingleObject(target.hProcess, timeout_)) { |
| 250 ::TerminateProcess(target.hProcess, SBOX_TEST_TIMED_OUT); | 250 ::TerminateProcess(target.hProcess, static_cast<UINT>(SBOX_TEST_TIMED_OUT)); |
| 251 ::CloseHandle(target.hProcess); | 251 ::CloseHandle(target.hProcess); |
| 252 ::CloseHandle(target.hThread); | 252 ::CloseHandle(target.hThread); |
| 253 return SBOX_TEST_TIMED_OUT; | 253 return SBOX_TEST_TIMED_OUT; |
| 254 } | 254 } |
| 255 | 255 |
| 256 DWORD exit_code = SBOX_TEST_LAST_RESULT; | 256 DWORD exit_code = static_cast<DWORD>(SBOX_TEST_LAST_RESULT); |
| 257 if (!::GetExitCodeProcess(target.hProcess, &exit_code)) { | 257 if (!::GetExitCodeProcess(target.hProcess, &exit_code)) { |
| 258 ::CloseHandle(target.hProcess); | 258 ::CloseHandle(target.hProcess); |
| 259 ::CloseHandle(target.hThread); | 259 ::CloseHandle(target.hThread); |
| 260 return SBOX_TEST_FAILED_TO_RUN_TEST; | 260 return SBOX_TEST_FAILED_TO_RUN_TEST; |
| 261 } | 261 } |
| 262 | 262 |
| 263 ::CloseHandle(target.hProcess); | 263 ::CloseHandle(target.hProcess); |
| 264 ::CloseHandle(target.hThread); | 264 ::CloseHandle(target.hThread); |
| 265 | 265 |
| 266 return exit_code; | 266 return exit_code; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 target->LowerToken(); | 328 target->LowerToken(); |
| 329 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { | 329 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { |
| 330 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 330 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
| 331 } | 331 } |
| 332 | 332 |
| 333 return command(argc - 4, argv + 4); | 333 return command(argc - 4, argv + 4); |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace sandbox | 336 } // namespace sandbox |
| OLD | NEW |