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

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

Issue 1424703003: Kills TraceTicks, which was functionally the same as TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed win compile error. Created 5 years, 1 month 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 | « base/time/time_win.cc ('k') | base/trace_event/trace_event.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 // 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 TestFunc func; 185 TestFunc func;
186 const char *description; 186 const char *description;
187 }; 187 };
188 // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time) 188 // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time)
189 // in order to create a single test case list. 189 // in order to create a single test case list.
190 COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time), 190 COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time),
191 test_only_works_with_same_sizes); 191 test_only_works_with_same_sizes);
192 std::vector<TestCase> cases; 192 std::vector<TestCase> cases;
193 cases.push_back({reinterpret_cast<TestFunc>(&Time::Now), "Time::Now"}); 193 cases.push_back({reinterpret_cast<TestFunc>(&Time::Now), "Time::Now"});
194 cases.push_back({&TimeTicks::Now, "TimeTicks::Now"}); 194 cases.push_back({&TimeTicks::Now, "TimeTicks::Now"});
195 cases.push_back(
196 {reinterpret_cast<TestFunc>(&TraceTicks::Now), "TraceTicks::Now"});
197 195
198 if (ThreadTicks::IsSupported()) { 196 if (ThreadTicks::IsSupported()) {
199 ThreadTicks::WaitUntilInitialized(); 197 ThreadTicks::WaitUntilInitialized();
200 cases.push_back( 198 cases.push_back(
201 {reinterpret_cast<TestFunc>(&ThreadTicks::Now), "ThreadTicks::Now"}); 199 {reinterpret_cast<TestFunc>(&ThreadTicks::Now), "ThreadTicks::Now"});
202 } 200 }
203 201
204 for (const auto& test_case : cases) { 202 for (const auto& test_case : cases) {
205 TimeTicks start = TimeTicks::Now(); 203 TimeTicks start = TimeTicks::Now();
206 for (int index = 0; index < kLoops; index++) 204 for (int index = 0; index < kLoops; index++)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 static_cast<double>((converted_value - TimeTicks()).InMicroseconds()); 287 static_cast<double>((converted_value - TimeTicks()).InMicroseconds());
290 EXPECT_NEAR(expected_microseconds_since_origin, 288 EXPECT_NEAR(expected_microseconds_since_origin,
291 converted_microseconds_since_origin, 289 converted_microseconds_since_origin,
292 1.0) 290 1.0)
293 << "ticks=" << ticks << ", to be converted via logic path: " 291 << "ticks=" << ticks << ", to be converted via logic path: "
294 << (ticks < Time::kQPCOverflowThreshold ? "FAST" : "SAFE"); 292 << (ticks < Time::kQPCOverflowThreshold ? "FAST" : "SAFE");
295 } 293 }
296 } 294 }
297 295
298 } // namespace base 296 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time_win.cc ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698