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

Side by Side Diff: base/time/time_win_unittest.cc

Issue 405123002: clang/win: Fix a Wenum-compare warning and a few Wwritable-strings warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/shell/browser/shell_web_contents_view_delegate_win.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 #include <process.h> 7 #include <process.h>
8 8
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Note: This is a somewhat arbitrary test. 171 // Note: This is a somewhat arbitrary test.
172 const int kLoops = 10000; 172 const int kLoops = 10000;
173 // Due to the fact that these run on bbots, which are horribly slow, 173 // Due to the fact that these run on bbots, which are horribly slow,
174 // we can't really make any guarantees about minimum runtime. 174 // we can't really make any guarantees about minimum runtime.
175 // Really, we want these to finish in ~10ms, and that is generous. 175 // Really, we want these to finish in ~10ms, and that is generous.
176 const int kMaxTime = 35; // Maximum acceptible milliseconds for test. 176 const int kMaxTime = 35; // Maximum acceptible milliseconds for test.
177 177
178 typedef TimeTicks (*TestFunc)(); 178 typedef TimeTicks (*TestFunc)();
179 struct TestCase { 179 struct TestCase {
180 TestFunc func; 180 TestFunc func;
181 char *description; 181 const char *description;
182 }; 182 };
183 // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time) 183 // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time)
184 // in order to create a single test case list. 184 // in order to create a single test case list.
185 COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time), 185 COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time),
186 test_only_works_with_same_sizes); 186 test_only_works_with_same_sizes);
187 TestCase cases[] = { 187 TestCase cases[] = {
188 { reinterpret_cast<TestFunc>(Time::Now), "Time::Now" }, 188 { reinterpret_cast<TestFunc>(Time::Now), "Time::Now" },
189 { TimeTicks::Now, "TimeTicks::Now" }, 189 { TimeTicks::Now, "TimeTicks::Now" },
190 { TimeTicks::HighResNow, "TimeTicks::HighResNow" }, 190 { TimeTicks::HighResNow, "TimeTicks::HighResNow" },
191 { NULL, "" } 191 { NULL, "" }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 total_drift += drift_microseconds; 233 total_drift += drift_microseconds;
234 } 234 }
235 235
236 // Sanity check. We expect some time drift to occur, especially across 236 // Sanity check. We expect some time drift to occur, especially across
237 // the number of iterations we do. 237 // the number of iterations we do.
238 EXPECT_LT(0, total_drift); 238 EXPECT_LT(0, total_drift);
239 239
240 printf("average time drift in microseconds: %lld\n", 240 printf("average time drift in microseconds: %lld\n",
241 total_drift / kIterations); 241 total_drift / kIterations);
242 } 242 }
OLDNEW
« no previous file with comments | « no previous file | content/shell/browser/shell_web_contents_view_delegate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698