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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/win/registry.h" 8 #include "base/win/registry.h"
9 #include "chrome/installer/util/browser_distribution.h" 9 #include "chrome/installer/util/browser_distribution.h"
10 #include "chrome/installer/util/installation_state.h" 10 #include "chrome/installer/util/installation_state.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 BrowserDistribution::CHROME_BROWSER, prefs); 70 BrowserDistribution::CHROME_BROWSER, prefs);
71 EXPECT_EQ(ERROR_SUCCESS, 71 EXPECT_EQ(ERROR_SUCCESS,
72 key.Open(root, distribution->GetStateKey().c_str(), KEY_READ)); 72 key.Open(root, distribution->GetStateKey().c_str(), KEY_READ));
73 EXPECT_EQ(ERROR_SUCCESS, 73 EXPECT_EQ(ERROR_SUCCESS,
74 key.ReadValue(installer::kInstallerSuccessLaunchCmdLine, &value)); 74 key.ReadValue(installer::kInstallerSuccessLaunchCmdLine, &value));
75 EXPECT_EQ(launch_cmd, value); 75 EXPECT_EQ(launch_cmd, value);
76 key.Close(); 76 key.Close();
77 } 77 }
78 TempRegKeyOverride::DeleteAllTempKeys(); 78 TempRegKeyOverride::DeleteAllTempKeys();
79 } 79 }
80
81 TEST_F(InstallUtilTest, GetCurrentDate) {
82 std::wstring date(InstallUtil::GetCurrentDate());
83 EXPECT_EQ(8, date.length());
84 if (date.length() == 8) {
85 // For an invalid date value, SystemTimeToFileTime will fail.
86 // We use this to validate that we have a correct date string.
87 SYSTEMTIME systime = {0};
88 FILETIME ft = {0};
89 // Just to make sure our assumption holds.
90 EXPECT_FALSE(SystemTimeToFileTime(&systime, &ft));
91 // Now fill in the values from our string.
92 systime.wYear = _wtoi(date.substr(0, 4).c_str());
93 systime.wMonth = _wtoi(date.substr(4, 2).c_str());
94 systime.wDay = _wtoi(date.substr(6, 2).c_str());
95 // Check if they make sense.
96 EXPECT_TRUE(SystemTimeToFileTime(&systime, &ft));
97 }
98 }
OLDNEW
« 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