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

Side by Side Diff: base/time_win_unittest.cc

Issue 50014: Fix a bunch of tiny near-bugs and bugs that static analysis identified... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « base/stats_table.cc ('k') | base/tracked_objects.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/time.h" 9 #include "base/time.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 TimeDelta delta = now - last_time; 119 TimeDelta delta = now - last_time;
120 if (delta.InMicroseconds() > 0 && 120 if (delta.InMicroseconds() > 0 &&
121 delta.InMicroseconds() < 1000) { 121 delta.InMicroseconds() < 1000) {
122 if (min_timer > delta.InMicroseconds()) 122 if (min_timer > delta.InMicroseconds())
123 min_timer = delta.InMicroseconds(); 123 min_timer = delta.InMicroseconds();
124 saw_submillisecond_timer = true; 124 saw_submillisecond_timer = true;
125 } 125 }
126 last_time = now; 126 last_time = now;
127 } 127 }
128 EXPECT_TRUE(saw_submillisecond_timer); 128 EXPECT_TRUE(saw_submillisecond_timer);
129 printf("Min timer is: %dus\n", min_timer); 129 printf("Min timer is: %ldus\n", static_cast<long>(min_timer));
130 } 130 }
131 131
132 TEST(TimeTicks, TimeGetTimeCaps) { 132 TEST(TimeTicks, TimeGetTimeCaps) {
133 // Test some basic assumptions that we expect about how timeGetDevCaps works. 133 // Test some basic assumptions that we expect about how timeGetDevCaps works.
134 134
135 TIMECAPS caps; 135 TIMECAPS caps;
136 MMRESULT status = timeGetDevCaps(&caps, sizeof(caps)); 136 MMRESULT status = timeGetDevCaps(&caps, sizeof(caps));
137 EXPECT_EQ(TIMERR_NOERROR, status); 137 EXPECT_EQ(TIMERR_NOERROR, status);
138 if (status != TIMERR_NOERROR) { 138 if (status != TIMERR_NOERROR) {
139 printf("Could not get timeGetDevCaps\n"); 139 printf("Could not get timeGetDevCaps\n");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // measurements are still useful for testing timers on various platforms. 195 // measurements are still useful for testing timers on various platforms.
196 // The reason to remove the check is because the tests run on many 196 // The reason to remove the check is because the tests run on many
197 // buildbots, some of which are VMs. These machines can run horribly 197 // buildbots, some of which are VMs. These machines can run horribly
198 // slow, and there is really no value for checking against a max timer. 198 // slow, and there is really no value for checking against a max timer.
199 //EXPECT_LT((stop - start).InMilliseconds(), kMaxTime); 199 //EXPECT_LT((stop - start).InMilliseconds(), kMaxTime);
200 printf("%s: %1.2fus per call\n", cases[test_case].description, 200 printf("%s: %1.2fus per call\n", cases[test_case].description,
201 (stop - start).InMillisecondsF() * 1000 / kLoops); 201 (stop - start).InMillisecondsF() * 1000 / kLoops);
202 test_case++; 202 test_case++;
203 } 203 }
204 } 204 }
OLDNEW
« no previous file with comments | « base/stats_table.cc ('k') | base/tracked_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698