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> |
| 10 |
9 #include <limits> | 11 #include <limits> |
10 | 12 |
11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
12 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
13 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "build/build_config.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
15 | 18 |
16 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
17 #include <windows.h> | 20 #include <windows.h> |
18 #endif | 21 #endif |
19 #if defined(OS_POSIX) | 22 #if defined(OS_POSIX) |
20 #include <errno.h> | 23 #include <errno.h> |
21 #endif | 24 #endif |
22 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
23 #include <malloc/malloc.h> | 26 #include <malloc/malloc.h> |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) | 481 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) |
479 EXPECT_EQ(0, bytes[i]); | 482 EXPECT_EQ(0, bytes[i]); |
480 free(value_); | 483 free(value_); |
481 | 484 |
482 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); | 485 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); |
483 EXPECT_TRUE(value_ == NULL); | 486 EXPECT_TRUE(value_ == NULL); |
484 } | 487 } |
485 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 488 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
486 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !(defined(OS_WIN) && | 489 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !(defined(OS_WIN) && |
487 // !defined(ALLOCATOR_SHIM)) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 490 // !defined(ALLOCATOR_SHIM)) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
OLD | NEW |