diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 16:09:31 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 16:09:31 +0000 |
commit | 08aa027647128343fbb1b2773dbf4dc94a7cfacf (patch) | |
tree | abf5bec5926422be79e09df0c32f3e923018738a /base/build_time_unittest.cc | |
parent | b9971dc609fab60d5c1b27c2d85c99fbd958f5a3 (diff) | |
download | chromium_src-08aa027647128343fbb1b2773dbf4dc94a7cfacf.zip chromium_src-08aa027647128343fbb1b2773dbf4dc94a7cfacf.tar.gz chromium_src-08aa027647128343fbb1b2773dbf4dc94a7cfacf.tar.bz2 |
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
Diffstat (limited to 'base/build_time_unittest.cc')
-rw-r--r-- | base/build_time_unittest.cc | 30 |
1 files changed, 30 insertions, 0 deletions
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(); +} |