| 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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 EXPECT_TRUE(IsProcessDead(child_process)); | 873 EXPECT_TRUE(IsProcessDead(child_process)); |
| 874 base::CloseProcessHandle(child_process); | 874 base::CloseProcessHandle(child_process); |
| 875 } | 875 } |
| 876 | 876 |
| 877 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { | 877 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { |
| 878 return 0; | 878 return 0; |
| 879 } | 879 } |
| 880 | 880 |
| 881 #endif // defined(OS_POSIX) | 881 #endif // defined(OS_POSIX) |
| 882 | 882 |
| 883 // Android doesn't implement set_new_handler, so we can't use the |
| 884 // OutOfMemoryTest cases. |
| 885 // OpenBSD does not support these tests either. |
| 886 // AddressSanitizer defines the malloc()/free()/etc. functions so that they |
| 887 // don't crash if the program is out of memory, so the OOM tests aren't supposed |
| 888 // to work. |
| 883 // TODO(vandebo) make this work on Windows too. | 889 // TODO(vandebo) make this work on Windows too. |
| 884 #if !defined(OS_WIN) | 890 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && \ |
| 891 !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) |
| 885 | 892 |
| 886 #if defined(USE_TCMALLOC) | 893 #if defined(USE_TCMALLOC) |
| 887 extern "C" { | 894 extern "C" { |
| 888 int tc_set_new_mode(int mode); | 895 int tc_set_new_mode(int mode); |
| 889 } | 896 } |
| 890 #endif // defined(USE_TCMALLOC) | 897 #endif // defined(USE_TCMALLOC) |
| 891 | 898 |
| 892 // Android doesn't implement set_new_handler, so we can't use the | |
| 893 // OutOfMemoryTest cases. | |
| 894 // OpenBSD does not support these tests either. | |
| 895 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) | |
| 896 | |
| 897 // AddressSanitizer defines the malloc()/free()/etc. functions so that they | |
| 898 // don't crash if the program is out of memory, so the OOM tests aren't supposed | |
| 899 // to work. | |
| 900 #if !defined(ADDRESS_SANITIZER) | |
| 901 class OutOfMemoryDeathTest : public testing::Test { | 899 class OutOfMemoryDeathTest : public testing::Test { |
| 902 public: | 900 public: |
| 903 OutOfMemoryDeathTest() | 901 OutOfMemoryDeathTest() |
| 904 : value_(NULL), | 902 : value_(NULL), |
| 905 // Make test size as large as possible minus a few pages so | 903 // Make test size as large as possible minus a few pages so |
| 906 // that alignment or other rounding doesn't make it wrap. | 904 // that alignment or other rounding doesn't make it wrap. |
| 907 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), | 905 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), |
| 908 signed_test_size_(std::numeric_limits<ssize_t>::max()) { | 906 signed_test_size_(std::numeric_limits<ssize_t>::max()) { |
| 909 } | 907 } |
| 910 | 908 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 TEST_F(OutOfMemoryDeathTest, PsychoticallyBigObjCObject) { | 1121 TEST_F(OutOfMemoryDeathTest, PsychoticallyBigObjCObject) { |
| 1124 ASSERT_DEATH({ | 1122 ASSERT_DEATH({ |
| 1125 SetUpInDeathAssert(); | 1123 SetUpInDeathAssert(); |
| 1126 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1124 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
| 1127 }, ""); | 1125 }, ""); |
| 1128 } | 1126 } |
| 1129 | 1127 |
| 1130 #endif // !ARCH_CPU_64_BITS | 1128 #endif // !ARCH_CPU_64_BITS |
| 1131 #endif // OS_MACOSX | 1129 #endif // OS_MACOSX |
| 1132 | 1130 |
| 1133 #endif // !defined(ADDRESS_SANITIZER) | 1131 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && |
| 1134 | 1132 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) |
| 1135 #endif // !defined(OS_ANDROID) | |
| 1136 | |
| 1137 #endif // !defined(OS_WIN) | |
| OLD | NEW |