Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2311)

Unified Diff: base/process_util_unittest.cc

Issue 10895: Add Terminate() to the Process object, have RenderProcessHost use this to avo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process_util_linux.cc ('k') | base/process_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_unittest.cc
===================================================================
--- base/process_util_unittest.cc (revision 5371)
+++ base/process_util_unittest.cc (working copy)
@@ -15,7 +15,8 @@
#include <dlfcn.h>
#endif
-namespace {
+namespace base {
+
class ProcessUtilTest : public MultiProcessTest {
};
@@ -27,7 +28,7 @@
ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess");
ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
- EXPECT_TRUE(process_util::WaitForSingleProcess(handle, 1000));
+ EXPECT_TRUE(WaitForSingleProcess(handle, 1000));
}
MULTIPROCESS_TEST_MAIN(SlowChildProcess) {
@@ -53,24 +54,24 @@
#if !defined(OS_MACOSX)
TEST_F(ProcessUtilTest, KillSlowChild) {
remove("SlowChildProcess.die");
- int oldcount = process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
+ int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
ProcessHandle handle = this->SpawnChild(L"SlowChildProcess");
ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
- EXPECT_EQ(oldcount+1, process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
+ EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
FILE *fp = fopen("SlowChildProcess.die", "w");
fclose(fp);
// TODO(port): do something less racy here
PlatformThread::Sleep(1000);
- EXPECT_EQ(oldcount, process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
+ EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
}
#endif
// TODO(estade): if possible, port these 2 tests.
#if defined(OS_WIN)
TEST_F(ProcessUtilTest, EnableLFH) {
- ASSERT_TRUE(process_util::EnableLowFragmentationHeap());
+ ASSERT_TRUE(EnableLowFragmentationHeap());
if (IsDebuggerPresent()) {
// Under these conditions, LFH can't be enabled. There's no point to test
// anything.
@@ -101,13 +102,13 @@
}
TEST_F(ProcessUtilTest, CalcFreeMemory) {
- process_util::ProcessMetrics* metrics =
- process_util::ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess());
+ ProcessMetrics* metrics =
+ ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess());
ASSERT_TRUE(NULL != metrics);
// Typical values here is ~1900 for total and ~1000 for largest. Obviously
// it depends in what other tests have done to this process.
- process_util::FreeMBytes free_mem1 = {0};
+ FreeMBytes free_mem1 = {0};
EXPECT_TRUE(metrics->CalculateFreeMemory(&free_mem1));
EXPECT_LT(10u, free_mem1.total);
EXPECT_LT(10u, free_mem1.largest);
@@ -124,7 +125,7 @@
size_t expected_total = free_mem1.total - kAllocMB;
size_t expected_largest = free_mem1.largest;
- process_util::FreeMBytes free_mem2 = {0};
+ FreeMBytes free_mem2 = {0};
EXPECT_TRUE(metrics->CalculateFreeMemory(&free_mem2));
EXPECT_GE(free_mem2.total, free_mem2.largest);
EXPECT_GE(expected_total, free_mem2.total);
@@ -136,4 +137,4 @@
}
#endif // defined(OS_WIN)
-} // namespace
+} // namespace base
« no previous file with comments | « base/process_util_linux.cc ('k') | base/process_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698