diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 21:34:59 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 21:34:59 +0000 |
commit | 75a26d89c3b7517f2fbd5b67e21cb35185f1994f (patch) | |
tree | e5a1898f0038e0076c7ea7110aefc387f7e9a376 /chrome/installer/util/install_util_unittest.cc | |
parent | d1dccfcc206dcda315eba4f07c602f665203a6e5 (diff) | |
download | chromium_src-75a26d89c3b7517f2fbd5b67e21cb35185f1994f.zip chromium_src-75a26d89c3b7517f2fbd5b67e21cb35185f1994f.tar.gz chromium_src-75a26d89c3b7517f2fbd5b67e21cb35185f1994f.tar.bz2 |
Switch from wcsftime to GetDateFormat to avoid crash in setup.
TEST=Fix for crash in setup. See bug for details.
BUG=73212
Review URL: http://codereview.chromium.org/6533009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/install_util_unittest.cc')
-rw-r--r-- | chrome/installer/util/install_util_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc index a5cb86f..37e38bc 100644 --- a/chrome/installer/util/install_util_unittest.cc +++ b/chrome/installer/util/install_util_unittest.cc @@ -102,3 +102,22 @@ TEST_F(InstallUtilTest, MakeUninstallCommand) { } } } + +TEST_F(InstallUtilTest, GetCurrentDate) { + std::wstring date(InstallUtil::GetCurrentDate()); + EXPECT_EQ(8, date.length()); + if (date.length() == 8) { + // For an invalid date value, SystemTimeToFileTime will fail. + // We use this to validate that we have a correct date string. + SYSTEMTIME systime = {0}; + FILETIME ft = {0}; + // Just to make sure our assumption holds. + EXPECT_FALSE(SystemTimeToFileTime(&systime, &ft)); + // Now fill in the values from our string. + systime.wYear = _wtoi(date.substr(0, 4).c_str()); + systime.wMonth = _wtoi(date.substr(4, 2).c_str()); + systime.wDay = _wtoi(date.substr(6, 2).c_str()); + // Check if they make sense. + EXPECT_TRUE(SystemTimeToFileTime(&systime, &ft)); + } +} |