1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/build_time.h"
7 #include "base/time/time.h"
8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 TEST(BuildTime, DateLooksValid) {
12 base::Time build_time = base::GetBuildTime();
13 base::Time::Exploded exploded_build_time;
14 build_time.UTCExplode(&exploded_build_time);
15 ASSERT_TRUE(exploded_build_time.HasValidValues());
17 #if !defined(OFFICIAL_BUILD)
18 EXPECT_EQ(exploded_build_time.hour, 5);
19 EXPECT_EQ(exploded_build_time.minute, 0);
20 EXPECT_EQ(exploded_build_time.second, 0);
24 // Disabled on Android due to flakes; see https://crbug.com/1474884.
25 #if BUILDFLAG(IS_ANDROID)
26 #define MAYBE_InThePast DISABLED_InThePast
28 #define MAYBE_InThePast InThePast
30 TEST(BuildTime, MAYBE_InThePast) {
31 EXPECT_LT(base::GetBuildTime(), base::Time::Now());
32 EXPECT_LT(base::GetBuildTime(), base::Time::NowFromSystemTime());