OLD | NEW |
---|---|
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 Loading... | |
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) | |
Evan Martin
2012/01/24 16:30:15
Add a TODO: this should work on other platforms or
| |
176 TEST_F(ProcessUtilTest, GetProcId) { | |
177 base::ProcessId id1 = base::GetProcId(GetCurrentProcess()); | |
178 EXPECT_NE(0ul, id1); | |
179 base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false); | |
180 ASSERT_NE(base::kNullProcessHandle, handle); | |
181 base::ProcessId id2 = base::GetProcId(handle); | |
182 EXPECT_NE(0ul, id2); | |
Evan Martin
2012/01/24 16:30:15
Maybe check id1 != id2?
| |
183 base::CloseProcessHandle(handle); | |
184 } | |
185 #endif | |
186 | |
175 #if !defined(OS_MACOSX) | 187 #if !defined(OS_MACOSX) |
176 // This test is disabled on Mac, since it's flaky due to ReportCrash | 188 // 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 | 189 // 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 | 190 // symbol data for this unit test's executable before firing the |
179 // signal handler. | 191 // signal handler. |
180 // | 192 // |
181 // TODO(gspencer): turn this test process into a very small program | 193 // TODO(gspencer): turn this test process into a very small program |
182 // with no symbols (instead of using the multiprocess testing | 194 // with no symbols (instead of using the multiprocess testing |
183 // framework) to reduce the ReportCrash overhead. | 195 // framework) to reduce the ReportCrash overhead. |
184 | 196 |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 SetUpInDeathAssert(); | 1135 SetUpInDeathAssert(); |
1124 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1136 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
1125 }, ""); | 1137 }, ""); |
1126 } | 1138 } |
1127 | 1139 |
1128 #endif // !ARCH_CPU_64_BITS | 1140 #endif // !ARCH_CPU_64_BITS |
1129 #endif // OS_MACOSX | 1141 #endif // OS_MACOSX |
1130 | 1142 |
1131 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && | 1143 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && |
1132 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) | 1144 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) |
OLD | NEW |