Chromium Code Reviews| Index: base/build_time_unittest.cc |
| diff --git a/base/build_time_unittest.cc b/base/build_time_unittest.cc |
| index aac64a7dc7c1f63d3b664b809245680faeef43d8..210603f0771cf74e7a9b10822d4cca1927e4599e 100644 |
| --- a/base/build_time_unittest.cc |
| +++ b/base/build_time_unittest.cc |
| @@ -3,15 +3,13 @@ |
| // found in the LICENSE file. |
| #include "base/build_time.h" |
| +#include "base/generated_build_date.h" |
| +#include "base/time/time.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| TEST(BuildTime, DateLooksValid) { |
| -#if !defined(DONT_EMBED_BUILD_METADATA) |
| - char build_date[] = __DATE__; |
| -#else |
| - char build_date[] = "Sep 02 2008"; |
| -#endif |
| + char build_date[] = BUILD_DATE; |
| EXPECT_EQ(11u, strlen(build_date)); |
| EXPECT_EQ(' ', build_date[3]); |
| @@ -19,11 +17,7 @@ TEST(BuildTime, DateLooksValid) { |
| } |
| TEST(BuildTime, TimeLooksValid) { |
| -#if defined(DONT_EMBED_BUILD_METADATA) |
| - char build_time[] = "08:00:00"; |
| -#else |
| - char build_time[] = __TIME__; |
| -#endif |
| + char build_time[] = "00:00:00"; |
| EXPECT_EQ(8u, strlen(build_time)); |
| EXPECT_EQ(':', build_time[2]); |
| @@ -31,8 +25,13 @@ TEST(BuildTime, TimeLooksValid) { |
| } |
| TEST(BuildTime, DoesntCrash) { |
| - // Since __DATE__ isn't updated unless one does a clobber build, we can't |
| + // Since BUILD_DATE isn't updated unless one does a clobber build, we can't |
| // really test the value returned by it, except to check that it doesn't |
| // crash. |
|
Dirk Pranke
2016/02/09 02:46:56
this comment is wrong, now, right? BUILD_DATE will
|
| base::GetBuildTime(); |
| } |
| + |
| +TEST(BuildTime, InThePast) { |
| + EXPECT_TRUE(base::GetBuildTime() < base::Time::Now()); |
| + EXPECT_TRUE(base::GetBuildTime() < base::Time::NowFromSystemTime()); |
| +} |