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

Side by Side Diff: net/test/scoped_mock_log.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_ 5 #ifndef NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_
6 #define NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_ 6 #define NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // crashes. Usually this method is called in the same thread that 60 // crashes. Usually this method is called in the same thread that
61 // created this object. It is the user's responsibility to not call 61 // created this object. It is the user's responsibility to not call
62 // this method if another thread may be calling it or 62 // this method if another thread may be calling it or
63 // StartCapturingLogs() at the same time. 63 // StartCapturingLogs() at the same time.
64 void StopCapturingLogs(); 64 void StopCapturingLogs();
65 65
66 // Sets the Log Message Handler that gets passed every log message before 66 // Sets the Log Message Handler that gets passed every log message before
67 // it's sent to other log destinations (if any). 67 // it's sent to other log destinations (if any).
68 // Returns true to signal that it handled the message and the message 68 // Returns true to signal that it handled the message and the message
69 // should not be sent to other log destinations. 69 // should not be sent to other log destinations.
70 MOCK_METHOD5(Log, bool(int severity, 70 MOCK_METHOD5(Log,
71 const char* file, 71 bool(int severity,
72 int line, 72 const char* file,
73 size_t message_start, 73 int line,
74 const std::string& str)); 74 size_t message_start,
75 const std::string& str));
75 76
76 private: 77 private:
77 // The currently active scoped mock log. 78 // The currently active scoped mock log.
78 static ScopedMockLog* g_instance_; 79 static ScopedMockLog* g_instance_;
79 80
80 // Static function which is set as the logging message handler. 81 // Static function which is set as the logging message handler.
81 // Called once for each message. 82 // Called once for each message.
82 static bool LogMessageHandler(int severity, 83 static bool LogMessageHandler(int severity,
83 const char* file, 84 const char* file,
84 int line, 85 int line,
85 size_t message_start, 86 size_t message_start,
86 const std::string& str); 87 const std::string& str);
87 88
88 // True if this object is currently capturing logs. 89 // True if this object is currently capturing logs.
89 bool is_capturing_logs_; 90 bool is_capturing_logs_;
90 91
91 // The previous handler to restore when the ScopedMockLog is destroyed. 92 // The previous handler to restore when the ScopedMockLog is destroyed.
92 logging::LogMessageHandlerFunction previous_handler_; 93 logging::LogMessageHandlerFunction previous_handler_;
93 }; 94 };
94 95
95 } // namespace test 96 } // namespace test
96 } // namespace net 97 } // namespace net
97 98
98 #endif // NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_ 99 #endif // NET_QUIC_TEST_TOOLS_SCOPED_MOCK_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698