| OLD | NEW |
| 1 // Copyright (c) 2010 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 |
| 11 namespace logging { | 11 namespace logging { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const int kExpectedDebugOrReleaseCalls = 6; | 55 const int kExpectedDebugOrReleaseCalls = 6; |
| 56 const int kExpectedDebugCalls = 6; | 56 const int kExpectedDebugCalls = 6; |
| 57 const int kExpectedCalls = | 57 const int kExpectedCalls = |
| 58 kExpectedDebugOrReleaseCalls + (DEBUG_MODE ? kExpectedDebugCalls : 0); | 58 kExpectedDebugOrReleaseCalls + (DEBUG_MODE ? kExpectedDebugCalls : 0); |
| 59 EXPECT_CALL(mock_log_source, Log()).Times(kExpectedCalls). | 59 EXPECT_CALL(mock_log_source, Log()).Times(kExpectedCalls). |
| 60 WillRepeatedly(Return("log message")); | 60 WillRepeatedly(Return("log message")); |
| 61 | 61 |
| 62 SetMinLogLevel(LOG_INFO); | 62 SetMinLogLevel(LOG_INFO); |
| 63 | 63 |
| 64 EXPECT_TRUE(LOG_IS_ON(INFO)); | 64 EXPECT_TRUE(LOG_IS_ON(INFO)); |
| 65 EXPECT_EQ(DEBUG_MODE != 0, DLOG_IS_ON(INFO)); | 65 // As of g++-4.5, the first argument to EXPECT_EQ cannot be a |
| 66 // constant expression. |
| 67 const bool kIsDebugMode = (DEBUG_MODE != 0); |
| 68 EXPECT_EQ(kIsDebugMode, DLOG_IS_ON(INFO)); |
| 66 EXPECT_TRUE(VLOG_IS_ON(0)); | 69 EXPECT_TRUE(VLOG_IS_ON(0)); |
| 67 | 70 |
| 68 LOG(INFO) << mock_log_source.Log(); | 71 LOG(INFO) << mock_log_source.Log(); |
| 69 LOG_IF(INFO, true) << mock_log_source.Log(); | 72 LOG_IF(INFO, true) << mock_log_source.Log(); |
| 70 PLOG(INFO) << mock_log_source.Log(); | 73 PLOG(INFO) << mock_log_source.Log(); |
| 71 PLOG_IF(INFO, true) << mock_log_source.Log(); | 74 PLOG_IF(INFO, true) << mock_log_source.Log(); |
| 72 VLOG(0) << mock_log_source.Log(); | 75 VLOG(0) << mock_log_source.Log(); |
| 73 VLOG_IF(0, true) << mock_log_source.Log(); | 76 VLOG_IF(0, true) << mock_log_source.Log(); |
| 74 | 77 |
| 75 DLOG(INFO) << mock_log_source.Log(); | 78 DLOG(INFO) << mock_log_source.Log(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // These should still reference |some_variable| so we don't get | 241 // These should still reference |some_variable| so we don't get |
| 239 // unused variable warnings. | 242 // unused variable warnings. |
| 240 DCHECK(some_variable) << "test"; | 243 DCHECK(some_variable) << "test"; |
| 241 DPCHECK(some_variable) << "test"; | 244 DPCHECK(some_variable) << "test"; |
| 242 DCHECK_EQ(some_variable, 1) << "test"; | 245 DCHECK_EQ(some_variable, 1) << "test"; |
| 243 } | 246 } |
| 244 | 247 |
| 245 } // namespace | 248 } // namespace |
| 246 | 249 |
| 247 } // namespace logging | 250 } // namespace logging |
| OLD | NEW |