diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 21:44:15 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 21:44:15 +0000 |
commit | 1c697f540722664820c3cfb5e00b9cb935b44f00 (patch) | |
tree | 9a2d32edd3e139a6bb5bee24500e973ed22bea6d /sandbox/tests | |
parent | fada540a9f88ea6b70d783b29cc55184c94f95f2 (diff) | |
download | chromium_src-1c697f540722664820c3cfb5e00b9cb935b44f00.zip chromium_src-1c697f540722664820c3cfb5e00b9cb935b44f00.tar.gz chromium_src-1c697f540722664820c3cfb5e00b9cb935b44f00.tar.bz2 |
Do not time out in TestRunner while is being debugged
- Makes it impossible to debug without changing the code.
Review URL: http://codereview.chromium.org/2997
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/tests')
-rw-r--r-- | sandbox/tests/common/controller.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sandbox/tests/common/controller.cc b/sandbox/tests/common/controller.cc index 6ed9cbf..e07947a 100644 --- a/sandbox/tests/common/controller.cc +++ b/sandbox/tests/common/controller.cc @@ -12,9 +12,6 @@ namespace { -// Set this value to 1 to avoid timeouts while debugging the tests. -#define RUN_WITHOUT_TIMEOUTS 0 - static const int kDefaultTimeout = 3000; } // namespace @@ -144,11 +141,11 @@ int TestRunner::InternalRunTest(const wchar_t* command) { if (!is_init_) return SBOX_TEST_FAILED_TO_RUN_TEST; - // Get the path to the sandboxed app. + // Get the path to the sandboxed process. wchar_t prog_name[MAX_PATH]; GetModuleFileNameW(NULL, prog_name, MAX_PATH); - // Launch the app. + // Launch the sandboxed process. ResultCode result = SBOX_ALL_OK; PROCESS_INFORMATION target = {0}; @@ -165,9 +162,10 @@ int TestRunner::InternalRunTest(const wchar_t* command) { ::ResumeThread(target.hThread); -#if RUN_WITHOUT_TIMEOUTS - timeout_ = INFINITE; -#endif + if (::IsDebuggerPresent()) { + // Don't kill the target process on a time-out while we are debugging. + timeout_ = INFINITE; + } if (WAIT_TIMEOUT == ::WaitForSingleObject(target.hProcess, timeout_)) { ::TerminateProcess(target.hProcess, SBOX_TEST_TIMED_OUT); @@ -203,7 +201,7 @@ void TestRunner::SetTestState(SboxTestsState desired_state) { // argv[1] = "-child" // argv[2] = SboxTestsState when to run the command // argv[3] = command to run -// argv[4...] = command arguments +// argv[4...] = command arguments. int DispatchCall(int argc, wchar_t **argv) { if (argc < 4) return SBOX_TEST_INVALID_PARAMETER; @@ -231,7 +229,6 @@ int DispatchCall(int argc, wchar_t **argv) { std::string command_name = base::SysWideToUTF8(argv[3]); CommandFunction command = reinterpret_cast<CommandFunction>( ::GetProcAddress(module, command_name.c_str())); - if (!command) return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; @@ -253,7 +250,6 @@ int DispatchCall(int argc, wchar_t **argv) { command(argc - 4, argv + 4); target->LowerToken(); - return command(argc - 4, argv + 4); } |