| 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 "base/process/memory.h" | 7 #include "base/process/memory.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ASSERT_TRUE(base::allocator::IsAllocatorInitialized()); | 97 ASSERT_TRUE(base::allocator::IsAllocatorInitialized()); |
| 98 | 98 |
| 99 #if defined(OS_MACOSX) | 99 #if defined(OS_MACOSX) |
| 100 base::allocator::UninterceptMallocZonesForTesting(); | 100 base::allocator::UninterceptMallocZonesForTesting(); |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 | 103 |
| 104 // OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan | 104 // OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan |
| 105 // configurations: only test the real allocator. | 105 // configurations: only test the real allocator. |
| 106 // Windows only supports these tests with the allocator shim in place. | 106 // Windows only supports these tests with the allocator shim in place. |
| 107 #if !defined(OS_OPENBSD) && \ | 107 #if !defined(OS_OPENBSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \ |
| 108 BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) && \ | |
| 109 !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 108 !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| 110 | 109 |
| 111 namespace { | 110 namespace { |
| 112 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 113 // Windows raises an exception rather than using LOG(FATAL) in order to make the | 112 // Windows raises an exception rather than using LOG(FATAL) in order to make the |
| 114 // exit code unique to OOM. | 113 // exit code unique to OOM. |
| 115 const char* kOomRegex = ""; | 114 const char* kOomRegex = ""; |
| 116 const int kExitCode = base::win::kOomExceptionCode; | 115 const int kExitCode = base::win::kOomExceptionCode; |
| 117 #else | 116 #else |
| 118 const char* kOomRegex = "Out of memory"; | 117 const char* kOomRegex = "Out of memory"; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 bytes = static_cast<const char*>(value_); | 502 bytes = static_cast<const char*>(value_); |
| 504 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) | 503 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) |
| 505 EXPECT_EQ(0, bytes[i]); | 504 EXPECT_EQ(0, bytes[i]); |
| 506 free(value_); | 505 free(value_); |
| 507 | 506 |
| 508 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); | 507 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); |
| 509 EXPECT_TRUE(value_ == NULL); | 508 EXPECT_TRUE(value_ == NULL); |
| 510 } | 509 } |
| 511 #endif // !defined(OS_OPENBSD) && BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) && | 510 #endif // !defined(OS_OPENBSD) && BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) && |
| 512 // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 511 // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| OLD | NEW |