| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 FilePermissions::kOwnerOnly), | 171 FilePermissions::kOwnerOnly), |
| 172 other_locks, | 172 other_locks, |
| 173 iterations_for_this_thread, | 173 iterations_for_this_thread, |
| 174 &actual_iterations); | 174 &actual_iterations); |
| 175 expected_iterations += iterations_for_this_thread; | 175 expected_iterations += iterations_for_this_thread; |
| 176 | 176 |
| 177 ASSERT_NO_FATAL_FAILURE(threads[index].Start()); | 177 ASSERT_NO_FATAL_FAILURE(threads[index].Start()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 base::subtle::Atomic32 result = | 180 base::subtle::Atomic32 result = |
| 181 base::subtle::Release_Load(&actual_iterations); | 181 base::subtle::NoBarrier_Load(&actual_iterations); |
| 182 EXPECT_EQ(0, result); | 182 EXPECT_EQ(0, result); |
| 183 | 183 |
| 184 ASSERT_TRUE(LoggingUnlockFile(initial.get())); | 184 ASSERT_TRUE(LoggingUnlockFile(initial.get())); |
| 185 | 185 |
| 186 for (auto& t : threads) | 186 for (auto& t : threads) |
| 187 t.Join(); | 187 t.Join(); |
| 188 | 188 |
| 189 result = base::subtle::Release_Load(&actual_iterations); | 189 result = base::subtle::NoBarrier_Load(&actual_iterations); |
| 190 EXPECT_EQ(expected_iterations, result); | 190 EXPECT_EQ(expected_iterations, result); |
| 191 } | 191 } |
| 192 | 192 |
| 193 TEST(FileIO, ExclusiveVsExclusives) { | 193 TEST(FileIO, ExclusiveVsExclusives) { |
| 194 LockingTest(FileLocking::kExclusive, FileLocking::kExclusive); | 194 LockingTest(FileLocking::kExclusive, FileLocking::kExclusive); |
| 195 } | 195 } |
| 196 | 196 |
| 197 TEST(FileIO, ExclusiveVsShareds) { | 197 TEST(FileIO, ExclusiveVsShareds) { |
| 198 LockingTest(FileLocking::kExclusive, FileLocking::kShared); | 198 LockingTest(FileLocking::kExclusive, FileLocking::kShared); |
| 199 } | 199 } |
| 200 | 200 |
| 201 TEST(FileIO, SharedVsExclusives) { | 201 TEST(FileIO, SharedVsExclusives) { |
| 202 LockingTest(FileLocking::kShared, FileLocking::kExclusive); | 202 LockingTest(FileLocking::kShared, FileLocking::kExclusive); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace | 205 } // namespace |
| 206 } // namespace test | 206 } // namespace test |
| 207 } // namespace crashpad | 207 } // namespace crashpad |
| OLD | NEW |