OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/utility/mutex.h" | 5 #include "third_party/mojo/src/mojo/public/cpp/utility/mutex.h" |
6 | 6 |
7 #include <stdlib.h> // For |rand()|. | 7 #include <stdlib.h> // For |rand()|. |
8 #include <time.h> // For |nanosleep()| (defined by POSIX). | 8 #include <time.h> // For |nanosleep()| (defined by POSIX). |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "mojo/public/cpp/system/macros.h" | |
13 #include "mojo/public/cpp/utility/thread.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" |
| 14 #include "third_party/mojo/src/mojo/public/cpp/utility/thread.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace { | 17 namespace { |
18 | 18 |
19 TEST(MutexTest, TrivialSingleThreaded) { | 19 TEST(MutexTest, TrivialSingleThreaded) { |
20 Mutex mutex; | 20 Mutex mutex; |
21 | 21 |
22 mutex.Lock(); | 22 mutex.Lock(); |
23 mutex.AssertHeld(); | 23 mutex.AssertHeld(); |
24 mutex.Unlock(); | 24 mutex.Unlock(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Destroy lock with lock held. | 250 // Destroy lock with lock held. |
251 EXPECT_DEATH_IF_SUPPORTED({ | 251 EXPECT_DEATH_IF_SUPPORTED({ |
252 Mutex mutex; | 252 Mutex mutex; |
253 mutex.Lock(); | 253 mutex.Lock(); |
254 }, ""); | 254 }, ""); |
255 } | 255 } |
256 #endif // !defined(NDEBUG) | 256 #endif // !defined(NDEBUG) |
257 | 257 |
258 } // namespace | 258 } // namespace |
259 } // namespace mojo | 259 } // namespace mojo |
OLD | NEW |