Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: base/process/memory_unittest.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/process/memory_mac.mm ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 9 #include <limits>
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 #if ARCH_CPU_64_BITS 143 #if ARCH_CPU_64_BITS
144 // On 64 bit Macs, the malloc system automatically abort()s on heap corruption 144 // On 64 bit Macs, the malloc system automatically abort()s on heap corruption
145 // but does not output anything. 145 // but does not output anything.
146 ASSERT_DEATH(free(buf), ""); 146 ASSERT_DEATH(free(buf), "");
147 #elif defined(ADDRESS_SANITIZER) 147 #elif defined(ADDRESS_SANITIZER)
148 // AddressSanitizer replaces malloc() and prints a different error message on 148 // AddressSanitizer replaces malloc() and prints a different error message on
149 // heap corruption. 149 // heap corruption.
150 ASSERT_DEATH(free(buf), "attempting free on address which " 150 ASSERT_DEATH(free(buf), "attempting free on address which "
151 "was not malloc\\(\\)-ed"); 151 "was not malloc\\(\\)-ed");
152 #else 152 #else
153 ASSERT_DEATH(free(buf), "being freed.*\\n?\\.*" 153 ADD_FAILURE() << "This test is not supported in this build configuration.";
154 "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*\\n?.*" 154 #endif
155 "Terminating process due to a potential for future heap corruption");
156 #endif // ARCH_CPU_64_BITS || defined(ADDRESS_SANITIZER)
157 } 155 }
158 156
159 #endif // defined(OS_MACOSX) 157 #endif // defined(OS_MACOSX)
160 158
161 // Android doesn't implement set_new_handler, so we can't use the 159 // Android doesn't implement set_new_handler, so we can't use the
162 // OutOfMemoryTest cases. 160 // OutOfMemoryTest cases.
163 // OpenBSD does not support these tests either. 161 // OpenBSD does not support these tests either.
164 // TODO(vandebo) make this work on Windows too. 162 // TODO(vandebo) make this work on Windows too.
165 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && \ 163 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && \
166 !defined(OS_WIN) 164 !defined(OS_WIN)
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 bytes = static_cast<const char*>(value_); 436 bytes = static_cast<const char*>(value_);
439 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) 437 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i)
440 EXPECT_EQ(0, bytes[i]); 438 EXPECT_EQ(0, bytes[i]);
441 free(value_); 439 free(value_);
442 440
443 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); 441 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_));
444 EXPECT_TRUE(value_ == NULL); 442 EXPECT_TRUE(value_ == NULL);
445 } 443 }
446 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) 444 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
447 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) 445 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN)
OLDNEW
« no previous file with comments | « base/process/memory_mac.mm ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698