Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1307)

Unified Diff: base/build_time_unittest.cc

Issue 8510027: base: export GetBuildTime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/build_time_unittest.cc
diff --git a/base/build_time_unittest.cc b/base/build_time_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..399a53f953625e56549e0b4d93c51b7d7b610782
--- /dev/null
+++ b/base/build_time_unittest.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/build_time.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(BuildTime, DateLooksValid) {
+ char build_date[] = __DATE__;
+
+ EXPECT_EQ(11u, strlen(build_date));
+ EXPECT_EQ(' ', build_date[3]);
+ EXPECT_EQ(' ', build_date[6]);
+}
+
+TEST(BuildTime, TimeLooksValid) {
+ char build_time[] = __TIME__;
+
+ EXPECT_EQ(8u, strlen(build_time));
+ EXPECT_EQ(':', build_time[2]);
+ EXPECT_EQ(':', build_time[5]);
+}
+
+TEST(BuildTime, DoesntCrash) {
+ // Since __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.
+ base::GetBuildTime();
jar (doing other things) 2011/11/09 22:51:31 You could compare to Now(), and it should always b
agl 2011/11/10 19:02:58 I don't think that we can do that. I've set the ti
jar (doing other things) 2011/11/11 02:48:35 Maybe it is too much of a hassle.... but you can g
+}
« base/build_time.h ('K') | « base/build_time.cc ('k') | base/metrics/field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698