summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorhenrik.lundin@webrtc.org <henrik.lundin@webrtc.org>2014-09-15 11:19:35 +0000
committerhenrik.lundin@webrtc.org <henrik.lundin@webrtc.org>2014-09-15 11:19:35 +0000
commit5fa3962ae5062e984e0ae0b5577450bdc072c846 (patch)
tree736efc1963b687b36e2ff43c16885233cc4208ee /base
parente754000084657c2bf18800d3543916964c87a3e6 (diff)
downloadwebrtc-5fa3962ae5062e984e0ae0b5577450bdc072c846.tar.gz
Fix ThreadChecker unittests when DCHECK_ALWAYS_ON is defined
This requires two fixes: 1. Use DCHECK instead of assert in ThreadChecker's unittest. 2. Activate DCHECK when DCHECK_ALWAYS_ON in enabled. Both these modifications are in line with Chromium's implementation. The ThreadChecker unittest was changed to use assert instead of DCHECK on the initial import (since WebRTC did not have a DCHECK back then). BUG=3803 TEST=local out/{Debug,Release}/rtc_unittests built with and without DCHECK_ALWAYS_ON R=andrew@webrtc.org, pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24569004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7178 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'base')
-rw-r--r--base/checks.h2
-rw-r--r--base/thread_checker_unittest.cc5
2 files changed, 3 insertions, 4 deletions
diff --git a/base/checks.h b/base/checks.h
index fc3b3293..821b75be 100644
--- a/base/checks.h
+++ b/base/checks.h
@@ -154,7 +154,7 @@ DEFINE_CHECK_OP_IMPL(GT, > )
// The DCHECK macro is equivalent to CHECK except that it only generates code in
// debug builds.
-#if !defined(NDEBUG)
+#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
#define DCHECK(condition) CHECK(condition)
#define DCHECK_EQ(v1, v2) CHECK_EQ(v1, v2)
#define DCHECK_NE(v1, v2) CHECK_NE(v1, v2)
diff --git a/base/thread_checker_unittest.cc b/base/thread_checker_unittest.cc
index dcaf75b6..87e69c03 100644
--- a/base/thread_checker_unittest.cc
+++ b/base/thread_checker_unittest.cc
@@ -10,9 +10,8 @@
// Borrowed from Chromium's src/base/threading/thread_checker_unittest.cc.
-#include <assert.h>
-
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/checks.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/base/scoped_ptr.h"
@@ -38,7 +37,7 @@ class ThreadCheckerClass : public ThreadChecker {
// Verifies that it was called on the same thread as the constructor.
void DoStuff() {
- assert(CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
}
void DetachFromThread() {