| OLD | NEW |
| 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 | 8 |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 #if !defined(OFFICIAL_BUILD) | 173 #if !defined(OFFICIAL_BUILD) |
| 174 | 174 |
| 175 TEST_F(LoggingTest, CheckStreamsAreLazy) { | 175 TEST_F(LoggingTest, CheckStreamsAreLazy) { |
| 176 MockLogSource mock_log_source, uncalled_mock_log_source; | 176 MockLogSource mock_log_source, uncalled_mock_log_source; |
| 177 EXPECT_CALL(mock_log_source, Log()).Times(8). | 177 EXPECT_CALL(mock_log_source, Log()).Times(8). |
| 178 WillRepeatedly(Return("check message")); | 178 WillRepeatedly(Return("check message")); |
| 179 EXPECT_CALL(uncalled_mock_log_source, Log()).Times(0); | 179 EXPECT_CALL(uncalled_mock_log_source, Log()).Times(0); |
| 180 | 180 |
| 181 SetLogAssertHandler(&LogSink); | 181 SetLogAssertHandler(&LogSink); |
| 182 | 182 |
| 183 CHECK(mock_log_source.Log()) << uncalled_mock_log_source.Log(); | 183 CHECK(mock_log_source.Log()); |
| 184 PCHECK(!mock_log_source.Log()) << mock_log_source.Log(); | 184 CHECK(!mock_log_source.Log()); |
| 185 CHECK_EQ(mock_log_source.Log(), mock_log_source.Log()) | 185 CHECK_EQ(mock_log_source.Log(), mock_log_source.Log()); |
| 186 << uncalled_mock_log_source.Log(); | 186 CHECK_NE(mock_log_source.Log(), mock_log_source.Log()); |
| 187 CHECK_NE(mock_log_source.Log(), mock_log_source.Log()) | |
| 188 << mock_log_source.Log(); | |
| 189 } | 187 } |
| 190 | 188 |
| 191 #endif | 189 #endif |
| 192 | 190 |
| 193 TEST_F(LoggingTest, DebugLoggingReleaseBehavior) { | 191 TEST_F(LoggingTest, DebugLoggingReleaseBehavior) { |
| 194 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) | 192 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
| 195 int debug_only_variable = 1; | 193 int debug_only_variable = 1; |
| 196 #endif | 194 #endif |
| 197 // These should avoid emitting references to |debug_only_variable| | 195 // These should avoid emitting references to |debug_only_variable| |
| 198 // in release mode. | 196 // in release mode. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 std::wstring wstr = L"Hello World"; | 339 std::wstring wstr = L"Hello World"; |
| 342 std::ostringstream ostr; | 340 std::ostringstream ostr; |
| 343 ostr << wstr; | 341 ostr << wstr; |
| 344 EXPECT_EQ("Hello World", ostr.str()); | 342 EXPECT_EQ("Hello World", ostr.str()); |
| 345 } | 343 } |
| 346 } // namespace nested_test | 344 } // namespace nested_test |
| 347 | 345 |
| 348 } // namespace | 346 } // namespace |
| 349 | 347 |
| 350 } // namespace logging | 348 } // namespace logging |
| OLD | NEW |