diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-22 01:15:47 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-22 01:15:47 +0000 |
commit | fb7f9bef3ceecd5a3efb9252410f6850320462b8 (patch) | |
tree | 95cefb13965daa20689cebec67e48352be1ccfbf /base/process_util_unittest.cc | |
parent | 0cbd643274f17abca0efaa82036ac8ccbc695be3 (diff) | |
download | chromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.zip chromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.tar.gz chromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.tar.bz2 |
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
Diffstat (limited to 'base/process_util_unittest.cc')
-rw-r--r-- | base/process_util_unittest.cc | 32 |
1 files changed, 29 insertions, 3 deletions
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 <windows.h> +#elif defined(OS_LINUX) +#include <dlfcn.h> +#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<ProcessHandle>(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) |