From fb7f9bef3ceecd5a3efb9252410f6850320462b8 Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Wed, 22 Oct 2008 01:15:47 +0000 Subject: Added linux process utilities and tests. Review URL: http://codereview.chromium.org/7202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3715 0039d316-1c4b-4281-b951-d872f2087c98 --- base/process_util_unittest.cc | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'base/process_util_unittest.cc') diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index de51fc2..32595c9 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -4,10 +4,35 @@ #define _CRT_SECURE_NO_WARNINGS -#include "testing/gtest/include/gtest/gtest.h" +#include "base/multiprocess_test.h" #include "base/process_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if defined(OS_WIN) +#include +#elif defined(OS_LINUX) +#include +#endif + +namespace { +class ProcessUtilTest : public MultiProcessTest { +}; +} + +extern "C" int DYNAMIC_EXPORT SimpleChildProcess() { + return 0; +} + +TEST_F(ProcessUtilTest, SpawnChild) { + ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); + + ASSERT_NE(static_cast(NULL), handle); + EXPECT_TRUE(process_util::WaitForSingleProcess(handle, 1000)); +} -TEST(ProcessUtilTest, EnableLFH) { +// TODO(estade): if possible, port these 2 tests. +#if defined(OS_WIN) +TEST_F(ProcessUtilTest, EnableLFH) { ASSERT_TRUE(process_util::EnableLowFragmentationHeap()); if (IsDebuggerPresent()) { // Under these conditions, LFH can't be enabled. There's no point to test @@ -38,7 +63,7 @@ TEST(ProcessUtilTest, EnableLFH) { } } -TEST(ProcessUtilTest, CalcFreeMemory) { +TEST_F(ProcessUtilTest, CalcFreeMemory) { process_util::ProcessMetrics* metrics = process_util::ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess()); ASSERT_TRUE(NULL != metrics); @@ -72,4 +97,5 @@ TEST(ProcessUtilTest, CalcFreeMemory) { delete[] alloc; delete metrics; } +#endif // defined(OS_WIN) -- cgit v1.1