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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 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
« 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
870 TEST(TimeDeltaLogging, DCheckEqCompiles) { 879 TEST(TimeDeltaLogging, DCheckEqCompiles) {
871 DCHECK_EQ(TimeDelta(), TimeDelta()); 880 DCHECK_EQ(TimeDelta(), TimeDelta());
872 } 881 }
873 882
874 TEST(TimeDeltaLogging, EmptyIsZero) { 883 TEST(TimeDeltaLogging, EmptyIsZero) {
875 TimeDelta zero; 884 TimeDelta zero;
876 EXPECT_EQ("0s", AnyToString(zero)); 885 EXPECT_EQ("0s", AnyToString(zero));
877 } 886 }
878 887
879 TEST(TimeDeltaLogging, FiveHundredMs) { 888 TEST(TimeDeltaLogging, FiveHundredMs) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 956
948 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { 957 TEST(TimeTicksLogging, DoesNotMakeStreamBad) {
949 std::ostringstream oss; 958 std::ostringstream oss;
950 oss << TimeTicks(); 959 oss << TimeTicks();
951 EXPECT_TRUE(oss.good()); 960 EXPECT_TRUE(oss.good());
952 } 961 }
953 962
954 } // namespace 963 } // namespace
955 964
956 } // namespace base 965 } // 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