OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/installer/util/shell_util.h" | 5 #include "chrome/installer/util/shell_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
12 #include "base/base_paths_win.h" | 13 #include "base/base_paths_win.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/files/file_enumerator.h" | 15 #include "base/files/file_enumerator.h" |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
17 #include "base/files/scoped_temp_dir.h" | 18 #include "base/files/scoped_temp_dir.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/md5.h" | 20 #include "base/md5.h" |
20 #include "base/memory/scoped_ptr.h" | |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/synchronization/cancellation_flag.h" | 23 #include "base/synchronization/cancellation_flag.h" |
24 #include "base/test/scoped_path_override.h" | 24 #include "base/test/scoped_path_override.h" |
25 #include "base/test/test_reg_util_win.h" | 25 #include "base/test/test_reg_util_win.h" |
26 #include "base/test/test_shortcut_win.h" | 26 #include "base/test/test_shortcut_win.h" |
27 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
28 #include "base/win/shortcut.h" | 28 #include "base/win/shortcut.h" |
29 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
30 #include "chrome/installer/util/browser_distribution.h" | 30 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 expected_properties.set_app_id(properties.app_id); | 183 expected_properties.set_app_id(properties.app_id); |
184 } else { | 184 } else { |
185 // Tests are always seen as user-level installs in ShellUtil. | 185 // Tests are always seen as user-level installs in ShellUtil. |
186 expected_properties.set_app_id(ShellUtil::GetBrowserModelId(dist, true)); | 186 expected_properties.set_app_id(ShellUtil::GetBrowserModelId(dist, true)); |
187 } | 187 } |
188 | 188 |
189 base::win::ValidateShortcut(expected_path, expected_properties); | 189 base::win::ValidateShortcut(expected_path, expected_properties); |
190 } | 190 } |
191 | 191 |
192 BrowserDistribution* dist_; | 192 BrowserDistribution* dist_; |
193 scoped_ptr<installer::Product> product_; | 193 std::unique_ptr<installer::Product> product_; |
194 | 194 |
195 // A ShellUtil::ShortcutProperties object with common properties set already. | 195 // A ShellUtil::ShortcutProperties object with common properties set already. |
196 ShellUtil::ShortcutProperties test_properties_; | 196 ShellUtil::ShortcutProperties test_properties_; |
197 | 197 |
198 base::ScopedTempDir temp_dir_; | 198 base::ScopedTempDir temp_dir_; |
199 base::ScopedTempDir fake_user_desktop_; | 199 base::ScopedTempDir fake_user_desktop_; |
200 base::ScopedTempDir fake_common_desktop_; | 200 base::ScopedTempDir fake_common_desktop_; |
201 base::ScopedTempDir fake_user_quick_launch_; | 201 base::ScopedTempDir fake_user_quick_launch_; |
202 base::ScopedTempDir fake_default_user_quick_launch_; | 202 base::ScopedTempDir fake_default_user_quick_launch_; |
203 base::ScopedTempDir fake_start_menu_; | 203 base::ScopedTempDir fake_start_menu_; |
204 base::ScopedTempDir fake_common_start_menu_; | 204 base::ScopedTempDir fake_common_start_menu_; |
205 scoped_ptr<base::ScopedPathOverride> user_desktop_override_; | 205 std::unique_ptr<base::ScopedPathOverride> user_desktop_override_; |
206 scoped_ptr<base::ScopedPathOverride> common_desktop_override_; | 206 std::unique_ptr<base::ScopedPathOverride> common_desktop_override_; |
207 scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; | 207 std::unique_ptr<base::ScopedPathOverride> user_quick_launch_override_; |
208 scoped_ptr<base::ScopedPathOverride> start_menu_override_; | 208 std::unique_ptr<base::ScopedPathOverride> start_menu_override_; |
209 scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; | 209 std::unique_ptr<base::ScopedPathOverride> common_start_menu_override_; |
210 | 210 |
211 base::FilePath chrome_exe_; | 211 base::FilePath chrome_exe_; |
212 base::FilePath manganese_exe_; | 212 base::FilePath manganese_exe_; |
213 base::FilePath iron_exe_; | 213 base::FilePath iron_exe_; |
214 base::FilePath other_ico_; | 214 base::FilePath other_ico_; |
215 }; | 215 }; |
216 | 216 |
217 } // namespace | 217 } // namespace |
218 | 218 |
219 TEST_F(ShellUtilShortcutTest, GetShortcutPath) { | 219 TEST_F(ShellUtilShortcutTest, GetShortcutPath) { |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1019 |
1020 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 1020 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
1021 L"MZXW6YTB", L"MZXW6YTBOI"}; | 1021 L"MZXW6YTB", L"MZXW6YTBOI"}; |
1022 | 1022 |
1023 // Run the tests, with one more letter in the input every pass. | 1023 // Run the tests, with one more letter in the input every pass. |
1024 for (size_t i = 0; i < arraysize(expected); ++i) { | 1024 for (size_t i = 0; i < arraysize(expected); ++i) { |
1025 ASSERT_EQ(expected[i], | 1025 ASSERT_EQ(expected[i], |
1026 ShellUtil::ByteArrayToBase32(test_array, i)); | 1026 ShellUtil::ByteArrayToBase32(test_array, i)); |
1027 } | 1027 } |
1028 } | 1028 } |
OLD | NEW |