OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/build_time.h" | 5 #include "base/build_time.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 TEST(BuildTime, DateLooksValid) { | 9 TEST(BuildTime, DateLooksValid) { |
10 #if !defined(DONT_EMBED_BUILD_METADATA) | |
11 char build_date[] = __DATE__; | 10 char build_date[] = __DATE__; |
agl
2016/01/29 21:46:46
I'm not sure when DONT_EMBED_BUILD_METADATA was de
M-A Ruel
2016/01/30 02:58:14
It's meant to be used on the try server.
We want
Zachary Forman
2016/02/01 07:28:30
This sounds pretty reasonable to me. I've implemen
| |
12 #else | |
13 char build_date[] = "Sep 02 2008"; | |
14 #endif | |
15 | 11 |
16 EXPECT_EQ(11u, strlen(build_date)); | 12 EXPECT_EQ(11u, strlen(build_date)); |
17 EXPECT_EQ(' ', build_date[3]); | 13 EXPECT_EQ(' ', build_date[3]); |
18 EXPECT_EQ(' ', build_date[6]); | 14 EXPECT_EQ(' ', build_date[6]); |
19 } | 15 } |
20 | 16 |
21 TEST(BuildTime, TimeLooksValid) { | 17 TEST(BuildTime, TimeLooksValid) { |
22 #if defined(DONT_EMBED_BUILD_METADATA) | 18 char build_time[] = "00:00:00"; |
23 char build_time[] = "08:00:00"; | |
24 #else | |
25 char build_time[] = __TIME__; | |
26 #endif | |
27 | 19 |
28 EXPECT_EQ(8u, strlen(build_time)); | 20 EXPECT_EQ(8u, strlen(build_time)); |
29 EXPECT_EQ(':', build_time[2]); | 21 EXPECT_EQ(':', build_time[2]); |
30 EXPECT_EQ(':', build_time[5]); | 22 EXPECT_EQ(':', build_time[5]); |
31 } | 23 } |
32 | 24 |
33 TEST(BuildTime, DoesntCrash) { | 25 TEST(BuildTime, DoesntCrash) { |
34 // Since __DATE__ isn't updated unless one does a clobber build, we can't | 26 // Since __DATE__ isn't updated unless one does a clobber build, we can't |
35 // really test the value returned by it, except to check that it doesn't | 27 // really test the value returned by it, except to check that it doesn't |
36 // crash. | 28 // crash. |
37 base::GetBuildTime(); | 29 base::GetBuildTime(); |
38 } | 30 } |
OLD | NEW |