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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « base/time/time.h ('k') | base/trace_event/memory_dump_manager.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 "base/time/time.h" 5 #include "base/time/time.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 TimeDelta::FromMicroseconds(negative_one).magnitude()); 860 TimeDelta::FromMicroseconds(negative_one).magnitude());
861 861
862 const int64 max_int64_minus_one = std::numeric_limits<int64>::max() - 1; 862 const int64 max_int64_minus_one = std::numeric_limits<int64>::max() - 1;
863 const int64 min_int64_plus_two = std::numeric_limits<int64>::min() + 2; 863 const int64 min_int64_plus_two = std::numeric_limits<int64>::min() + 2;
864 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), 864 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one),
865 TimeDelta::FromMicroseconds(max_int64_minus_one).magnitude()); 865 TimeDelta::FromMicroseconds(max_int64_minus_one).magnitude());
866 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), 866 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one),
867 TimeDelta::FromMicroseconds(min_int64_plus_two).magnitude()); 867 TimeDelta::FromMicroseconds(min_int64_plus_two).magnitude());
868 } 868 }
869 869
870
871 TEST(TimeDelta, multiply_by) {
872 double d = 0.5;
873 EXPECT_EQ(TimeDelta::FromMilliseconds(500),
874 TimeDelta::FromMilliseconds(1000).multiply_by(d));
875 EXPECT_EQ(TimeDelta::FromMilliseconds(2000),
876 TimeDelta::FromMilliseconds(1000).divide_by(d));
877 }
878
879 TEST(TimeDeltaLogging, DCheckEqCompiles) { 870 TEST(TimeDeltaLogging, DCheckEqCompiles) {
880 DCHECK_EQ(TimeDelta(), TimeDelta()); 871 DCHECK_EQ(TimeDelta(), TimeDelta());
881 } 872 }
882 873
883 TEST(TimeDeltaLogging, EmptyIsZero) { 874 TEST(TimeDeltaLogging, EmptyIsZero) {
884 TimeDelta zero; 875 TimeDelta zero;
885 EXPECT_EQ("0s", AnyToString(zero)); 876 EXPECT_EQ("0s", AnyToString(zero));
886 } 877 }
887 878
888 TEST(TimeDeltaLogging, FiveHundredMs) { 879 TEST(TimeDeltaLogging, FiveHundredMs) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 947
957 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { 948 TEST(TimeTicksLogging, DoesNotMakeStreamBad) {
958 std::ostringstream oss; 949 std::ostringstream oss;
959 oss << TimeTicks(); 950 oss << TimeTicks();
960 EXPECT_TRUE(oss.good()); 951 EXPECT_TRUE(oss.good());
961 } 952 }
962 953
963 } // namespace 954 } // namespace
964 955
965 } // namespace base 956 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698