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

Unified Diff: base/memory/weak_ptr_unittest.cc

Issue 2162053006: Move EXPECT_DCHECK_DEATH from base/task_scheduler and use it in relevant base/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge up to r408965 Created 4 years, 5 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 | « base/bind_unittest.cc ('k') | base/message_loop/message_pump_io_ios_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/weak_ptr_unittest.cc
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index ebcf33c57ec3637407e4246de66159d033562d4e..e0a46a7feba8aa9ca3d6b51b524fef03d4479ef3 100644
--- a/base/memory/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
+#include "base/test/gtest_util.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -563,8 +564,6 @@ TEST(WeakPtrTest, NonOwnerThreadCanDeleteWeakPtr) {
background.DeleteArrow(arrow);
}
-#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST
-
TEST(WeakPtrDeathTest, WeakPtrCopyDoesNotChangeThreadBinding) {
// The default style "fast" does not support multi-threaded tests
// (introduces deadlock on Linux).
@@ -588,7 +587,7 @@ TEST(WeakPtrDeathTest, WeakPtrCopyDoesNotChangeThreadBinding) {
// Although background thread created the copy, it can not deref the copied
// WeakPtr.
- ASSERT_DEATH(background.DeRef(arrow_copy), "");
+ ASSERT_DCHECK_DEATH(background.DeRef(arrow_copy), "");
background.DeleteArrow(arrow_copy);
}
@@ -610,7 +609,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadDereferencesWeakPtrAfterReference) {
// Background thread tries to deref target, which violates thread ownership.
BackgroundThread background;
background.Start();
- ASSERT_DEATH(background.DeRef(&arrow), "");
+ ASSERT_DCHECK_DEATH(background.DeRef(&arrow), "");
}
TEST(WeakPtrDeathTest, NonOwnerThreadDeletesWeakPtrAfterReference) {
@@ -630,7 +629,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadDeletesWeakPtrAfterReference) {
background.DeRef(&arrow);
// Main thread deletes Target, violating thread binding.
- ASSERT_DEATH(target.reset(), "");
+ ASSERT_DCHECK_DEATH(target.reset(), "");
// |target.reset()| died so |target| still holds the object, so we
// must pass it to the background thread to teardown.
@@ -653,7 +652,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadDeletesObjectAfterReference) {
// Background thread tries to delete target, volating thread binding.
BackgroundThread background;
background.Start();
- ASSERT_DEATH(background.DeleteTarget(target.release()), "");
+ ASSERT_DCHECK_DEATH(background.DeleteTarget(target.release()), "");
}
TEST(WeakPtrDeathTest, NonOwnerThreadReferencesObjectAfterDeletion) {
@@ -673,9 +672,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadReferencesObjectAfterDeletion) {
background.DeleteTarget(target.release());
// Main thread attempts to dereference the target, violating thread binding.
- ASSERT_DEATH(arrow.target.get(), "");
+ ASSERT_DCHECK_DEATH(arrow.target.get(), "");
}
-#endif
-
} // namespace base
« no previous file with comments | « base/bind_unittest.cc ('k') | base/message_loop/message_pump_io_ios_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698