OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <windows.h> | 5 #include <windows.h> |
6 #include <shellapi.h> | 6 #include <shellapi.h> |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 | 8 |
9 #include <fstream> | 9 #include <fstream> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const std::wstring description(L"dummy description"); | 123 const std::wstring description(L"dummy description"); |
124 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), | 124 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), |
125 shortcut_path.value(), | 125 shortcut_path.value(), |
126 description, true)); | 126 description, true)); |
127 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), | 127 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), |
128 shortcut_path.value(), | 128 shortcut_path.value(), |
129 description, 0)); | 129 description, 0)); |
130 | 130 |
131 // Now specify an icon index in master prefs and make sure it works. | 131 // Now specify an icon index in master prefs and make sure it works. |
132 FilePath prefs_path = test_dir_.AppendASCII( | 132 FilePath prefs_path = test_dir_.AppendASCII( |
133 installer::kDefaultMasterPrefs); | 133 installer_util::kDefaultMasterPrefs); |
134 std::ofstream file; | 134 std::ofstream file; |
135 file.open(prefs_path.value().c_str()); | 135 file.open(prefs_path.value().c_str()); |
136 ASSERT_TRUE(file.is_open()); | 136 ASSERT_TRUE(file.is_open()); |
137 file << | 137 file << |
138 "{" | 138 "{" |
139 " \"distribution\":{" | 139 " \"distribution\":{" |
140 " \"chrome_shortcut_icon_index\" : 1" | 140 " \"chrome_shortcut_icon_index\" : 1" |
141 " }" | 141 " }" |
142 "}"; | 142 "}"; |
143 file.close(); | 143 file.close(); |
144 ASSERT_TRUE(file_util::Delete(shortcut_path, false)); | 144 ASSERT_TRUE(file_util::Delete(shortcut_path, false)); |
145 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), | 145 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), |
146 shortcut_path.value(), | 146 shortcut_path.value(), |
147 description, true)); | 147 description, true)); |
148 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), | 148 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), |
149 shortcut_path.value(), | 149 shortcut_path.value(), |
150 description, 1)); | 150 description, 1)); |
151 | 151 |
152 // Now change only description to update shortcut and make sure icon index | 152 // Now change only description to update shortcut and make sure icon index |
153 // doesn't change. | 153 // doesn't change. |
154 const std::wstring description2(L"dummy description 2"); | 154 const std::wstring description2(L"dummy description 2"); |
155 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), | 155 EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(), |
156 shortcut_path.value(), | 156 shortcut_path.value(), |
157 description2, false)); | 157 description2, false)); |
158 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), | 158 EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(), |
159 shortcut_path.value(), | 159 shortcut_path.value(), |
160 description2, 1)); | 160 description2, 1)); |
161 } | 161 } |
OLD | NEW |