base: export GetBuildTime

A need for the function came up in another context so this change exposes it
from base/.

BUG=none
TEST=base_unittests


Review URL: http://codereview.chromium.org/8510027

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109638 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/build_time_unittest.cc b/base/build_time_unittest.cc
new file mode 100644
index 0000000..399a53f
--- /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();
+}