diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 03:12:13 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 03:12:13 +0000 |
commit | d82629b8dc534f937c68a9f60cdc657197729fad (patch) | |
tree | 475d2d19d506e66431ac95991e6d3d95d5352ccf /chrome | |
parent | 89858523fc64f04e40e969cae9a43e8ae5031669 (diff) | |
download | chromium_src-d82629b8dc534f937c68a9f60cdc657197729fad.zip chromium_src-d82629b8dc534f937c68a9f60cdc657197729fad.tar.gz chromium_src-d82629b8dc534f937c68a9f60cdc657197729fad.tar.bz2 |
Revert 21259 because it broke the unit tests on windows.
-
Commit message:
Add a unit test for ProcessWatcher::EnsureProcessTerminated().
Review URL: http://codereview.chromium.org/155799
-
Review URL: http://codereview.chromium.org/159188
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21263 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/process_watcher_unittest.cc | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/chrome/common/process_watcher_unittest.cc b/chrome/common/process_watcher_unittest.cc deleted file mode 100644 index d794d60..0000000 --- a/chrome/common/process_watcher_unittest.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/platform_thread.h" -#include "base/multiprocess_test.h" -#include "chrome/common/process_watcher.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -class ProcessWatcherTest : public MultiProcessTest { -}; - -MULTIPROCESS_TEST_MAIN(Sleep1ChildProcess) { - PlatformThread::Sleep(1000); - exit(0); - return 0; -} - -MULTIPROCESS_TEST_MAIN(Sleep3ChildProcess) { - PlatformThread::Sleep(3000); - exit(0); - return 0; -} - -TEST_F(ProcessWatcherTest, DiesBeforeTermination) { - base::ProcessHandle handle = this->SpawnChild(L"Sleep1ChildProcess"); - ASSERT_NE(static_cast<base::ProcessHandle>(NULL), handle); - - ProcessWatcher::EnsureProcessTerminated(handle); - - PlatformThread::Sleep(2500); - // Normally we don't touch |handle| after calling EnsureProcessTerminated, - // but we know the EnsureProcessTerminated process finishes in 2000 ms, so - // it's safe to do so now. Same for Terminated test case below. - EXPECT_FALSE(base::CrashAwareSleep(handle, 0)); -} - -TEST_F(ProcessWatcherTest, Terminated) { - base::ProcessHandle handle = this->SpawnChild(L"Sleep3ChildProcess"); - ASSERT_NE(static_cast<base::ProcessHandle>(NULL), handle); - - ProcessWatcher::EnsureProcessTerminated(handle); - - PlatformThread::Sleep(2500); - EXPECT_FALSE(base::CrashAwareSleep(handle, 0)); -} - -TEST_F(ProcessWatcherTest, NotTerminated) { - base::ProcessHandle handle = this->SpawnChild(L"Sleep3ChildProcess"); - ASSERT_NE(static_cast<base::ProcessHandle>(NULL), handle); - - EXPECT_TRUE(base::CrashAwareSleep(handle, 2500)); - EXPECT_FALSE(base::CrashAwareSleep(handle, 1000)); -} - -} // namespace |