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

Side by Side Diff: base/logging_unittest.cc

Issue 8968008: Fix official build breakage introduced by 112649 (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 | « no previous file | 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 VLOG_IF(1, true) << mock_log_source.Log(); 159 VLOG_IF(1, true) << mock_log_source.Log();
160 160
161 DLOG(INFO) << mock_log_source.Log(); 161 DLOG(INFO) << mock_log_source.Log();
162 DLOG_IF(INFO, true) << mock_log_source.Log(); 162 DLOG_IF(INFO, true) << mock_log_source.Log();
163 DPLOG(INFO) << mock_log_source.Log(); 163 DPLOG(INFO) << mock_log_source.Log();
164 DPLOG_IF(INFO, true) << mock_log_source.Log(); 164 DPLOG_IF(INFO, true) << mock_log_source.Log();
165 DVLOG(1) << mock_log_source.Log(); 165 DVLOG(1) << mock_log_source.Log();
166 DVLOG_IF(1, true) << mock_log_source.Log(); 166 DVLOG_IF(1, true) << mock_log_source.Log();
167 } 167 }
168 168
169 // Official builds have CHECKs directly call BreakDebugger.
170 #if !defined(LOGGING_IS_OFFICIAL_BUILD)
171
169 TEST_F(LoggingTest, CheckStreamsAreLazy) { 172 TEST_F(LoggingTest, CheckStreamsAreLazy) {
170 MockLogSource mock_log_source, uncalled_mock_log_source; 173 MockLogSource mock_log_source, uncalled_mock_log_source;
171 EXPECT_CALL(mock_log_source, Log()).Times(8). 174 EXPECT_CALL(mock_log_source, Log()).Times(8).
172 WillRepeatedly(Return("check message")); 175 WillRepeatedly(Return("check message"));
173 EXPECT_CALL(uncalled_mock_log_source, Log()).Times(0); 176 EXPECT_CALL(uncalled_mock_log_source, Log()).Times(0);
174 177
175 SetLogAssertHandler(&LogSink); 178 SetLogAssertHandler(&LogSink);
176 179
177 CHECK(mock_log_source.Log()) << uncalled_mock_log_source.Log(); 180 CHECK(mock_log_source.Log()) << uncalled_mock_log_source.Log();
178 PCHECK(!mock_log_source.Log()) << mock_log_source.Log(); 181 PCHECK(!mock_log_source.Log()) << mock_log_source.Log();
179 CHECK_EQ(mock_log_source.Log(), mock_log_source.Log()) 182 CHECK_EQ(mock_log_source.Log(), mock_log_source.Log())
180 << uncalled_mock_log_source.Log(); 183 << uncalled_mock_log_source.Log();
181 CHECK_NE(mock_log_source.Log(), mock_log_source.Log()) 184 CHECK_NE(mock_log_source.Log(), mock_log_source.Log())
182 << mock_log_source.Log(); 185 << mock_log_source.Log();
183 } 186 }
184 187
188 #endif
189
185 TEST_F(LoggingTest, DebugLoggingReleaseBehavior) { 190 TEST_F(LoggingTest, DebugLoggingReleaseBehavior) {
186 #if !defined(NDEBUG) 191 #if !defined(NDEBUG)
187 int debug_only_variable = 1; 192 int debug_only_variable = 1;
188 #endif 193 #endif
189 // These should avoid emitting references to |debug_only_variable| 194 // These should avoid emitting references to |debug_only_variable|
190 // in release mode. 195 // in release mode.
191 DLOG_IF(INFO, debug_only_variable) << "test"; 196 DLOG_IF(INFO, debug_only_variable) << "test";
192 DLOG_ASSERT(debug_only_variable) << "test"; 197 DLOG_ASSERT(debug_only_variable) << "test";
193 DPLOG_IF(INFO, debug_only_variable) << "test"; 198 DPLOG_IF(INFO, debug_only_variable) << "test";
194 DVLOG_IF(1, debug_only_variable) << "test"; 199 DVLOG_IF(1, debug_only_variable) << "test";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // These should still reference |some_variable| so we don't get 252 // These should still reference |some_variable| so we don't get
248 // unused variable warnings. 253 // unused variable warnings.
249 DCHECK(some_variable) << "test"; 254 DCHECK(some_variable) << "test";
250 DPCHECK(some_variable) << "test"; 255 DPCHECK(some_variable) << "test";
251 DCHECK_EQ(some_variable, 1) << "test"; 256 DCHECK_EQ(some_variable, 1) << "test";
252 } 257 }
253 258
254 } // namespace 259 } // namespace
255 260
256 } // namespace logging 261 } // namespace logging
OLDNEW
« 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