| 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_ROOT: | 120 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
| 121 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? | |
| 122 fake_start_menu_.path() : fake_common_start_menu_.path(); | |
| 123 break; | |
| 124 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: | |
| 125 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? | 121 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? |
| 126 fake_start_menu_.path() : fake_common_start_menu_.path(); | 122 fake_start_menu_.path() : fake_common_start_menu_.path(); |
| 127 expected_path = expected_path.Append( | 123 expected_path = expected_path.Append( |
| 128 dist_->GetStartMenuShortcutSubfolder( | 124 dist_->GetStartMenuShortcutSubfolder( |
| 129 BrowserDistribution::SUBFOLDER_CHROME)); | 125 BrowserDistribution::SUBFOLDER_CHROME)); |
| 130 break; | 126 break; |
| 131 default: | 127 default: |
| 132 ADD_FAILURE() << "Unknown location"; | 128 ADD_FAILURE() << "Unknown location"; |
| 133 return base::FilePath(); | 129 return base::FilePath(); |
| 134 } | 130 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ShellUtil::SYSTEM_LEVEL, &path); | 226 ShellUtil::SYSTEM_LEVEL, &path); |
| 231 EXPECT_EQ(fake_common_desktop_.path(), path); | 227 EXPECT_EQ(fake_common_desktop_.path(), path); |
| 232 | 228 |
| 233 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, | 229 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, |
| 234 ShellUtil::CURRENT_USER, &path); | 230 ShellUtil::CURRENT_USER, &path); |
| 235 EXPECT_EQ(fake_user_quick_launch_.path(), path); | 231 EXPECT_EQ(fake_user_quick_launch_.path(), path); |
| 236 | 232 |
| 237 base::string16 start_menu_subfolder = | 233 base::string16 start_menu_subfolder = |
| 238 dist_->GetStartMenuShortcutSubfolder( | 234 dist_->GetStartMenuShortcutSubfolder( |
| 239 BrowserDistribution::SUBFOLDER_CHROME); | 235 BrowserDistribution::SUBFOLDER_CHROME); |
| 240 ShellUtil::GetShortcutPath( | 236 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 241 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 237 dist_, ShellUtil::CURRENT_USER, &path); |
| 242 dist_, ShellUtil::CURRENT_USER, &path); | |
| 243 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), | 238 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), |
| 244 path); | 239 path); |
| 245 | 240 |
| 246 ShellUtil::GetShortcutPath( | 241 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 247 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 242 dist_, ShellUtil::SYSTEM_LEVEL, &path); |
| 248 dist_, ShellUtil::SYSTEM_LEVEL, &path); | |
| 249 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), | 243 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), |
| 250 path); | 244 path); |
| 251 } | 245 } |
| 252 | 246 |
| 253 TEST_F(ShellUtilShortcutTest, MoveExistingShortcut) { | |
| 254 test_properties_.set_shortcut_name(L"Bobo le shortcut"); | |
| 255 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | |
| 256 base::FilePath old_shortcut_path(GetExpectedShortcutPath( | |
| 257 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
| 258 dist_, test_properties_)); | |
| 259 | |
| 260 ASSERT_TRUE( | |
| 261 ShellUtil::CreateOrUpdateShortcut( | |
| 262 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
| 263 dist_, test_properties_, | |
| 264 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 265 ValidateChromeShortcut( | |
| 266 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
| 267 dist_, test_properties_); | |
| 268 ASSERT_TRUE(base::PathExists(old_shortcut_path.DirName())); | |
| 269 ASSERT_TRUE(base::PathExists(old_shortcut_path)); | |
| 270 | |
| 271 ASSERT_TRUE( | |
| 272 ShellUtil::MoveExistingShortcut( | |
| 273 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
| 274 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, | |
| 275 dist_, test_properties_)); | |
| 276 | |
| 277 ValidateChromeShortcut( | |
| 278 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, | |
| 279 dist_, test_properties_); | |
| 280 ASSERT_FALSE(base::PathExists(old_shortcut_path)); | |
| 281 ASSERT_FALSE(base::PathExists(old_shortcut_path.DirName())); | |
| 282 } | |
| 283 | |
| 284 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) { | 247 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) { |
| 285 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | 248 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 286 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); | 249 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); |
| 287 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 250 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 288 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, | 251 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, |
| 289 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 252 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 290 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 253 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 291 properties); | 254 properties); |
| 292 } | 255 } |
| 293 | 256 |
| 294 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { | 257 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { |
| 295 test_properties_.set_shortcut_name(L"Bobo le shortcut"); | 258 test_properties_.set_shortcut_name(L"Bobo le shortcut"); |
| 296 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 259 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 297 ASSERT_TRUE( | 260 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 298 ShellUtil::CreateOrUpdateShortcut( | 261 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 299 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 262 dist_, test_properties_, |
| 300 dist_, test_properties_, | 263 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 301 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 264 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 302 ValidateChromeShortcut( | 265 dist_, test_properties_); |
| 303 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
| 304 dist_, test_properties_); | |
| 305 } | 266 } |
| 306 | 267 |
| 307 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelDesktopShortcut) { | 268 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelDesktopShortcut) { |
| 308 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 269 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 309 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 270 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 310 ShellUtil::SHORTCUT_LOCATION_DESKTOP, | 271 ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
| 311 dist_, test_properties_, | 272 dist_, test_properties_, |
| 312 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 273 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 313 | 274 |
| 314 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); | 275 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 ShellUtil::ShortcutProperties expected_properties(test_properties_); | 310 ShellUtil::ShortcutProperties expected_properties(test_properties_); |
| 350 expected_properties.set_arguments(updated_properties.arguments); | 311 expected_properties.set_arguments(updated_properties.arguments); |
| 351 | 312 |
| 352 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, | 313 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, |
| 353 expected_properties); | 314 expected_properties); |
| 354 } | 315 } |
| 355 | 316 |
| 356 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { | 317 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { |
| 357 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | 318 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 358 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); | 319 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); |
| 359 ASSERT_TRUE( | 320 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 360 ShellUtil::CreateOrUpdateShortcut( | 321 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, |
| 361 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, | 322 properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 362 properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 363 | 323 |
| 364 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); | 324 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); |
| 365 added_properties.set_dual_mode(true); | 325 added_properties.set_dual_mode(true); |
| 366 ASSERT_TRUE( | 326 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 367 ShellUtil::CreateOrUpdateShortcut( | 327 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, |
| 368 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, | 328 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); |
| 369 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); | |
| 370 | 329 |
| 371 ShellUtil::ShortcutProperties expected_properties(properties); | 330 ShellUtil::ShortcutProperties expected_properties(properties); |
| 372 expected_properties.set_dual_mode(true); | 331 expected_properties.set_dual_mode(true); |
| 373 | 332 |
| 374 ValidateChromeShortcut( | 333 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 375 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 334 dist_, expected_properties); |
| 376 dist_, expected_properties); | |
| 377 } | 335 } |
| 378 | 336 |
| 379 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { | 337 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { |
| 380 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 338 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 381 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 339 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| 382 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 340 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 383 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 341 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 384 test_properties_); | 342 test_properties_); |
| 385 } | 343 } |
| 386 | 344 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 399 test_properties_.level = ShellUtil::CURRENT_USER; | 357 test_properties_.level = ShellUtil::CURRENT_USER; |
| 400 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 358 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 401 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 359 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| 402 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 360 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 403 ASSERT_FALSE(base::PathExists( | 361 ASSERT_FALSE(base::PathExists( |
| 404 fake_user_desktop_.path().Append(shortcut_name))); | 362 fake_user_desktop_.path().Append(shortcut_name))); |
| 405 } | 363 } |
| 406 | 364 |
| 407 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { | 365 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { |
| 408 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 366 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 409 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 367 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 410 dist_, test_properties_, | 368 dist_, test_properties_, |
| 411 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); | 369 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); |
| 412 ValidateChromeShortcut( | 370 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 413 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 371 dist_, test_properties_); |
| 414 dist_, test_properties_); | |
| 415 } | 372 } |
| 416 | 373 |
| 417 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { | 374 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { |
| 418 base::string16 shortcut_name( | 375 base::string16 shortcut_name( |
| 419 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + | 376 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + |
| 420 installer::kLnkExt); | 377 installer::kLnkExt); |
| 421 | 378 |
| 422 test_properties_.level = ShellUtil::SYSTEM_LEVEL; | 379 test_properties_.level = ShellUtil::SYSTEM_LEVEL; |
| 423 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 380 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 424 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, | 381 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 expected_properties3.set_arguments(base::string16()); | 693 expected_properties3.set_arguments(base::string16()); |
| 737 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 694 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 738 expected_properties3); | 695 expected_properties3); |
| 739 expected_properties4.set_arguments(L"--show-app-list"); | 696 expected_properties4.set_arguments(L"--show-app-list"); |
| 740 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 697 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 741 expected_properties4); | 698 expected_properties4); |
| 742 } | 699 } |
| 743 | 700 |
| 744 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { | 701 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { |
| 745 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 702 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 746 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 703 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 747 dist_, test_properties_, | 704 dist_, test_properties_, |
| 748 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 705 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 749 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 706 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 750 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | 707 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, |
| 751 dist_, test_properties_, | 708 dist_, test_properties_, |
| 752 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 709 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 753 test_properties_.set_shortcut_name(L"A second shortcut"); | 710 test_properties_.set_shortcut_name(L"A second shortcut"); |
| 754 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 711 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 755 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | 712 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
| 756 dist_, test_properties_, | 713 dist_, test_properties_, |
| 757 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 714 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 758 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 715 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 759 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | 716 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, |
| 760 dist_, test_properties_, | 717 dist_, test_properties_, |
| 761 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 718 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 762 | 719 |
| 763 base::FilePath chrome_shortcut_folder( | 720 base::FilePath chrome_shortcut_folder( |
| 764 fake_start_menu_.path().Append( | 721 fake_start_menu_.path().Append( |
| 765 dist_->GetStartMenuShortcutSubfolder( | 722 dist_->GetStartMenuShortcutSubfolder( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 779 base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder, | 736 base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder, |
| 780 false, | 737 false, |
| 781 base::FileEnumerator::FILES); | 738 base::FileEnumerator::FILES); |
| 782 count = 0; | 739 count = 0; |
| 783 while (!chrome_apps_file_counter.Next().empty()) | 740 while (!chrome_apps_file_counter.Next().empty()) |
| 784 ++count; | 741 ++count; |
| 785 EXPECT_EQ(2, count); | 742 EXPECT_EQ(2, count); |
| 786 | 743 |
| 787 ASSERT_TRUE(base::PathExists(chrome_shortcut_folder)); | 744 ASSERT_TRUE(base::PathExists(chrome_shortcut_folder)); |
| 788 ASSERT_TRUE(ShellUtil::RemoveShortcuts( | 745 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 789 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist_, | 746 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_, |
| 790 ShellUtil::CURRENT_USER, chrome_exe_)); | 747 ShellUtil::CURRENT_USER, chrome_exe_)); |
| 791 ASSERT_FALSE(base::PathExists(chrome_shortcut_folder)); | 748 ASSERT_FALSE(base::PathExists(chrome_shortcut_folder)); |
| 792 | 749 |
| 793 ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder)); | 750 ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder)); |
| 794 ASSERT_TRUE(ShellUtil::RemoveShortcuts( | 751 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 795 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, dist_, | 752 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, dist_, |
| 796 ShellUtil::CURRENT_USER, chrome_exe_)); | 753 ShellUtil::CURRENT_USER, chrome_exe_)); |
| 797 ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder)); | 754 ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder)); |
| 798 } | 755 } |
| 799 | 756 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 | 1003 |
| 1047 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 1004 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
| 1048 L"MZXW6YTB", L"MZXW6YTBOI"}; | 1005 L"MZXW6YTB", L"MZXW6YTBOI"}; |
| 1049 | 1006 |
| 1050 // Run the tests, with one more letter in the input every pass. | 1007 // Run the tests, with one more letter in the input every pass. |
| 1051 for (int i = 0; i < arraysize(expected); ++i) { | 1008 for (int i = 0; i < arraysize(expected); ++i) { |
| 1052 ASSERT_EQ(expected[i], | 1009 ASSERT_EQ(expected[i], |
| 1053 ShellUtil::ByteArrayToBase32(test_array, i)); | 1010 ShellUtil::ByteArrayToBase32(test_array, i)); |
| 1054 } | 1011 } |
| 1055 } | 1012 } |
| OLD | NEW |