OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/atomicops.h" | 5 #include "base/atomicops.h" |
| 6 |
| 7 #include <string.h> |
| 8 |
| 9 #include "base/port.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
7 | 11 |
8 template <class AtomicType> | 12 template <class AtomicType> |
9 static void TestAtomicIncrement() { | 13 static void TestAtomicIncrement() { |
10 // For now, we just test single threaded execution | 14 // For now, we just test single threaded execution |
11 | 15 |
12 // use a guard value to make sure the NoBarrier_AtomicIncrement doesn't go | 16 // use a guard value to make sure the NoBarrier_AtomicIncrement doesn't go |
13 // outside the expected address bounds. This is in particular to | 17 // outside the expected address bounds. This is in particular to |
14 // test that some future change to the asm code doesn't cause the | 18 // test that some future change to the asm code doesn't cause the |
15 // 32-bit NoBarrier_AtomicIncrement doesn't do the wrong thing on 64-bit | 19 // 32-bit NoBarrier_AtomicIncrement doesn't do the wrong thing on 64-bit |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 232 |
229 TEST(AtomicOpsTest, Store) { | 233 TEST(AtomicOpsTest, Store) { |
230 TestStore<base::subtle::Atomic32>(); | 234 TestStore<base::subtle::Atomic32>(); |
231 TestStore<base::subtle::AtomicWord>(); | 235 TestStore<base::subtle::AtomicWord>(); |
232 } | 236 } |
233 | 237 |
234 TEST(AtomicOpsTest, Load) { | 238 TEST(AtomicOpsTest, Load) { |
235 TestLoad<base::subtle::Atomic32>(); | 239 TestLoad<base::subtle::Atomic32>(); |
236 TestLoad<base::subtle::AtomicWord>(); | 240 TestLoad<base::subtle::AtomicWord>(); |
237 } | 241 } |
OLD | NEW |