diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 06:33:02 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 06:33:02 +0000 |
commit | 19ea801cbc751f8dff4c01ab108003b43f5bf5a4 (patch) | |
tree | 99f7bf5bdab84dd6b0284d265b9134a48850800a /base | |
parent | 52f604edea346ddf298ce4b0828bf6dfd8e61eca (diff) | |
download | chromium_src-19ea801cbc751f8dff4c01ab108003b43f5bf5a4.zip chromium_src-19ea801cbc751f8dff4c01ab108003b43f5bf5a4.tar.gz chromium_src-19ea801cbc751f8dff4c01ab108003b43f5bf5a4.tar.bz2 |
Adding GetProcId unittest
- I want to refactor the windows version. But first I need a test.
BUG=none
TEST=yes it is.
Review URL: http://codereview.chromium.org/9283009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util_unittest.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 426a78f..c37de36 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -172,6 +172,20 @@ TEST_F(ProcessUtilTest, MAYBE_GetTerminationStatusExit) { remove(kSignalFileSlow); } +#if defined(OS_WIN) +// TODO(cpu): figure out how to test this in other platforms. +TEST_F(ProcessUtilTest, GetProcId) { + base::ProcessId id1 = base::GetProcId(GetCurrentProcess()); + EXPECT_NE(0ul, id1); + base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false); + ASSERT_NE(base::kNullProcessHandle, handle); + base::ProcessId id2 = base::GetProcId(handle); + EXPECT_NE(0ul, id2); + EXPECT_NE(id1, id2); + base::CloseProcessHandle(handle); +} +#endif + #if !defined(OS_MACOSX) // This test is disabled on Mac, since it's flaky due to ReportCrash // taking a variable amount of time to parse and load the debug and |