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 // This file contains intentional memory errors, some of which may lead to | 5 // This file contains intentional memory errors, some of which may lead to |
6 // crashes if the test is ran without special memory testing tools. We use these | 6 // crashes if the test is ran without special memory testing tools. We use these |
7 // errors to verify the sanity of the tools. | 7 // errors to verify the sanity of the tools. |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/debug/asan_invalid_access.h" | 10 #include "base/debug/asan_invalid_access.h" |
11 #include "base/debug/profiler.h" | 11 #include "base/debug/profiler.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/googletest/include/gtest/gtest.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const base::subtle::Atomic32 kMagicValue = 42; | 21 const base::subtle::Atomic32 kMagicValue = 42; |
22 | 22 |
23 // Helper for memory accesses that can potentially corrupt memory or cause a | 23 // Helper for memory accesses that can potentially corrupt memory or cause a |
24 // crash during a native run. | 24 // crash during a native run. |
25 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) | 25 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 class B { | 348 class B { |
349 virtual void f() {} | 349 virtual void f() {} |
350 }; | 350 }; |
351 | 351 |
352 A a; | 352 A a; |
353 EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN"); | 353 EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN"); |
354 } | 354 } |
355 #endif | 355 #endif |
356 | 356 |
357 } // namespace base | 357 } // namespace base |
OLD | NEW |