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@7178 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7f826350e3
commit
18617cfde8
@ -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)
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user