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

Side by Side Diff: base/logging_unittest.cc

Issue 8734021: Make CHECK not print messages in official builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/logging.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; 203 g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
204 DCHECK(mock_log_source.Log()) << mock_log_source.Log(); 204 DCHECK(mock_log_source.Log()) << mock_log_source.Log();
205 DPCHECK(mock_log_source.Log()) << mock_log_source.Log(); 205 DPCHECK(mock_log_source.Log()) << mock_log_source.Log();
206 DCHECK_EQ(0, 0) << mock_log_source.Log(); 206 DCHECK_EQ(0, 0) << mock_log_source.Log();
207 DCHECK_EQ(mock_log_source.Log(), static_cast<const char*>(NULL)) 207 DCHECK_EQ(mock_log_source.Log(), static_cast<const char*>(NULL))
208 << mock_log_source.Log(); 208 << mock_log_source.Log();
209 #endif 209 #endif
210 } 210 }
211 211
212 TEST_F(LoggingTest, Dcheck) { 212 TEST_F(LoggingTest, Dcheck) {
213 #if defined(LOGGING_IS_OFFICIAL_BUILD) 213 #if LOGGING_IS_OFFICIAL_BUILD
214 // Official build. 214 // Official build.
215 EXPECT_FALSE(DCHECK_IS_ON()); 215 EXPECT_FALSE(DCHECK_IS_ON());
216 EXPECT_FALSE(DLOG_IS_ON(DCHECK)); 216 EXPECT_FALSE(DLOG_IS_ON(DCHECK));
217 #elif defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 217 #elif defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
218 // Unofficial release build. 218 // Unofficial release build.
219 g_dcheck_state = ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; 219 g_dcheck_state = ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
220 SetLogReportHandler(&LogSink); 220 SetLogReportHandler(&LogSink);
221 EXPECT_TRUE(DCHECK_IS_ON()); 221 EXPECT_TRUE(DCHECK_IS_ON());
222 EXPECT_FALSE(DLOG_IS_ON(DCHECK)); 222 EXPECT_FALSE(DLOG_IS_ON(DCHECK));
223 #elif defined(NDEBUG) && defined(DCHECK_ALWAYS_ON) 223 #elif defined(NDEBUG) && defined(DCHECK_ALWAYS_ON)
(...skipping 23 matching lines...) Expand all
247 // These should still reference |some_variable| so we don't get 247 // These should still reference |some_variable| so we don't get
248 // unused variable warnings. 248 // unused variable warnings.
249 DCHECK(some_variable) << "test"; 249 DCHECK(some_variable) << "test";
250 DPCHECK(some_variable) << "test"; 250 DPCHECK(some_variable) << "test";
251 DCHECK_EQ(some_variable, 1) << "test"; 251 DCHECK_EQ(some_variable, 1) << "test";
252 } 252 }
253 253
254 } // namespace 254 } // namespace
255 255
256 } // namespace logging 256 } // namespace logging
OLDNEW
« no previous file with comments | « base/logging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698