summaryrefslogtreecommitdiffstats
path: root/base/time/time_unittest.cc
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 14:59:17 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 14:59:17 +0000
commit6c177f5cda18d8221e6112d0f0a6a24efec938f7 (patch)
treefe94d7ca60d88eaa06f36815c38325d92620a54a /base/time/time_unittest.cc
parent7e72fb6daf3baa72a0a702f285f4326b367ef4c1 (diff)
downloadchromium_src-6c177f5cda18d8221e6112d0f0a6a24efec938f7.zip
chromium_src-6c177f5cda18d8221e6112d0f0a6a24efec938f7.tar.gz
chromium_src-6c177f5cda18d8221e6112d0f0a6a24efec938f7.tar.bz2
Use numeric_limits<double>::infinity() for conversions of Time::Max().
Infinity has mostly the same semantics of numeric_limits<double>::max(), which was being used before, but with the added bonus that numbers added and subtracted to it shouldn't change it. R=ajwong@chromium.org,jar@chromium.org,mkwst@chromium.org BUG=None Review URL: https://codereview.chromium.org/163493004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time/time_unittest.cc')
-rw-r--r--base/time/time_unittest.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc
index e78a61c..b5d2493 100644
--- a/base/time/time_unittest.cc
+++ b/base/time/time_unittest.cc
@@ -493,13 +493,13 @@ TEST_F(TimeTest, MaxConversions) {
Time t = Time::Max();
EXPECT_EQ(std::numeric_limits<int64>::max(), t.ToInternalValue());
- t = Time::FromDoubleT(std::numeric_limits<double>::max());
+ t = Time::FromDoubleT(std::numeric_limits<double>::infinity());
EXPECT_TRUE(t.is_max());
- EXPECT_EQ(std::numeric_limits<double>::max(), t.ToDoubleT());
+ EXPECT_EQ(std::numeric_limits<double>::infinity(), t.ToDoubleT());
- t = Time::FromJsTime(std::numeric_limits<double>::max());
+ t = Time::FromJsTime(std::numeric_limits<double>::infinity());
EXPECT_TRUE(t.is_max());
- EXPECT_EQ(std::numeric_limits<double>::max(), t.ToJsTime());
+ EXPECT_EQ(std::numeric_limits<double>::infinity(), t.ToJsTime());
t = Time::FromTimeT(std::numeric_limits<time_t>::max());
EXPECT_TRUE(t.is_max());
@@ -518,9 +518,10 @@ TEST_F(TimeTest, MaxConversions) {
#endif
#if defined(OS_MACOSX)
- t = Time::FromCFAbsoluteTime(std::numeric_limits<CFAbsoluteTime>::max());
+ t = Time::FromCFAbsoluteTime(std::numeric_limits<CFAbsoluteTime>::infinity());
EXPECT_TRUE(t.is_max());
- EXPECT_EQ(std::numeric_limits<CFAbsoluteTime>::max(), t.ToCFAbsoluteTime());
+ EXPECT_EQ(std::numeric_limits<CFAbsoluteTime>::infinity(),
+ t.ToCFAbsoluteTime());
#endif
#if defined(OS_WIN)