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 #include "base/test/mock_log.h" | 5 #include "base/test/mock_log.h" |
6 | 6 |
7 namespace base { | 7 namespace base { |
8 namespace test { | 8 namespace test { |
9 | 9 |
10 // static | 10 // static |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 g_instance_ = nullptr; | 49 g_instance_ = nullptr; |
50 } | 50 } |
51 | 51 |
52 // static | 52 // static |
53 bool MockLog::LogMessageHandler(int severity, | 53 bool MockLog::LogMessageHandler(int severity, |
54 const char* file, | 54 const char* file, |
55 int line, | 55 int line, |
56 size_t message_start, | 56 size_t message_start, |
57 const std::string& str) { | 57 const std::string& str) { |
58 // gMock guarantees thread-safety for calling a mocked method | 58 // gMock guarantees thread-safety for calling a mocked method |
59 // (https://code.google.com/p/googlemock/wiki/CookBook#Using_Google_Mock_and_T
hreads) | 59 // (https://github.com/google/googlemock/blob/master/googlemock/docs/CookBook.
md#using-google-mock-and-threads) |
60 // but we also need to make sure that Start/StopCapturingLogs are synchronized | 60 // but we also need to make sure that Start/StopCapturingLogs are synchronized |
61 // with LogMessageHandler. | 61 // with LogMessageHandler. |
62 AutoLock scoped_lock(g_lock); | 62 AutoLock scoped_lock(g_lock); |
63 | 63 |
64 return g_instance_->Log(severity, file, line, message_start, str); | 64 return g_instance_->Log(severity, file, line, message_start, str); |
65 } | 65 } |
66 | 66 |
67 } // namespace test | 67 } // namespace test |
68 } // namespace base | 68 } // namespace base |
OLD | NEW |