[M85 Dev][EFL] Fix crashes at webview launch
[platform/framework/web/chromium-efl.git] / base / build_time_unittest.cc
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/build_time.h"
6 #include "base/generated_build_date.h"
7 #include "base/time/time.h"
8 #include "build/build_config.h"
9
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 TEST(BuildTime, DateLooksValid) {
13   char build_date[] = BUILD_DATE;
14
15   EXPECT_EQ(20u, strlen(build_date));
16   EXPECT_EQ(' ', build_date[3]);
17   EXPECT_EQ(' ', build_date[6]);
18   EXPECT_EQ(' ', build_date[11]);
19 #if !defined(OFFICIAL_BUILD)
20   EXPECT_EQ('0', build_date[12]);
21   EXPECT_EQ('5', build_date[13]);
22 #endif
23   EXPECT_EQ(':', build_date[14]);
24 #if !defined(OFFICIAL_BUILD)
25   EXPECT_EQ('0', build_date[15]);
26   EXPECT_EQ('0', build_date[16]);
27 #endif
28   EXPECT_EQ(':', build_date[17]);
29 #if !defined(OFFICIAL_BUILD)
30   EXPECT_EQ('0', build_date[18]);
31   EXPECT_EQ('0', build_date[19]);
32 #endif
33 }
34
35 #if defined(OS_FUCHSIA)
36 // TODO(https://crbug.com/1060357): Enable when RTC flake is fixed.
37 #define MAYBE_InThePast DISABLED_InThePast
38 #else
39 #define MAYBE_InThePast InThePast
40 #endif
41
42 TEST(BuildTime, MAYBE_InThePast) {
43   EXPECT_LT(base::GetBuildTime(), base::Time::Now());
44   EXPECT_LT(base::GetBuildTime(), base::Time::NowFromSystemTime());
45 }