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

Side by Side Diff: chrome/installer/util/install_util_unittest.cc

Issue 6533009: Switch from wcsftime to GetDateFormat to avoid crash in setup.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/win/registry.h" 9 #include "base/win/registry.h"
10 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 EXPECT_EQ(param.first, command_line.GetProgram().value()); 95 EXPECT_EQ(param.first, command_line.GetProgram().value());
96 if (param.second.empty()) { 96 if (param.second.empty()) {
97 EXPECT_EQ(0U, command_line.GetSwitchCount()); 97 EXPECT_EQ(0U, command_line.GetSwitchCount());
98 } else { 98 } else {
99 EXPECT_EQ(2U, command_line.GetSwitchCount()); 99 EXPECT_EQ(2U, command_line.GetSwitchCount());
100 EXPECT_TRUE(command_line.HasSwitch("do-something")); 100 EXPECT_TRUE(command_line.HasSwitch("do-something"));
101 EXPECT_TRUE(command_line.HasSwitch("silly")); 101 EXPECT_TRUE(command_line.HasSwitch("silly"));
102 } 102 }
103 } 103 }
104 } 104 }
105
106 TEST_F(InstallUtilTest, GetCurrentDate) {
107 std::wstring date(InstallUtil::GetCurrentDate());
108 EXPECT_EQ(8, date.length());
109 if (date.length() == 8) {
110 // For an invalid date value, SystemTimeToFileTime will fail.
111 // We use this to validate that we have a correct date string.
112 SYSTEMTIME systime = {0};
113 FILETIME ft = {0};
114 // Just to make sure our assumption holds.
115 EXPECT_FALSE(SystemTimeToFileTime(&systime, &ft));
116 // Now fill in the values from our string.
117 systime.wYear = _wtoi(date.substr(0, 4).c_str());
118 systime.wMonth = _wtoi(date.substr(4, 2).c_str());
119 systime.wDay = _wtoi(date.substr(6, 2).c_str());
120 // Check if they make sense.
121 EXPECT_TRUE(SystemTimeToFileTime(&systime, &ft));
122 }
123 }
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