OLD | NEW |
1 // Copyright (c) 2011 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 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/googletest/include/gtest/gtest.h" |
11 | 11 |
12 template <class AtomicType> | 12 template <class AtomicType> |
13 static void TestAtomicIncrement() { | 13 static void TestAtomicIncrement() { |
14 // For now, we just test single threaded execution | 14 // For now, we just test single threaded execution |
15 | 15 |
16 // 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 |
17 // outside the expected address bounds. This is in particular to | 17 // outside the expected address bounds. This is in particular to |
18 // 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 |
19 // 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 |
20 // machines. | 20 // machines. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 TEST(AtomicOpsTest, Store) { | 240 TEST(AtomicOpsTest, Store) { |
241 TestStore<base::subtle::Atomic32>(); | 241 TestStore<base::subtle::Atomic32>(); |
242 TestStore<base::subtle::AtomicWord>(); | 242 TestStore<base::subtle::AtomicWord>(); |
243 } | 243 } |
244 | 244 |
245 TEST(AtomicOpsTest, Load) { | 245 TEST(AtomicOpsTest, Load) { |
246 TestLoad<base::subtle::Atomic32>(); | 246 TestLoad<base::subtle::Atomic32>(); |
247 TestLoad<base::subtle::AtomicWord>(); | 247 TestLoad<base::subtle::AtomicWord>(); |
248 } | 248 } |
OLD | NEW |