OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream2)); | 81 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream2)); |
82 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream1)); | 82 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream1)); |
83 | 83 |
84 EXPECT_EQ(sev, LogMessage::GetLogToStream(NULL)); | 84 EXPECT_EQ(sev, LogMessage::GetLogToStream(NULL)); |
85 } | 85 } |
86 | 86 |
87 // Ensure we don't crash when adding/removing streams while threads are going. | 87 // Ensure we don't crash when adding/removing streams while threads are going. |
88 // We should restore the correct global state at the end. | 88 // We should restore the correct global state at the end. |
89 class LogThread : public Thread { | 89 class LogThread : public Thread { |
90 public: | 90 public: |
91 virtual ~LogThread() { | 91 ~LogThread() override { |
92 Stop(); | 92 Stop(); |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 void Run() { | 96 void Run() override { |
97 // LS_SENSITIVE to avoid cluttering up any real logging going on | 97 // LS_SENSITIVE to avoid cluttering up any real logging going on |
98 LOG(LS_SENSITIVE) << "LOG"; | 98 LOG(LS_SENSITIVE) << "LOG"; |
99 } | 99 } |
100 }; | 100 }; |
101 | 101 |
102 TEST(LogTest, MultipleThreads) { | 102 TEST(LogTest, MultipleThreads) { |
103 int sev = LogMessage::GetLogToStream(NULL); | 103 int sev = LogMessage::GetLogToStream(NULL); |
104 | 104 |
105 LogThread thread1, thread2, thread3; | 105 LogThread thread1, thread2, thread3; |
106 thread1.Start(); | 106 thread1.Start(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 finish = TimeMillis(); | 153 finish = TimeMillis(); |
154 | 154 |
155 LogMessage::RemoveLogToStream(&stream); | 155 LogMessage::RemoveLogToStream(&stream); |
156 stream.Close(); | 156 stream.Close(); |
157 Filesystem::DeleteFile(path); | 157 Filesystem::DeleteFile(path); |
158 | 158 |
159 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; | 159 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; |
160 } | 160 } |
161 | 161 |
162 } // namespace rtc | 162 } // namespace rtc |
OLD | NEW |