OLD | NEW |
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 #include "net/test/scoped_mock_log.h" | 5 #include "net/test/scoped_mock_log.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 namespace test { | 10 namespace test { |
11 | 11 |
12 // static | 12 // static |
13 ScopedMockLog* ScopedMockLog::g_instance_ = NULL; | 13 ScopedMockLog* ScopedMockLog::g_instance_ = NULL; |
14 | 14 |
15 ScopedMockLog::ScopedMockLog() : is_capturing_logs_(false) {} | 15 ScopedMockLog::ScopedMockLog() : is_capturing_logs_(false) { |
| 16 } |
16 | 17 |
17 ScopedMockLog::~ScopedMockLog() { | 18 ScopedMockLog::~ScopedMockLog() { |
18 if (is_capturing_logs_) { | 19 if (is_capturing_logs_) { |
19 StopCapturingLogs(); | 20 StopCapturingLogs(); |
20 } | 21 } |
21 } | 22 } |
22 | 23 |
23 void ScopedMockLog::StartCapturingLogs() { | 24 void ScopedMockLog::StartCapturingLogs() { |
24 // We don't use CHECK(), which can generate a new LOG message, and | 25 // We don't use CHECK(), which can generate a new LOG message, and |
25 // thus can confuse ScopedMockLog objects or other registered | 26 // thus can confuse ScopedMockLog objects or other registered |
(...skipping 23 matching lines...) Expand all Loading... |
49 bool ScopedMockLog::LogMessageHandler(int severity, | 50 bool ScopedMockLog::LogMessageHandler(int severity, |
50 const char* file, | 51 const char* file, |
51 int line, | 52 int line, |
52 size_t message_start, | 53 size_t message_start, |
53 const std::string& str) { | 54 const std::string& str) { |
54 return g_instance_->Log(severity, file, line, message_start, str); | 55 return g_instance_->Log(severity, file, line, message_start, str); |
55 } | 56 } |
56 | 57 |
57 } // namespace test | 58 } // namespace test |
58 } // namespace net | 59 } // namespace net |
OLD | NEW |