| 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/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 class OutOfMemoryDeathTest : public testing::Test { | 932 class OutOfMemoryDeathTest : public testing::Test { |
| 933 public: | 933 public: |
| 934 OutOfMemoryDeathTest() | 934 OutOfMemoryDeathTest() |
| 935 : value_(NULL), | 935 : value_(NULL), |
| 936 // Make test size as large as possible minus a few pages so | 936 // Make test size as large as possible minus a few pages so |
| 937 // that alignment or other rounding doesn't make it wrap. | 937 // that alignment or other rounding doesn't make it wrap. |
| 938 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), | 938 test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), |
| 939 signed_test_size_(std::numeric_limits<ssize_t>::max()) { | 939 signed_test_size_(std::numeric_limits<ssize_t>::max()) { |
| 940 } | 940 } |
| 941 | 941 |
| 942 virtual void SetUp() { | |
| 943 #if defined(USE_TCMALLOC) | 942 #if defined(USE_TCMALLOC) |
| 943 virtual void SetUp() OVERRIDE { |
| 944 tc_set_new_mode(1); | 944 tc_set_new_mode(1); |
| 945 } | 945 } |
| 946 | 946 |
| 947 virtual void TearDown() { | 947 virtual void TearDown() OVERRIDE { |
| 948 tc_set_new_mode(0); | 948 tc_set_new_mode(0); |
| 949 } |
| 949 #endif // defined(USE_TCMALLOC) | 950 #endif // defined(USE_TCMALLOC) |
| 950 } | |
| 951 | 951 |
| 952 void SetUpInDeathAssert() { | 952 void SetUpInDeathAssert() { |
| 953 // Must call EnableTerminationOnOutOfMemory() because that is called from | 953 // Must call EnableTerminationOnOutOfMemory() because that is called from |
| 954 // chrome's main function and therefore hasn't been called yet. | 954 // chrome's main function and therefore hasn't been called yet. |
| 955 // Since this call may result in another thread being created and death | 955 // Since this call may result in another thread being created and death |
| 956 // tests shouldn't be started in a multithread environment, this call | 956 // tests shouldn't be started in a multithread environment, this call |
| 957 // should be done inside of the ASSERT_DEATH. | 957 // should be done inside of the ASSERT_DEATH. |
| 958 base::EnableTerminationOnOutOfMemory(); | 958 base::EnableTerminationOnOutOfMemory(); |
| 959 } | 959 } |
| 960 | 960 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 SetUpInDeathAssert(); | 1156 SetUpInDeathAssert(); |
| 1157 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1157 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
| 1158 }, ""); | 1158 }, ""); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 #endif // !ARCH_CPU_64_BITS | 1161 #endif // !ARCH_CPU_64_BITS |
| 1162 #endif // OS_MACOSX | 1162 #endif // OS_MACOSX |
| 1163 | 1163 |
| 1164 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && | 1164 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && |
| 1165 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) | 1165 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) |
| OLD | NEW |