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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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/base/logging.cc ('k') | webrtc/base/macasyncsocket.h » ('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
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 LogMessage::RemoveLogToStream(&stream1); 116 LogMessage::RemoveLogToStream(&stream1);
117 LogMessage::RemoveLogToStream(&stream2); 117 LogMessage::RemoveLogToStream(&stream2);
118 LogMessage::RemoveLogToStream(&stream3); 118 LogMessage::RemoveLogToStream(&stream3);
119 } 119 }
120 120
121 EXPECT_EQ(sev, LogMessage::GetLogToStream(NULL)); 121 EXPECT_EQ(sev, LogMessage::GetLogToStream(NULL));
122 } 122 }
123 123
124 124
125 TEST(LogTest, WallClockStartTime) { 125 TEST(LogTest, WallClockStartTime) {
126 uint32 time = LogMessage::WallClockStartTime(); 126 uint32_t time = LogMessage::WallClockStartTime();
127 // Expect the time to be in a sensible range, e.g. > 2012-01-01. 127 // Expect the time to be in a sensible range, e.g. > 2012-01-01.
128 EXPECT_GT(time, 1325376000u); 128 EXPECT_GT(time, 1325376000u);
129 } 129 }
130 130
131 // Test the time required to write 1000 80-character logs to an unbuffered file. 131 // Test the time required to write 1000 80-character logs to an unbuffered file.
132 TEST(LogTest, Perf) { 132 TEST(LogTest, Perf) {
133 Pathname path; 133 Pathname path;
134 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); 134 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL));
135 path.SetPathname(Filesystem::TempFilename(path, "ut")); 135 path.SetPathname(Filesystem::TempFilename(path, "ut"));
136 136
137 LogSinkImpl<FileStream> stream; 137 LogSinkImpl<FileStream> stream;
138 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL)); 138 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL));
139 stream.DisableBuffering(); 139 stream.DisableBuffering();
140 LogMessage::AddLogToStream(&stream, LS_SENSITIVE); 140 LogMessage::AddLogToStream(&stream, LS_SENSITIVE);
141 141
142 uint32 start = Time(), finish; 142 uint32_t start = Time(), finish;
143 std::string message('X', 80); 143 std::string message('X', 80);
144 for (int i = 0; i < 1000; ++i) { 144 for (int i = 0; i < 1000; ++i) {
145 LOG(LS_SENSITIVE) << message; 145 LOG(LS_SENSITIVE) << message;
146 } 146 }
147 finish = Time(); 147 finish = Time();
148 148
149 LogMessage::RemoveLogToStream(&stream); 149 LogMessage::RemoveLogToStream(&stream);
150 stream.Close(); 150 stream.Close();
151 Filesystem::DeleteFile(path); 151 Filesystem::DeleteFile(path);
152 152
153 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " us"; 153 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " us";
154 } 154 }
155 155
156 } // namespace rtc 156 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/logging.cc ('k') | webrtc/base/macasyncsocket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698