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

Side by Side Diff: base/process_util_unittest.cc

Issue 18192: Implemented process_util_mac.mm because net_unittests requires those function... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6 6
7 #include "base/multiprocess_test.h" 7 #include "base/multiprocess_test.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 exit(0); 48 exit(0);
49 return 0; 49 return 0;
50 } 50 }
51 51
52 #if defined(OS_WIN) 52 #if defined(OS_WIN)
53 #define EXE_SUFFIX L".exe" 53 #define EXE_SUFFIX L".exe"
54 #else 54 #else
55 #define EXE_SUFFIX L"" 55 #define EXE_SUFFIX L""
56 #endif 56 #endif
57 57
58 // TODO(port): finish port on Mac
59 #if !defined(OS_MACOSX)
60 TEST_F(ProcessUtilTest, KillSlowChild) { 58 TEST_F(ProcessUtilTest, KillSlowChild) {
61 remove("SlowChildProcess.die"); 59 remove("SlowChildProcess.die");
62 int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0); 60 int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
63 61
64 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); 62 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess");
65 63
66 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); 64 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
67 EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0)); 65 EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
68 FILE *fp = fopen("SlowChildProcess.die", "w"); 66 FILE *fp = fopen("SlowChildProcess.die", "w");
69 fclose(fp); 67 fclose(fp);
70 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); 68 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000));
71 EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0)); 69 EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
72 } 70 }
73 #endif
74 71
75 // TODO(estade): if possible, port these 2 tests. 72 // TODO(estade): if possible, port these 2 tests.
76 #if defined(OS_WIN) 73 #if defined(OS_WIN)
77 TEST_F(ProcessUtilTest, EnableLFH) { 74 TEST_F(ProcessUtilTest, EnableLFH) {
78 ASSERT_TRUE(EnableLowFragmentationHeap()); 75 ASSERT_TRUE(EnableLowFragmentationHeap());
79 if (IsDebuggerPresent()) { 76 if (IsDebuggerPresent()) {
80 // Under these conditions, LFH can't be enabled. There's no point to test 77 // Under these conditions, LFH can't be enabled. There's no point to test
81 // anything. 78 // anything.
82 const char* no_debug_env = getenv("_NO_DEBUG_HEAP"); 79 const char* no_debug_env = getenv("_NO_DEBUG_HEAP");
83 if (!no_debug_env || strcmp(no_debug_env, "1")) 80 if (!no_debug_env || strcmp(no_debug_env, "1"))
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 EXPECT_TRUE(WaitForSingleProcess(handle, 1000)); 220 EXPECT_TRUE(WaitForSingleProcess(handle, 1000));
224 close(fds[0]); 221 close(fds[0]);
225 close(sockets[0]); 222 close(sockets[0]);
226 close(sockets[1]); 223 close(sockets[1]);
227 close(dev_null); 224 close(dev_null);
228 } 225 }
229 226
230 #endif // defined(OS_POSIX) 227 #endif // defined(OS_POSIX)
231 228
232 } // namespace base 229 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698