| OLD | NEW |
| 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 <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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TEST_F(ProcessUtilTest, KillSlowChild) { | 71 TEST_F(ProcessUtilTest, KillSlowChild) { |
| 72 remove("SlowChildProcess.die"); | 72 remove("SlowChildProcess.die"); |
| 73 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); | 73 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); |
| 74 ASSERT_NE(base::kNullProcessHandle, handle); | 74 ASSERT_NE(base::kNullProcessHandle, handle); |
| 75 FILE *fp = fopen("SlowChildProcess.die", "w"); | 75 FILE *fp = fopen("SlowChildProcess.die", "w"); |
| 76 fclose(fp); | 76 fclose(fp); |
| 77 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); | 77 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); |
| 78 base::CloseProcessHandle(handle); | 78 base::CloseProcessHandle(handle); |
| 79 } | 79 } |
| 80 | 80 |
| 81 TEST_F(ProcessUtilTest, DidProcessCrash) { |
| 82 remove("SlowChildProcess.die"); |
| 83 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); |
| 84 ASSERT_NE(base::kNullProcessHandle, handle); |
| 85 |
| 86 bool child_exited = true; |
| 87 EXPECT_FALSE(base::DidProcessCrash(&child_exited, handle)); |
| 88 EXPECT_FALSE(child_exited); |
| 89 |
| 90 FILE *fp = fopen("SlowChildProcess.die", "w"); |
| 91 fclose(fp); |
| 92 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); |
| 93 |
| 94 EXPECT_FALSE(base::DidProcessCrash(&child_exited, handle)); |
| 95 |
| 96 base::CloseProcessHandle(handle); |
| 97 } |
| 98 |
| 81 // Ensure that the priority of a process is restored correctly after | 99 // Ensure that the priority of a process is restored correctly after |
| 82 // backgrounding and restoring. | 100 // backgrounding and restoring. |
| 83 // Note: a platform may not be willing or able to lower the priority of | 101 // Note: a platform may not be willing or able to lower the priority of |
| 84 // a process. The calls to SetProcessBackground should be noops then. | 102 // a process. The calls to SetProcessBackground should be noops then. |
| 85 TEST_F(ProcessUtilTest, SetProcessBackgrounded) { | 103 TEST_F(ProcessUtilTest, SetProcessBackgrounded) { |
| 86 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); | 104 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); |
| 87 Process process(handle); | 105 Process process(handle); |
| 88 int old_priority = process.GetPriority(); | 106 int old_priority = process.GetPriority(); |
| 89 process.SetProcessBackgrounded(true); | 107 process.SetProcessBackgrounded(true); |
| 90 process.SetProcessBackgrounded(false); | 108 process.SetProcessBackgrounded(false); |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 TEST_F(OutOfMemoryTest, PsychoticallyBigObjCObject) { | 638 TEST_F(OutOfMemoryTest, PsychoticallyBigObjCObject) { |
| 621 ASSERT_DEATH(while ((value_ = | 639 ASSERT_DEATH(while ((value_ = |
| 622 AllocatePsychoticallyBigObjCObject())) {}, ""); | 640 AllocatePsychoticallyBigObjCObject())) {}, ""); |
| 623 } | 641 } |
| 624 | 642 |
| 625 #endif // OS_MACOSX | 643 #endif // OS_MACOSX |
| 626 | 644 |
| 627 #endif // !defined(OS_WIN) | 645 #endif // !defined(OS_WIN) |
| 628 | 646 |
| 629 } // namespace base | 647 } // namespace base |
| OLD | NEW |