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