Chromium Code Reviews| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 | 885 |
| 886 #if defined(USE_TCMALLOC) | 886 #if defined(USE_TCMALLOC) |
| 887 extern "C" { | 887 extern "C" { |
| 888 int tc_set_new_mode(int mode); | 888 int tc_set_new_mode(int mode); |
| 889 } | 889 } |
| 890 #endif // defined(USE_TCMALLOC) | 890 #endif // defined(USE_TCMALLOC) |
| 891 | 891 |
| 892 // Android doesn't implement set_new_handler, so we can't use the | 892 // Android doesn't implement set_new_handler, so we can't use the |
| 893 // OutOfMemoryTest cases. | 893 // OutOfMemoryTest cases. |
| 894 // OpenBSD does not support these tests either. | 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 | 895 // 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 | 896 // don't crash if the program is out of memory, so the OOM tests aren't supposed |
| 899 // to work. | 897 // to work. |
| 900 #if !defined(ADDRESS_SANITIZER) | 898 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(ADDRESS_SANITIZER) |
|
M-A Ruel
2011/12/20 14:42:45
Actually, move all these with OS_WIN above.
Alexander Potapenko
2011/12/20 15:14:10
Done.
| |
| 899 | |
| 901 class OutOfMemoryDeathTest : public testing::Test { | 900 class OutOfMemoryDeathTest : public testing::Test { |
| 902 public: | 901 public: |
| 903 OutOfMemoryDeathTest() | 902 OutOfMemoryDeathTest() |
| 904 : value_(NULL), | 903 : value_(NULL), |
| 905 // Make test size as large as possible minus a few pages so | 904 // Make test size as large as possible minus a few pages so |
| 906 // that alignment or other rounding doesn't make it wrap. | 905 // that alignment or other rounding doesn't make it wrap. |
| 907 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), | 906 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), |
| 908 signed_test_size_(std::numeric_limits<ssize_t>::max()) { | 907 signed_test_size_(std::numeric_limits<ssize_t>::max()) { |
| 909 } | 908 } |
| 910 | 909 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1123 TEST_F(OutOfMemoryDeathTest, PsychoticallyBigObjCObject) { | 1122 TEST_F(OutOfMemoryDeathTest, PsychoticallyBigObjCObject) { |
| 1124 ASSERT_DEATH({ | 1123 ASSERT_DEATH({ |
| 1125 SetUpInDeathAssert(); | 1124 SetUpInDeathAssert(); |
| 1126 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1125 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
| 1127 }, ""); | 1126 }, ""); |
| 1128 } | 1127 } |
| 1129 | 1128 |
| 1130 #endif // !ARCH_CPU_64_BITS | 1129 #endif // !ARCH_CPU_64_BITS |
| 1131 #endif // OS_MACOSX | 1130 #endif // OS_MACOSX |
| 1132 | 1131 |
| 1133 #endif // !defined(ADDRESS_SANITIZER) | |
| 1134 | |
| 1135 #endif // !defined(OS_ANDROID) | 1132 #endif // !defined(OS_ANDROID) |
|
M-A Ruel
2011/12/20 14:42:45
Please update
Alexander Potapenko
2011/12/20 15:14:10
Done.
| |
| 1136 | 1133 |
| 1137 #endif // !defined(OS_WIN) | 1134 #endif // !defined(OS_WIN) |
| OLD | NEW |