| OLD | NEW |
| 1 // Copyright (c) 2012 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/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 remove(signal_file.c_str()); | 194 remove(signal_file.c_str()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 #if defined(OS_WIN) | 197 #if defined(OS_WIN) |
| 198 // TODO(cpu): figure out how to test this in other platforms. | 198 // TODO(cpu): figure out how to test this in other platforms. |
| 199 TEST_F(ProcessUtilTest, GetProcId) { | 199 TEST_F(ProcessUtilTest, GetProcId) { |
| 200 base::ProcessId id1 = base::GetProcId(GetCurrentProcess()); | 200 base::ProcessId id1 = base::GetProcId(GetCurrentProcess()); |
| 201 EXPECT_NE(0ul, id1); | 201 EXPECT_NE(0ul, id1); |
| 202 base::Process process = SpawnChild("SimpleChildProcess"); | 202 base::Process process = SpawnChild("SimpleChildProcess"); |
| 203 ASSERT_TRUE(process.IsValid()); | 203 ASSERT_TRUE(process.IsValid()); |
| 204 base::ProcessId id2 = process.pid(); | 204 base::ProcessId id2 = process.Pid(); |
| 205 EXPECT_NE(0ul, id2); | 205 EXPECT_NE(0ul, id2); |
| 206 EXPECT_NE(id1, id2); | 206 EXPECT_NE(id1, id2); |
| 207 } | 207 } |
| 208 #endif | 208 #endif |
| 209 | 209 |
| 210 #if !defined(OS_MACOSX) | 210 #if !defined(OS_MACOSX) |
| 211 // This test is disabled on Mac, since it's flaky due to ReportCrash | 211 // This test is disabled on Mac, since it's flaky due to ReportCrash |
| 212 // taking a variable amount of time to parse and load the debug and | 212 // taking a variable amount of time to parse and load the debug and |
| 213 // symbol data for this unit test's executable before firing the | 213 // symbol data for this unit test's executable before firing the |
| 214 // signal handler. | 214 // signal handler. |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 _exit(kSuccess); | 1017 _exit(kSuccess); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 ASSERT_NE(-1, pid); | 1020 ASSERT_NE(-1, pid); |
| 1021 int status = 42; | 1021 int status = 42; |
| 1022 ASSERT_EQ(pid, HANDLE_EINTR(waitpid(pid, &status, 0))); | 1022 ASSERT_EQ(pid, HANDLE_EINTR(waitpid(pid, &status, 0))); |
| 1023 ASSERT_TRUE(WIFEXITED(status)); | 1023 ASSERT_TRUE(WIFEXITED(status)); |
| 1024 EXPECT_EQ(kSuccess, WEXITSTATUS(status)); | 1024 EXPECT_EQ(kSuccess, WEXITSTATUS(status)); |
| 1025 } | 1025 } |
| 1026 #endif | 1026 #endif |
| OLD | NEW |