OLD | NEW |
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 <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 } | 144 } |
145 EXPECT_TRUE(saw_submillisecond_timer); | 145 EXPECT_TRUE(saw_submillisecond_timer); |
146 } | 146 } |
147 | 147 |
148 TEST(TimeTicks, TimeGetTimeCaps) { | 148 TEST(TimeTicks, TimeGetTimeCaps) { |
149 // Test some basic assumptions that we expect about how timeGetDevCaps works. | 149 // Test some basic assumptions that we expect about how timeGetDevCaps works. |
150 | 150 |
151 TIMECAPS caps; | 151 TIMECAPS caps; |
152 MMRESULT status = timeGetDevCaps(&caps, sizeof(caps)); | 152 MMRESULT status = timeGetDevCaps(&caps, sizeof(caps)); |
153 EXPECT_EQ(TIMERR_NOERROR, status); | 153 ASSERT_EQ(static_cast<MMRESULT>(MMSYSERR_NOERROR), status); |
154 if (status != TIMERR_NOERROR) { | |
155 printf("Could not get timeGetDevCaps\n"); | |
156 return; | |
157 } | |
158 | 154 |
159 EXPECT_GE(static_cast<int>(caps.wPeriodMin), 1); | 155 EXPECT_GE(static_cast<int>(caps.wPeriodMin), 1); |
160 EXPECT_GT(static_cast<int>(caps.wPeriodMax), 1); | 156 EXPECT_GT(static_cast<int>(caps.wPeriodMax), 1); |
161 EXPECT_GE(static_cast<int>(caps.wPeriodMin), 1); | 157 EXPECT_GE(static_cast<int>(caps.wPeriodMin), 1); |
162 EXPECT_GT(static_cast<int>(caps.wPeriodMax), 1); | 158 EXPECT_GT(static_cast<int>(caps.wPeriodMax), 1); |
163 printf("timeGetTime range is %d to %dms\n", caps.wPeriodMin, | 159 printf("timeGetTime range is %d to %dms\n", caps.wPeriodMin, |
164 caps.wPeriodMax); | 160 caps.wPeriodMax); |
165 } | 161 } |
166 | 162 |
167 TEST(TimeTicks, QueryPerformanceFrequency) { | 163 TEST(TimeTicks, QueryPerformanceFrequency) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 static_cast<double>((converted_value - TimeTicks()).InMicroseconds()); | 283 static_cast<double>((converted_value - TimeTicks()).InMicroseconds()); |
288 EXPECT_NEAR(expected_microseconds_since_origin, | 284 EXPECT_NEAR(expected_microseconds_since_origin, |
289 converted_microseconds_since_origin, | 285 converted_microseconds_since_origin, |
290 1.0) | 286 1.0) |
291 << "ticks=" << ticks << ", to be converted via logic path: " | 287 << "ticks=" << ticks << ", to be converted via logic path: " |
292 << (ticks < Time::kQPCOverflowThreshold ? "FAST" : "SAFE"); | 288 << (ticks < Time::kQPCOverflowThreshold ? "FAST" : "SAFE"); |
293 } | 289 } |
294 } | 290 } |
295 | 291 |
296 } // namespace base | 292 } // namespace base |
OLD | NEW |