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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 typedef __int64 ssize_t; | 42 typedef __int64 ssize_t; |
43 #else | 43 #else |
44 typedef long ssize_t; | 44 typedef long ssize_t; |
45 #endif | 45 #endif |
46 #endif | 46 #endif |
47 | 47 |
48 // HeapQueryInformation function pointer. | 48 // HeapQueryInformation function pointer. |
49 typedef BOOL (WINAPI* HeapQueryFn) \ | 49 typedef BOOL (WINAPI* HeapQueryFn) \ |
50 (HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T); | 50 (HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T); |
51 | 51 |
52 const int kConstantInModule = 42; | |
53 | |
54 #endif // defined(OS_WIN) | 52 #endif // defined(OS_WIN) |
55 | 53 |
56 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
57 | 55 |
58 // For the following Mac tests: | 56 // For the following Mac tests: |
59 // Note that base::EnableTerminationOnHeapCorruption() is called as part of | 57 // Note that base::EnableTerminationOnHeapCorruption() is called as part of |
60 // test suite setup and does not need to be done again, else mach_override | 58 // test suite setup and does not need to be done again, else mach_override |
61 // will fail. | 59 // will fail. |
62 | 60 |
63 TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { | 61 TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) | 446 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) |
449 EXPECT_EQ(0, bytes[i]); | 447 EXPECT_EQ(0, bytes[i]); |
450 free(value_); | 448 free(value_); |
451 | 449 |
452 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); | 450 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); |
453 EXPECT_TRUE(value_ == NULL); | 451 EXPECT_TRUE(value_ == NULL); |
454 } | 452 } |
455 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 453 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
456 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !(defined(OS_WIN) && | 454 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !(defined(OS_WIN) && |
457 // !defined(ALLOCATOR_SHIM)) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 455 // !defined(ALLOCATOR_SHIM)) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
OLD | NEW |