123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #ifndef BASE_TEST_MOCK_LOG_H_
- #define BASE_TEST_MOCK_LOG_H_
- #include <stddef.h>
- #include <string>
- #include "base/logging.h"
- #include "base/macros.h"
- #include "base/synchronization/lock.h"
- #include "testing/gmock/include/gmock/gmock.h"
- namespace base {
- namespace test {
- class MockLog {
- public:
-
-
-
-
-
- MockLog();
-
- ~MockLog();
-
-
- void StartCapturingLogs();
-
- void StopCapturingLogs();
-
-
-
-
- MOCK_METHOD5(Log,
- bool(int severity,
- const char* file,
- int line,
- size_t message_start,
- const std::string& str));
- private:
-
- static MockLog* g_instance_;
-
- static Lock g_lock;
-
-
- static bool LogMessageHandler(int severity,
- const char* file,
- int line,
- size_t message_start,
- const std::string& str);
-
- bool is_capturing_logs_;
-
- logging::LogMessageHandlerFunction previous_handler_;
- DISALLOW_COPY_AND_ASSIGN(MockLog);
- };
- }
- }
- #endif
|