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

Side by Side Diff: base/process_util_unittest.cc

Issue 9283009: Adding GetProcId unittest (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/eintr_wrapper.h" 10 #include "base/eintr_wrapper.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SignalChildren(kSignalFileSlow); 165 SignalChildren(kSignalFileSlow);
166 exit_code = 42; 166 exit_code = 42;
167 base::TerminationStatus status = 167 base::TerminationStatus status =
168 WaitForChildTermination(handle, &exit_code); 168 WaitForChildTermination(handle, &exit_code);
169 EXPECT_EQ(base::TERMINATION_STATUS_NORMAL_TERMINATION, status); 169 EXPECT_EQ(base::TERMINATION_STATUS_NORMAL_TERMINATION, status);
170 EXPECT_EQ(0, exit_code); 170 EXPECT_EQ(0, exit_code);
171 base::CloseProcessHandle(handle); 171 base::CloseProcessHandle(handle);
172 remove(kSignalFileSlow); 172 remove(kSignalFileSlow);
173 } 173 }
174 174
175 #if defined(OS_WIN)
176 // TODO(cpu): figure out how to test this in other platforms.
177 TEST_F(ProcessUtilTest, GetProcId) {
178 base::ProcessId id1 = base::GetProcId(GetCurrentProcess());
179 EXPECT_NE(0ul, id1);
180 base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false);
181 ASSERT_NE(base::kNullProcessHandle, handle);
182 base::ProcessId id2 = base::GetProcId(handle);
183 EXPECT_NE(0ul, id2);
184 EXPECT_NE(id1, id2);
185 base::CloseProcessHandle(handle);
186 }
187 #endif
188
175 #if !defined(OS_MACOSX) 189 #if !defined(OS_MACOSX)
176 // This test is disabled on Mac, since it's flaky due to ReportCrash 190 // This test is disabled on Mac, since it's flaky due to ReportCrash
177 // taking a variable amount of time to parse and load the debug and 191 // taking a variable amount of time to parse and load the debug and
178 // symbol data for this unit test's executable before firing the 192 // symbol data for this unit test's executable before firing the
179 // signal handler. 193 // signal handler.
180 // 194 //
181 // TODO(gspencer): turn this test process into a very small program 195 // TODO(gspencer): turn this test process into a very small program
182 // with no symbols (instead of using the multiprocess testing 196 // with no symbols (instead of using the multiprocess testing
183 // framework) to reduce the ReportCrash overhead. 197 // framework) to reduce the ReportCrash overhead.
184 198
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 SetUpInDeathAssert(); 1137 SetUpInDeathAssert();
1124 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} 1138 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {}
1125 }, ""); 1139 }, "");
1126 } 1140 }
1127 1141
1128 #endif // !ARCH_CPU_64_BITS 1142 #endif // !ARCH_CPU_64_BITS
1129 #endif // OS_MACOSX 1143 #endif // OS_MACOSX
1130 1144
1131 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && 1145 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) &&
1132 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) 1146 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698