| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 ASSERT_TRUE(OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token)); | 390 ASSERT_TRUE(OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token)); |
| 391 std::wstring cmdline = | 391 std::wstring cmdline = |
| 392 this->MakeCmdLine("SimpleChildProcess", false).GetCommandLineString(); | 392 this->MakeCmdLine("SimpleChildProcess", false).GetCommandLineString(); |
| 393 base::LaunchOptions options; | 393 base::LaunchOptions options; |
| 394 options.as_user = token; | 394 options.as_user = token; |
| 395 EXPECT_TRUE(base::LaunchProcess(cmdline, options, NULL)); | 395 EXPECT_TRUE(base::LaunchProcess(cmdline, options, NULL)); |
| 396 } | 396 } |
| 397 | 397 |
| 398 #endif // defined(OS_WIN) | 398 #endif // defined(OS_WIN) |
| 399 | 399 |
| 400 #if defined(OS_MACOSX) |
| 401 |
| 402 TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) { |
| 403 // Note that base::EnableTerminationOnHeapCorruption() is called as part of |
| 404 // test suite setup and does not need to be done again, else mach_override |
| 405 // will fail. |
| 406 |
| 407 char buf[3]; |
| 408 ASSERT_DEATH(free(buf), "being freed.*" |
| 409 "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" |
| 410 "Terminating process due to a potential for future heap corruption"); |
| 411 } |
| 412 |
| 413 #endif // defined(OS_MACOSX) |
| 414 |
| 400 #if defined(OS_POSIX) | 415 #if defined(OS_POSIX) |
| 401 | 416 |
| 402 namespace { | 417 namespace { |
| 403 | 418 |
| 404 // Returns the maximum number of files that a process can have open. | 419 // Returns the maximum number of files that a process can have open. |
| 405 // Returns 0 on error. | 420 // Returns 0 on error. |
| 406 int GetMaxFilesOpenInProcess() { | 421 int GetMaxFilesOpenInProcess() { |
| 407 struct rlimit rlim; | 422 struct rlimit rlim; |
| 408 if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) { | 423 if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) { |
| 409 return 0; | 424 return 0; |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 ASSERT_DEATH({ | 1016 ASSERT_DEATH({ |
| 1002 SetUpInDeathAssert(); | 1017 SetUpInDeathAssert(); |
| 1003 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1018 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
| 1004 }, ""); | 1019 }, ""); |
| 1005 } | 1020 } |
| 1006 | 1021 |
| 1007 #endif // !ARCH_CPU_64_BITS | 1022 #endif // !ARCH_CPU_64_BITS |
| 1008 #endif // OS_MACOSX | 1023 #endif // OS_MACOSX |
| 1009 | 1024 |
| 1010 #endif // !defined(OS_WIN) | 1025 #endif // !defined(OS_WIN) |
| OLD | NEW |