| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const base::subtle::Atomic32 kMagicValue = 42; | 19 const base::subtle::Atomic32 kMagicValue = 42; |
| 20 | 20 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 TEST(ToolsSanityTest, AtomicsAreIgnored) { | 265 TEST(ToolsSanityTest, AtomicsAreIgnored) { |
| 266 base::subtle::Atomic32 shared = 0; | 266 base::subtle::Atomic32 shared = 0; |
| 267 ReleaseStoreThread thread1(&shared); | 267 ReleaseStoreThread thread1(&shared); |
| 268 AcquireLoadThread thread2(&shared); | 268 AcquireLoadThread thread2(&shared); |
| 269 RunInParallel(&thread1, &thread2); | 269 RunInParallel(&thread1, &thread2); |
| 270 EXPECT_EQ(kMagicValue, shared); | 270 EXPECT_EQ(kMagicValue, shared); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace base | 273 } // namespace base |
| OLD | NEW |