OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |