Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: mojo/edk/system/mutex_unittest.cc

Issue 1418043003: Remove mojo::system::Mutex's use of base::internal::LockImpl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/mutex.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « mojo/edk/system/mutex.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698