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

Side by Side Diff: base/process_util_unittest.cc

Issue 195067: Turn NULL used as int to 0.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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.h ('k') | base/stats_table_unittest.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/eintr_wrapper.h" 8 #include "base/eintr_wrapper.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/multiprocess_test.h" 10 #include "base/multiprocess_test.h"
(...skipping 23 matching lines...) Expand all
34 #endif 34 #endif
35 }; 35 };
36 36
37 MULTIPROCESS_TEST_MAIN(SimpleChildProcess) { 37 MULTIPROCESS_TEST_MAIN(SimpleChildProcess) {
38 return 0; 38 return 0;
39 } 39 }
40 40
41 TEST_F(ProcessUtilTest, SpawnChild) { 41 TEST_F(ProcessUtilTest, SpawnChild) {
42 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); 42 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess");
43 43
44 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); 44 ASSERT_NE(base::kNullProcessHandle, handle);
45 EXPECT_TRUE(WaitForSingleProcess(handle, 5000)); 45 EXPECT_TRUE(WaitForSingleProcess(handle, 5000));
46 base::CloseProcessHandle(handle); 46 base::CloseProcessHandle(handle);
47 } 47 }
48 48
49 MULTIPROCESS_TEST_MAIN(SlowChildProcess) { 49 MULTIPROCESS_TEST_MAIN(SlowChildProcess) {
50 // Sleep until file "SlowChildProcess.die" is created. 50 // Sleep until file "SlowChildProcess.die" is created.
51 FILE *fp; 51 FILE *fp;
52 do { 52 do {
53 PlatformThread::Sleep(100); 53 PlatformThread::Sleep(100);
54 fp = fopen("SlowChildProcess.die", "r"); 54 fp = fopen("SlowChildProcess.die", "r");
55 } while (!fp); 55 } while (!fp);
56 fclose(fp); 56 fclose(fp);
57 remove("SlowChildProcess.die"); 57 remove("SlowChildProcess.die");
58 exit(0); 58 exit(0);
59 return 0; 59 return 0;
60 } 60 }
61 61
62 TEST_F(ProcessUtilTest, KillSlowChild) { 62 TEST_F(ProcessUtilTest, KillSlowChild) {
63 remove("SlowChildProcess.die"); 63 remove("SlowChildProcess.die");
64 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); 64 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess");
65 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); 65 ASSERT_NE(base::kNullProcessHandle, handle);
66 FILE *fp = fopen("SlowChildProcess.die", "w"); 66 FILE *fp = fopen("SlowChildProcess.die", "w");
67 fclose(fp); 67 fclose(fp);
68 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); 68 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000));
69 base::CloseProcessHandle(handle); 69 base::CloseProcessHandle(handle);
70 } 70 }
71 71
72 // TODO(estade): if possible, port these 2 tests. 72 // TODO(estade): if possible, port these 2 tests.
73 #if defined(OS_WIN) 73 #if defined(OS_WIN)
74 TEST_F(ProcessUtilTest, EnableLFH) { 74 TEST_F(ProcessUtilTest, EnableLFH) {
75 ASSERT_TRUE(EnableLowFragmentationHeap()); 75 ASSERT_TRUE(EnableLowFragmentationHeap());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 "16 0 1 0 1676099790 2957312 114 4294967295 134512640 134528148 " 294 "16 0 1 0 1676099790 2957312 114 4294967295 134512640 134528148 "
295 "3221224832 3221224344 3086339742 0 0 0 0 0 0 0 17 0 0 0"; 295 "3221224832 3221224344 3086339742 0 0 0 0 0 0 0 17 0 0 0";
296 296
297 EXPECT_EQ(0, ParseProcStatCPU(kSelfStat)); 297 EXPECT_EQ(0, ParseProcStatCPU(kSelfStat));
298 } 298 }
299 #endif 299 #endif
300 300
301 #endif // defined(OS_POSIX) 301 #endif // defined(OS_POSIX)
302 302
303 } // namespace base 303 } // namespace base
OLDNEW
« no previous file with comments | « base/process.h ('k') | base/stats_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698