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

Side by Side Diff: webrtc/rtc_base/logging_unittest.cc

Issue 2977953002: Partial Reland of Make the default ctor of rtc::Thread, protected (Closed)
Patch Set: Fix the same error elsewhere Created 3 years, 5 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
« no previous file with comments | « webrtc/rtc_base/criticalsection_unittest.cc ('k') | webrtc/rtc_base/messagequeue_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "webrtc/rtc_base/logging.h"
12 #include "webrtc/rtc_base/fileutils.h" 11 #include "webrtc/rtc_base/fileutils.h"
13 #include "webrtc/rtc_base/gunit.h" 12 #include "webrtc/rtc_base/gunit.h"
13 #include "webrtc/rtc_base/logging.h"
14 #include "webrtc/rtc_base/nullsocketserver.h"
14 #include "webrtc/rtc_base/pathutils.h" 15 #include "webrtc/rtc_base/pathutils.h"
15 #include "webrtc/rtc_base/stream.h" 16 #include "webrtc/rtc_base/stream.h"
16 #include "webrtc/rtc_base/thread.h" 17 #include "webrtc/rtc_base/thread.h"
17 18
18 namespace rtc { 19 namespace rtc {
19 20
20 template <typename Base> 21 template <typename Base>
21 class LogSinkImpl 22 class LogSinkImpl
22 : public LogSink, 23 : public LogSink,
23 public Base { 24 public Base {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream2)); 82 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream2));
82 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream1)); 83 EXPECT_EQ(LS_NONE, LogMessage::GetLogToStream(&stream1));
83 84
84 EXPECT_EQ(sev, LogMessage::GetLogToStream(nullptr)); 85 EXPECT_EQ(sev, LogMessage::GetLogToStream(nullptr));
85 } 86 }
86 87
87 // Ensure we don't crash when adding/removing streams while threads are going. 88 // Ensure we don't crash when adding/removing streams while threads are going.
88 // We should restore the correct global state at the end. 89 // We should restore the correct global state at the end.
89 class LogThread : public Thread { 90 class LogThread : public Thread {
90 public: 91 public:
92 LogThread() : Thread(std::unique_ptr<SocketServer>(new NullSocketServer())) {}
93
91 ~LogThread() override { 94 ~LogThread() override {
92 Stop(); 95 Stop();
93 } 96 }
94 97
95 private: 98 private:
96 void Run() override { 99 void Run() override {
97 // LS_SENSITIVE to avoid cluttering up any real logging going on 100 // LS_SENSITIVE to avoid cluttering up any real logging going on
98 LOG(LS_SENSITIVE) << "LOG"; 101 LOG(LS_SENSITIVE) << "LOG";
99 } 102 }
100 }; 103 };
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 finish = TimeMillis(); 156 finish = TimeMillis();
154 157
155 LogMessage::RemoveLogToStream(&stream); 158 LogMessage::RemoveLogToStream(&stream);
156 stream.Close(); 159 stream.Close();
157 Filesystem::DeleteFile(path); 160 Filesystem::DeleteFile(path);
158 161
159 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; 162 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms";
160 } 163 }
161 164
162 } // namespace rtc 165 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/rtc_base/criticalsection_unittest.cc ('k') | webrtc/rtc_base/messagequeue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698