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

Unified Diff: base/threading/thread_checker_unittest.cc

Issue 10673010: Don't rely on undefined macro behaviour in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix pre-existing ODR violation Created 8 years, 6 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 | « no previous file | no next file » | 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 0dadcf01f0e8ddaa3fc85540ce5826f561902452..026cfd9e0e2e397116ecbbbbb5db44a6c90dd514 100644
--- a/base/threading/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -11,10 +11,16 @@
// Duplicated from base/threading/thread_checker.h so that we can be
// good citizens there and undef the macro.
-#define ENABLE_THREAD_CHECKER (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
+#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
+#define ENABLE_THREAD_CHECKER 1
+#else
+#define ENABLE_THREAD_CHECKER 0
+#endif
namespace base {
+namespace {
+
// Simple class to exercise the basics of ThreadChecker.
// Both the destructor and DoStuff should verify that they were
// called on the same thread as the constructor.
@@ -74,6 +80,8 @@ class DeleteThreadCheckerClassOnThread : public base::SimpleThread {
DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread);
};
+} // namespace
+
TEST(ThreadCheckerTest, CallsAllowedOnSameThread) {
scoped_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
@@ -127,7 +135,7 @@ void ThreadCheckerClass::MethodOnDifferentThreadImpl() {
#if ENABLE_THREAD_CHECKER
TEST(ThreadCheckerDeathTest, MethodNotAllowedOnDifferentThreadInDebug) {
- ASSERT_DEBUG_DEATH({
+ ASSERT_DEATH({
ThreadCheckerClass::MethodOnDifferentThreadImpl();
}, "");
}
@@ -156,7 +164,7 @@ void ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl() {
#if ENABLE_THREAD_CHECKER
TEST(ThreadCheckerDeathTest, DetachFromThreadInDebug) {
- ASSERT_DEBUG_DEATH({
+ ASSERT_DEATH({
ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl();
}, "");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698