| Index: mojo/edk/system/mutex_unittest.cc
|
| diff --git a/mojo/edk/system/mutex_unittest.cc b/mojo/edk/system/mutex_unittest.cc
|
| index 9b516536560174e4a399a0f473a6393b050fb946..c4fce3aba2c37c069e154b58a9f10d6a6b19609b 100644
|
| --- a/mojo/edk/system/mutex_unittest.cc
|
| +++ b/mojo/edk/system/mutex_unittest.cc
|
| @@ -102,6 +102,20 @@ TEST(MutexTest, Basic) {
|
| EXPECT_GE(thread.acquired(), 20);
|
| }
|
|
|
| +TEST(MutexTest, AssertHeld) {
|
| + Mutex mutex;
|
| +
|
| +#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
| + // For non-Debug builds, |AssertHeld()| should do nothing.
|
| + mutex.AssertHeld();
|
| +#else
|
| + EXPECT_DEATH_IF_SUPPORTED({ mutex.AssertHeld(); }, "Check failed");
|
| +#endif // defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
| +
|
| + // TODO(vtl): Should also test the case when the mutex is held by another
|
| + // thread, though this is more annoying since it requires synchronization.
|
| +}
|
| +
|
| // Test that TryLock() works as expected ---------------------------------------
|
|
|
| class TryLockTestThread : public base::PlatformThread::Delegate {
|
|
|