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

Side by Side Diff: base/time/time_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_posix.cc ('k') | base/time/time_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 "base/time/time.h" 5 #include "base/time/time.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <time.h> 8 #include <time.h>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 TimeDelta delta = end - begin; 658 TimeDelta delta = end - begin;
659 TimeDelta delta_thread = end_thread - begin_thread; 659 TimeDelta delta_thread = end_thread - begin_thread;
660 // Make sure that some thread time have elapsed. 660 // Make sure that some thread time have elapsed.
661 EXPECT_GT(delta_thread.InMicroseconds(), 0); 661 EXPECT_GT(delta_thread.InMicroseconds(), 0);
662 // But the thread time is at least 9ms less than clock time. 662 // But the thread time is at least 9ms less than clock time.
663 TimeDelta difference = delta - delta_thread; 663 TimeDelta difference = delta - delta_thread;
664 EXPECT_GE(difference.InMicroseconds(), 9000); 664 EXPECT_GE(difference.InMicroseconds(), 9000);
665 } 665 }
666 } 666 }
667 667
668 TEST(TraceTicks, NowFromSystemTraceTime) {
669 // Re-use HighRes test for now since clock properties are identical.
670 using NowFunction = TimeTicks (*)(void);
671 HighResClockTest(reinterpret_cast<NowFunction>(&TraceTicks::Now));
672 }
673
674 TEST(TimeTicks, SnappedToNextTickBasic) { 668 TEST(TimeTicks, SnappedToNextTickBasic) {
675 base::TimeTicks phase = base::TimeTicks::FromInternalValue(4000); 669 base::TimeTicks phase = base::TimeTicks::FromInternalValue(4000);
676 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(1000); 670 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(1000);
677 base::TimeTicks timestamp; 671 base::TimeTicks timestamp;
678 672
679 // Timestamp in previous interval. 673 // Timestamp in previous interval.
680 timestamp = base::TimeTicks::FromInternalValue(3500); 674 timestamp = base::TimeTicks::FromInternalValue(3500);
681 EXPECT_EQ(4000, 675 EXPECT_EQ(4000,
682 timestamp.SnappedToNextTick(phase, interval).ToInternalValue()); 676 timestamp.SnappedToNextTick(phase, interval).ToInternalValue());
683 677
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1115
1122 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { 1116 TEST(TimeTicksLogging, DoesNotMakeStreamBad) {
1123 std::ostringstream oss; 1117 std::ostringstream oss;
1124 oss << TimeTicks(); 1118 oss << TimeTicks();
1125 EXPECT_TRUE(oss.good()); 1119 EXPECT_TRUE(oss.good());
1126 } 1120 }
1127 1121
1128 } // namespace 1122 } // namespace
1129 1123
1130 } // namespace base 1124 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time_posix.cc ('k') | base/time/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698