| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_TEST_MOCK_LOG_H_ | 5 #ifndef BASE_TEST_MOCK_LOG_H_ |
| 6 #define BASE_TEST_MOCK_LOG_H_ | 6 #define BASE_TEST_MOCK_LOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gtest/googlemock/include/gmock/gmock.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 // A MockLog object intercepts LOG() messages issued during its lifespan. Using | 18 // A MockLog object intercepts LOG() messages issued during its lifespan. Using |
| 19 // this together with gMock, it's very easy to test how a piece of code calls | 19 // this together with gMock, it's very easy to test how a piece of code calls |
| 20 // LOG(). The typical usage: | 20 // LOG(). The typical usage: |
| 21 // | 21 // |
| 22 // TEST(FooTest, LogsCorrectly) { | 22 // TEST(FooTest, LogsCorrectly) { |
| 23 // MockLog log; | 23 // MockLog log; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // The previous handler to restore when the MockLog is destroyed. | 89 // The previous handler to restore when the MockLog is destroyed. |
| 90 logging::LogMessageHandlerFunction previous_handler_; | 90 logging::LogMessageHandlerFunction previous_handler_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(MockLog); | 92 DISALLOW_COPY_AND_ASSIGN(MockLog); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace test | 95 } // namespace test |
| 96 } // namespace base | 96 } // namespace base |
| 97 | 97 |
| 98 #endif // BASE_TEST_MOCK_LOG_H_ | 98 #endif // BASE_TEST_MOCK_LOG_H_ |
| OLD | NEW |