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

Unified Diff: chrome/installer/util/install_util_unittest.cc

Issue 6532037: Merge 75305 - Switch from wcsftime to GetDateFormat to avoid crash in setup.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/648/src/
Patch Set: Created 9 years, 10 months 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
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util_unittest.cc
===================================================================
--- chrome/installer/util/install_util_unittest.cc (revision 75311)
+++ chrome/installer/util/install_util_unittest.cc (working copy)
@@ -77,3 +77,22 @@
}
TempRegKeyOverride::DeleteAllTempKeys();
}
+
+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));
+ }
+}
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698