| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/base_paths_win.h" | 10 #include "base/base_paths_win.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const ShellUtil::ShortcutProperties& properties) { | 110 const ShellUtil::ShortcutProperties& properties) { |
| 111 base::FilePath expected_path; | 111 base::FilePath expected_path; |
| 112 switch (location) { | 112 switch (location) { |
| 113 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: | 113 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: |
| 114 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? | 114 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? |
| 115 fake_user_desktop_.path() : fake_common_desktop_.path(); | 115 fake_user_desktop_.path() : fake_common_desktop_.path(); |
| 116 break; | 116 break; |
| 117 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: | 117 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: |
| 118 expected_path = fake_user_quick_launch_.path(); | 118 expected_path = fake_user_quick_launch_.path(); |
| 119 break; | 119 break; |
| 120 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: | 120 case ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT: |
| 121 expected_path = (properties.level == ShellUtil::CURRENT_USER) |
| 122 ? fake_start_menu_.path() |
| 123 : fake_common_start_menu_.path(); |
| 124 break; |
| 125 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: |
| 121 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? | 126 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? |
| 122 fake_start_menu_.path() : fake_common_start_menu_.path(); | 127 fake_start_menu_.path() : fake_common_start_menu_.path(); |
| 123 expected_path = expected_path.Append( | 128 expected_path = expected_path.Append( |
| 124 dist_->GetStartMenuShortcutSubfolder( | 129 dist_->GetStartMenuShortcutSubfolder( |
| 125 BrowserDistribution::SUBFOLDER_CHROME)); | 130 BrowserDistribution::SUBFOLDER_CHROME)); |
| 126 break; | 131 break; |
| 127 default: | 132 default: |
| 128 ADD_FAILURE() << "Unknown location"; | 133 ADD_FAILURE() << "Unknown location"; |
| 129 return base::FilePath(); | 134 return base::FilePath(); |
| 130 } | 135 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 ShellUtil::SYSTEM_LEVEL, &path); | 231 ShellUtil::SYSTEM_LEVEL, &path); |
| 227 EXPECT_EQ(fake_common_desktop_.path(), path); | 232 EXPECT_EQ(fake_common_desktop_.path(), path); |
| 228 | 233 |
| 229 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, | 234 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, |
| 230 ShellUtil::CURRENT_USER, &path); | 235 ShellUtil::CURRENT_USER, &path); |
| 231 EXPECT_EQ(fake_user_quick_launch_.path(), path); | 236 EXPECT_EQ(fake_user_quick_launch_.path(), path); |
| 232 | 237 |
| 233 base::string16 start_menu_subfolder = | 238 base::string16 start_menu_subfolder = |
| 234 dist_->GetStartMenuShortcutSubfolder( | 239 dist_->GetStartMenuShortcutSubfolder( |
| 235 BrowserDistribution::SUBFOLDER_CHROME); | 240 BrowserDistribution::SUBFOLDER_CHROME); |
| 236 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 241 ShellUtil::GetShortcutPath( |
| 237 dist_, ShellUtil::CURRENT_USER, &path); | 242 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 243 ShellUtil::CURRENT_USER, &path); |
| 238 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), | 244 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), |
| 239 path); | 245 path); |
| 240 | 246 |
| 241 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 247 ShellUtil::GetShortcutPath( |
| 242 dist_, ShellUtil::SYSTEM_LEVEL, &path); | 248 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 249 ShellUtil::SYSTEM_LEVEL, &path); |
| 243 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), | 250 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), |
| 244 path); | 251 path); |
| 245 } | 252 } |
| 246 | 253 |
| 254 TEST_F(ShellUtilShortcutTest, MoveExistingShortcut) { |
| 255 test_properties_.set_shortcut_name(L"Bobo le shortcut"); |
| 256 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 257 base::FilePath old_shortcut_path(GetExpectedShortcutPath( |
| 258 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 259 test_properties_)); |
| 260 |
| 261 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 262 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 263 test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 264 ValidateChromeShortcut( |
| 265 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 266 test_properties_); |
| 267 ASSERT_TRUE(base::PathExists(old_shortcut_path.DirName())); |
| 268 ASSERT_TRUE(base::PathExists(old_shortcut_path)); |
| 269 |
| 270 ASSERT_TRUE(ShellUtil::MoveExistingShortcut( |
| 271 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, |
| 272 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist_, test_properties_)); |
| 273 |
| 274 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist_, |
| 275 test_properties_); |
| 276 ASSERT_FALSE(base::PathExists(old_shortcut_path)); |
| 277 ASSERT_FALSE(base::PathExists(old_shortcut_path.DirName())); |
| 278 } |
| 279 |
| 247 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) { | 280 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) { |
| 248 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | 281 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 249 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); | 282 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); |
| 250 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 283 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 251 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, | 284 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, |
| 252 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 285 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 253 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 286 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 254 properties); | 287 properties); |
| 255 } | 288 } |
| 256 | 289 |
| 257 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { | 290 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { |
| 258 test_properties_.set_shortcut_name(L"Bobo le shortcut"); | 291 test_properties_.set_shortcut_name(L"Bobo le shortcut"); |
| 259 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 292 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 260 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 293 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 261 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 294 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 262 dist_, test_properties_, | 295 test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 263 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 296 ValidateChromeShortcut( |
| 264 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 297 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 265 dist_, test_properties_); | 298 test_properties_); |
| 266 } | 299 } |
| 267 | 300 |
| 268 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelDesktopShortcut) { | 301 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelDesktopShortcut) { |
| 269 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 302 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 270 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 303 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 271 ShellUtil::SHORTCUT_LOCATION_DESKTOP, | 304 ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
| 272 dist_, test_properties_, | 305 dist_, test_properties_, |
| 273 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 306 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 274 | 307 |
| 275 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); | 308 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 expected_properties.set_arguments(updated_properties.arguments); | 344 expected_properties.set_arguments(updated_properties.arguments); |
| 312 | 345 |
| 313 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, | 346 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, |
| 314 expected_properties); | 347 expected_properties); |
| 315 } | 348 } |
| 316 | 349 |
| 317 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { | 350 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { |
| 318 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | 351 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 319 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); | 352 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); |
| 320 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 353 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 321 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, | 354 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 322 properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 355 properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 323 | 356 |
| 324 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); | 357 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); |
| 325 added_properties.set_dual_mode(true); | 358 added_properties.set_dual_mode(true); |
| 326 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 359 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 327 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, | 360 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 328 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); | 361 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); |
| 329 | 362 |
| 330 ShellUtil::ShortcutProperties expected_properties(properties); | 363 ShellUtil::ShortcutProperties expected_properties(properties); |
| 331 expected_properties.set_dual_mode(true); | 364 expected_properties.set_dual_mode(true); |
| 332 | 365 |
| 333 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 366 ValidateChromeShortcut( |
| 334 dist_, expected_properties); | 367 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 368 expected_properties); |
| 335 } | 369 } |
| 336 | 370 |
| 337 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { | 371 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { |
| 338 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 372 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 339 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 373 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| 340 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 374 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 341 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 375 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 342 test_properties_); | 376 test_properties_); |
| 343 } | 377 } |
| 344 | 378 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 357 test_properties_.level = ShellUtil::CURRENT_USER; | 391 test_properties_.level = ShellUtil::CURRENT_USER; |
| 358 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 392 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 359 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 393 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| 360 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 394 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 361 ASSERT_FALSE(base::PathExists( | 395 ASSERT_FALSE(base::PathExists( |
| 362 fake_user_desktop_.path().Append(shortcut_name))); | 396 fake_user_desktop_.path().Append(shortcut_name))); |
| 363 } | 397 } |
| 364 | 398 |
| 365 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { | 399 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { |
| 366 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 400 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 367 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 401 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 368 dist_, test_properties_, | 402 test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 369 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 403 ValidateChromeShortcut( |
| 370 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 404 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 371 dist_, test_properties_); | 405 test_properties_); |
| 372 } | 406 } |
| 373 | 407 |
| 374 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { | 408 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { |
| 375 base::string16 shortcut_name( | 409 base::string16 shortcut_name( |
| 376 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + | 410 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + |
| 377 installer::kLnkExt); | 411 installer::kLnkExt); |
| 378 | 412 |
| 379 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 413 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 380 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 414 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 381 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 415 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 expected_properties3.set_arguments(base::string16()); | 727 expected_properties3.set_arguments(base::string16()); |
| 694 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 728 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 695 expected_properties3); | 729 expected_properties3); |
| 696 expected_properties4.set_arguments(L"--show-app-list"); | 730 expected_properties4.set_arguments(L"--show-app-list"); |
| 697 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 731 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 698 expected_properties4); | 732 expected_properties4); |
| 699 } | 733 } |
| 700 | 734 |
| 701 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { | 735 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { |
| 702 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 736 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 703 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 737 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 704 dist_, test_properties_, | 738 test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 705 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 706 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 739 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 707 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | 740 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, |
| 708 dist_, test_properties_, | 741 dist_, test_properties_, |
| 709 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 742 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 710 test_properties_.set_shortcut_name(L"A second shortcut"); | 743 test_properties_.set_shortcut_name(L"A second shortcut"); |
| 711 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 744 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 712 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 745 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 713 dist_, test_properties_, | 746 test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 714 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 715 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 747 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 716 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | 748 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, |
| 717 dist_, test_properties_, | 749 dist_, test_properties_, |
| 718 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 750 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 719 | 751 |
| 720 base::FilePath chrome_shortcut_folder( | 752 base::FilePath chrome_shortcut_folder( |
| 721 fake_start_menu_.path().Append( | 753 fake_start_menu_.path().Append( |
| 722 dist_->GetStartMenuShortcutSubfolder( | 754 dist_->GetStartMenuShortcutSubfolder( |
| 723 BrowserDistribution::SUBFOLDER_CHROME))); | 755 BrowserDistribution::SUBFOLDER_CHROME))); |
| 724 base::FilePath chrome_apps_shortcut_folder( | 756 base::FilePath chrome_apps_shortcut_folder( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 736 base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder, | 768 base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder, |
| 737 false, | 769 false, |
| 738 base::FileEnumerator::FILES); | 770 base::FileEnumerator::FILES); |
| 739 count = 0; | 771 count = 0; |
| 740 while (!chrome_apps_file_counter.Next().empty()) | 772 while (!chrome_apps_file_counter.Next().empty()) |
| 741 ++count; | 773 ++count; |
| 742 EXPECT_EQ(2, count); | 774 EXPECT_EQ(2, count); |
| 743 | 775 |
| 744 ASSERT_TRUE(base::PathExists(chrome_shortcut_folder)); | 776 ASSERT_TRUE(base::PathExists(chrome_shortcut_folder)); |
| 745 ASSERT_TRUE(ShellUtil::RemoveShortcuts( | 777 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 746 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, | 778 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, |
| 747 ShellUtil::CURRENT_USER, chrome_exe_)); | 779 ShellUtil::CURRENT_USER, chrome_exe_)); |
| 748 ASSERT_FALSE(base::PathExists(chrome_shortcut_folder)); | 780 ASSERT_FALSE(base::PathExists(chrome_shortcut_folder)); |
| 749 | 781 |
| 750 ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder)); | 782 ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder)); |
| 751 ASSERT_TRUE(ShellUtil::RemoveShortcuts( | 783 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 752 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, dist_, | 784 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, dist_, |
| 753 ShellUtil::CURRENT_USER, chrome_exe_)); | 785 ShellUtil::CURRENT_USER, chrome_exe_)); |
| 754 ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder)); | 786 ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder)); |
| 755 } | 787 } |
| 756 | 788 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1035 |
| 1004 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 1036 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
| 1005 L"MZXW6YTB", L"MZXW6YTBOI"}; | 1037 L"MZXW6YTB", L"MZXW6YTBOI"}; |
| 1006 | 1038 |
| 1007 // Run the tests, with one more letter in the input every pass. | 1039 // Run the tests, with one more letter in the input every pass. |
| 1008 for (int i = 0; i < arraysize(expected); ++i) { | 1040 for (int i = 0; i < arraysize(expected); ++i) { |
| 1009 ASSERT_EQ(expected[i], | 1041 ASSERT_EQ(expected[i], |
| 1010 ShellUtil::ByteArrayToBase32(test_array, i)); | 1042 ShellUtil::ByteArrayToBase32(test_array, i)); |
| 1011 } | 1043 } |
| 1012 } | 1044 } |
| OLD | NEW |