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

Unified Diff: base/threading/thread_checker_unittest.cc

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix base/android/build_info.cc compile 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/threading/thread_checker.h ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_checker_unittest.cc
diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
index 12454c87859248311e2d301e4f0d00f86a2a274e..1b254a1fff29999ce7e8e764e126d9df92ec00f7 100644
--- a/base/threading/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -12,14 +12,6 @@
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-// Duplicated from base/threading/thread_checker.h so that we can be
-// good citizens there and undef the macro.
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-#define ENABLE_THREAD_CHECKER 1
-#else
-#define ENABLE_THREAD_CHECKER 0
-#endif
-
namespace base {
namespace {
@@ -131,7 +123,7 @@ void ThreadCheckerClass::MethodOnDifferentThreadImpl() {
call_on_thread.Join();
}
-#if ENABLE_THREAD_CHECKER
+#if DCHECK_IS_ON()
TEST(ThreadCheckerDeathTest, MethodNotAllowedOnDifferentThreadInDebug) {
ASSERT_DCHECK_DEATH({ ThreadCheckerClass::MethodOnDifferentThreadImpl(); },
"");
@@ -140,7 +132,7 @@ TEST(ThreadCheckerDeathTest, MethodNotAllowedOnDifferentThreadInDebug) {
TEST(ThreadCheckerTest, MethodAllowedOnDifferentThreadInRelease) {
ThreadCheckerClass::MethodOnDifferentThreadImpl();
}
-#endif // ENABLE_THREAD_CHECKER
+#endif // DCHECK_IS_ON()
void ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl() {
std::unique_ptr<ThreadCheckerClass> thread_checker_class(
@@ -159,7 +151,7 @@ void ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl() {
thread_checker_class->DoStuff();
}
-#if ENABLE_THREAD_CHECKER
+#if DCHECK_IS_ON()
TEST(ThreadCheckerDeathTest, DetachFromThreadInDebug) {
ASSERT_DCHECK_DEATH(
{ ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); }, "");
@@ -168,9 +160,6 @@ TEST(ThreadCheckerDeathTest, DetachFromThreadInDebug) {
TEST(ThreadCheckerTest, DetachFromThreadInRelease) {
ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl();
}
-#endif // ENABLE_THREAD_CHECKER
-
-// Just in case we ever get lumped together with other compilation units.
-#undef ENABLE_THREAD_CHECKER
+#endif // DCHECK_IS_ON()
} // namespace base
« no previous file with comments | « base/threading/thread_checker.h ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698