Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 test_properties_.reset( | 70 test_properties_.reset( |
| 71 new ShellUtil::ShortcutProperties(ShellUtil::CURRENT_USER)); | 71 new ShellUtil::ShortcutProperties(ShellUtil::CURRENT_USER)); |
| 72 test_properties_->set_target(chrome_exe_); | 72 test_properties_->set_target(chrome_exe_); |
| 73 test_properties_->set_arguments(L"--test --chrome"); | 73 test_properties_->set_arguments(L"--test --chrome"); |
| 74 test_properties_->set_description(L"Makes polar bears dance."); | 74 test_properties_->set_description(L"Makes polar bears dance."); |
| 75 test_properties_->set_icon(icon_path, 0); | 75 test_properties_->set_icon(icon_path, 0); |
| 76 test_properties_->set_app_id(L"Polar.Bear"); | 76 test_properties_->set_app_id(L"Polar.Bear"); |
| 77 test_properties_->set_dual_mode(true); | 77 test_properties_->set_dual_mode(true); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Creates a shortcut in |temp_dir| using |test_properties_|. The shortcut | |
|
gab
2013/05/02 21:23:59
This is not actually true, your method always crea
huangs
2013/05/02 21:59:35
Moot; undoing change.
| |
| 81 // name is specified by |name|, or obtained from |dist_| if |name| is empty. | |
| 82 base::FilePath CreateTestShortcutHelper( | |
|
gab
2013/05/02 21:23:59
I feel this method makes the tests slightly less r
huangs
2013/05/02 21:59:35
Done.
| |
| 83 const base::ScopedTempDir& temp_dir, | |
| 84 const string16& name) { | |
| 85 bool res = ShellUtil::CreateOrUpdateShortcut( | |
|
gab
2013/05/02 21:23:59
s/res/result
huangs
2013/05/02 21:59:35
Okay, do so in the future.
| |
| 86 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 87 *test_properties_, | |
| 88 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); | |
| 89 DCHECK(res); | |
| 90 string16 shortcut_name(!name.empty() ? name : | |
| 91 dist_->GetAppShortCutName() + installer::kLnkExt); | |
| 92 base::FilePath shortcut_path(temp_dir.path().Append(shortcut_name)); | |
| 93 DCHECK(file_util::PathExists(shortcut_path)); | |
| 94 return shortcut_path; | |
| 95 } | |
| 96 | |
| 80 // Validates that the shortcut at |location| matches |properties| (and | 97 // Validates that the shortcut at |location| matches |properties| (and |
| 81 // implicit default properties) for |dist|. | 98 // implicit default properties) for |dist|. |
| 82 // Note: This method doesn't verify the |pin_to_taskbar| property as it | 99 // Note: This method doesn't verify the |pin_to_taskbar| property as it |
| 83 // implies real (non-mocked) state which is flaky to test. | 100 // implies real (non-mocked) state which is flaky to test. |
| 84 void ValidateChromeShortcut( | 101 void ValidateChromeShortcut( |
| 85 ShellUtil::ShortcutLocation location, | 102 ShellUtil::ShortcutLocation location, |
| 86 BrowserDistribution* dist, | 103 BrowserDistribution* dist, |
| 87 const ShellUtil::ShortcutProperties& properties) { | 104 const ShellUtil::ShortcutProperties& properties) { |
| 88 base::FilePath expected_path; | 105 base::FilePath expected_path; |
| 89 switch (location) { | 106 switch (location) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 test_properties_->level = ShellUtil::CURRENT_USER; | 357 test_properties_->level = ShellUtil::CURRENT_USER; |
| 341 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 358 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 342 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 359 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 343 *test_properties_, | 360 *test_properties_, |
| 344 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 361 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 345 ASSERT_TRUE(file_util::PathExists( | 362 ASSERT_TRUE(file_util::PathExists( |
| 346 fake_user_desktop_.path().Append(shortcut_name))); | 363 fake_user_desktop_.path().Append(shortcut_name))); |
| 347 } | 364 } |
| 348 | 365 |
| 349 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { | 366 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { |
| 350 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 367 base::FilePath shortcut_path( |
| 351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 368 CreateTestShortcutHelper(fake_user_desktop_, L"")); |
| 352 *test_properties_, | |
| 353 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 354 | 369 |
| 355 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 370 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 356 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | 371 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 357 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 372 chrome_exe_)); |
| 358 | |
| 359 ASSERT_TRUE(ShellUtil::RemoveShortcut( | |
| 360 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | |
| 361 ShellUtil::CURRENT_USER, NULL)); | |
| 362 ASSERT_FALSE(file_util::PathExists(shortcut_path)); | 373 ASSERT_FALSE(file_util::PathExists(shortcut_path)); |
| 363 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 374 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 364 } | 375 } |
| 365 | 376 |
| 366 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { | 377 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { |
| 367 test_properties_->level = ShellUtil::SYSTEM_LEVEL; | 378 test_properties_->level = ShellUtil::SYSTEM_LEVEL; |
| 368 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 379 base::FilePath shortcut_path( |
| 369 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 380 CreateTestShortcutHelper(fake_common_desktop_, L"")); |
| 370 *test_properties_, | |
| 371 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 372 | 381 |
| 373 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 382 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 374 base::FilePath shortcut_path( | 383 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, |
| 375 fake_common_desktop_.path().Append(shortcut_name)); | 384 chrome_exe_)); |
| 376 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | |
| 377 | |
| 378 ASSERT_TRUE(ShellUtil::RemoveShortcut( | |
| 379 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | |
| 380 ShellUtil::SYSTEM_LEVEL, NULL)); | |
| 381 ASSERT_FALSE(file_util::PathExists(shortcut_path)); | 385 ASSERT_FALSE(file_util::PathExists(shortcut_path)); |
| 382 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 386 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 383 } | 387 } |
| 384 | |
| 385 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcutWithSpecialName) { | |
| 386 static const wchar_t kSpecialName[] = L"I'm special"; | |
| 387 test_properties_->set_shortcut_name(kSpecialName); | |
| 388 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 389 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 390 *test_properties_, | |
| 391 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 392 | |
| 393 string16 shortcut_name(string16(kSpecialName).append(installer::kLnkExt)); | |
| 394 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | |
| 395 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | |
| 396 | |
| 397 ASSERT_TRUE(ShellUtil::RemoveShortcut( | |
| 398 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | |
| 399 ShellUtil::CURRENT_USER, &string16(kSpecialName))); | |
| 400 ASSERT_FALSE(file_util::PathExists(shortcut_path)); | |
| 401 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | |
| 402 } | |
| 403 | 388 |
| 404 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { | 389 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { |
| 405 const wchar_t kShortcutName1[] = L"Chrome 1"; | 390 const wchar_t kShortcutName1[] = L"Chrome 1"; |
| 406 const wchar_t kShortcutName2[] = L"Chrome 2"; | 391 const wchar_t kShortcutName2[] = L"Chrome 2"; |
| 407 | 392 |
| 408 test_properties_->set_shortcut_name(kShortcutName1); | 393 test_properties_->set_shortcut_name(kShortcutName1); |
| 409 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 410 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 411 *test_properties_, | |
| 412 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 413 string16 shortcut1_name( | |
| 414 string16(kShortcutName1).append(installer::kLnkExt)); | |
| 415 base::FilePath shortcut1_path( | 394 base::FilePath shortcut1_path( |
| 416 fake_user_desktop_.path().Append(shortcut1_name)); | 395 CreateTestShortcutHelper(fake_user_desktop_, |
| 417 ASSERT_TRUE(file_util::PathExists(shortcut1_path)); | 396 string16(kShortcutName1).append(installer::kLnkExt))); |
| 418 | 397 |
| 419 test_properties_->set_shortcut_name(kShortcutName2); | 398 test_properties_->set_shortcut_name(kShortcutName2); |
| 420 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); | 399 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); |
| 421 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 422 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 423 *test_properties_, | |
| 424 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 425 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); | |
| 426 base::FilePath shortcut2_path( | 400 base::FilePath shortcut2_path( |
| 427 fake_user_desktop_.path().Append(shortcut2_name)); | 401 CreateTestShortcutHelper(fake_user_desktop_, |
| 428 ASSERT_TRUE(file_util::PathExists(shortcut2_path)); | 402 string16(kShortcutName2).append(installer::kLnkExt))); |
| 429 | 403 |
| 430 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 404 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 431 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 405 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 432 ShellUtil::CURRENT_USER, NULL)); | 406 chrome_exe_)); |
| 433 ASSERT_FALSE(file_util::PathExists(shortcut1_path)); | 407 ASSERT_FALSE(file_util::PathExists(shortcut1_path)); |
| 434 ASSERT_FALSE(file_util::PathExists(shortcut2_path)); | 408 ASSERT_FALSE(file_util::PathExists(shortcut2_path)); |
| 435 ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); | 409 ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); |
| 436 } | 410 } |
| 437 | 411 |
| 412 TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { | |
| 413 base::FilePath shortcut_path( | |
| 414 CreateTestShortcutHelper(fake_user_desktop_, L"")); | |
| 415 | |
| 416 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); | |
| 417 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | |
| 418 properties.set_target(new_exe); | |
| 419 | |
| 420 ASSERT_TRUE(ShellUtil::UpdateShortcuts( | |
| 421 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, | |
| 422 chrome_exe_, properties)); | |
| 423 base::FilePath target_path; | |
| 424 ASSERT_TRUE(base::win::ResolveShortcut(shortcut_path, &target_path, NULL)); | |
|
gab
2013/05/02 21:23:59
Please use ValidateChromeShortcut to validate all
huangs
2013/05/02 21:59:35
Not using ValidateChromeShortcut for now, per disc
| |
| 425 ASSERT_EQ(new_exe, target_path); | |
| 426 } | |
| 427 | |
| 428 TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { | |
| 429 test_properties_->level = ShellUtil::SYSTEM_LEVEL; | |
| 430 base::FilePath shortcut_path( | |
| 431 CreateTestShortcutHelper(fake_common_desktop_, L"")); | |
| 432 | |
| 433 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); | |
| 434 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | |
| 435 properties.set_target(new_exe); | |
| 436 | |
| 437 ASSERT_TRUE(ShellUtil::UpdateShortcuts( | |
| 438 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, | |
| 439 chrome_exe_, properties)); | |
| 440 base::FilePath target_path; | |
| 441 ASSERT_TRUE(base::win::ResolveShortcut(shortcut_path, &target_path, NULL)); | |
| 442 ASSERT_EQ(new_exe, target_path); | |
| 443 } | |
| 444 | |
| 445 TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { | |
| 446 const wchar_t kShortcutName1[] = L"Chrome 1"; | |
| 447 const wchar_t kShortcutName2[] = L"Chrome 2"; | |
| 448 | |
| 449 test_properties_->set_shortcut_name(kShortcutName1); | |
| 450 base::FilePath shortcut1_path( | |
| 451 CreateTestShortcutHelper(fake_user_desktop_, | |
| 452 string16(kShortcutName1).append(installer::kLnkExt))); | |
| 453 | |
| 454 test_properties_->set_shortcut_name(kShortcutName2); | |
| 455 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); | |
| 456 base::FilePath shortcut2_path( | |
| 457 CreateTestShortcutHelper(fake_user_desktop_, | |
| 458 string16(kShortcutName2).append(installer::kLnkExt))); | |
| 459 | |
| 460 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); | |
| 461 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | |
| 462 properties.set_target(new_exe); | |
| 463 | |
| 464 ASSERT_TRUE(ShellUtil::UpdateShortcuts( | |
| 465 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, | |
| 466 chrome_exe_, properties)); | |
| 467 | |
| 468 base::FilePath target_path1; | |
| 469 ASSERT_TRUE(base::win::ResolveShortcut(shortcut1_path, &target_path1, NULL)); | |
| 470 ASSERT_EQ(new_exe, target_path1); | |
| 471 base::FilePath target_path2; | |
| 472 ASSERT_TRUE(base::win::ResolveShortcut(shortcut2_path, &target_path2, NULL)); | |
| 473 ASSERT_EQ(new_exe, target_path2); | |
| 474 } | |
| 475 | |
| 438 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { | 476 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { |
| 439 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 477 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 440 ShellUtil::SHORTCUT_LOCATION_START_MENU, | 478 ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 441 dist_, *test_properties_, | 479 dist_, *test_properties_, |
| 442 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 480 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 443 test_properties_->set_shortcut_name(L"A second shortcut"); | 481 test_properties_->set_shortcut_name(L"A second shortcut"); |
| 444 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 482 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 445 ShellUtil::SHORTCUT_LOCATION_START_MENU, | 483 ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 446 dist_, *test_properties_, | 484 dist_, *test_properties_, |
| 447 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 485 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 448 | 486 |
| 449 base::FilePath shortcut_folder( | 487 base::FilePath shortcut_folder( |
| 450 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); | 488 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); |
| 451 file_util::FileEnumerator file_counter(shortcut_folder, false, | 489 file_util::FileEnumerator file_counter(shortcut_folder, false, |
| 452 file_util::FileEnumerator::FILES); | 490 file_util::FileEnumerator::FILES); |
| 453 int count = 0; | 491 int count = 0; |
| 454 while (!file_counter.Next().empty()) | 492 while (!file_counter.Next().empty()) |
| 455 ++count; | 493 ++count; |
| 456 EXPECT_EQ(2, count); | 494 EXPECT_EQ(2, count); |
| 457 | 495 |
| 458 ASSERT_TRUE(file_util::PathExists(shortcut_folder)); | 496 ASSERT_TRUE(file_util::PathExists(shortcut_folder)); |
| 459 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 497 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 460 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, chrome_exe_, | 498 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, |
| 461 ShellUtil::CURRENT_USER, NULL)); | 499 chrome_exe_)); |
| 462 ASSERT_FALSE(file_util::PathExists(shortcut_folder)); | 500 ASSERT_FALSE(file_util::PathExists(shortcut_folder)); |
| 463 } | 501 } |
| 464 | 502 |
| 465 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { | 503 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { |
| 466 base::ScopedTempDir other_exe_dir; | 504 base::ScopedTempDir other_exe_dir; |
| 467 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); | 505 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); |
| 468 base::FilePath other_chrome_exe = | 506 base::FilePath other_chrome_exe = |
| 469 other_exe_dir.path().Append(installer::kChromeExe); | 507 other_exe_dir.path().Append(installer::kChromeExe); |
| 470 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); | 508 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); |
| 471 | 509 |
| 472 test_properties_->set_target(other_chrome_exe); | 510 test_properties_->set_target(other_chrome_exe); |
| 473 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 511 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 474 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 512 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 475 *test_properties_, | 513 *test_properties_, |
| 476 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 514 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 477 | 515 |
| 478 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 516 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); |
| 479 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | 517 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); |
| 480 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 518 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 481 | 519 |
| 482 // The shortcut shouldn't be removed as it was installed pointing to | 520 // The shortcut shouldn't be removed as it was installed pointing to |
| 483 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the | 521 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the |
| 484 // removed shortcut should point to |chrome_exe_|. | 522 // removed shortcut should point to |chrome_exe_|. |
| 485 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 523 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 486 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 524 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 487 ShellUtil::CURRENT_USER, NULL)); | 525 chrome_exe_)); |
| 488 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 526 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 489 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 527 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 490 } | 528 } |
| 491 | 529 |
| 492 TEST(ShellUtilTest, BuildAppModelIdBasic) { | 530 TEST(ShellUtilTest, BuildAppModelIdBasic) { |
| 493 std::vector<string16> components; | 531 std::vector<string16> components; |
| 494 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 532 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 495 const string16 base_app_id(dist->GetBaseAppId()); | 533 const string16 base_app_id(dist->GetBaseAppId()); |
| 496 components.push_back(base_app_id); | 534 components.push_back(base_app_id); |
| 497 ASSERT_EQ(base_app_id, ShellUtil::BuildAppModelId(components)); | 535 ASSERT_EQ(base_app_id, ShellUtil::BuildAppModelId(components)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 | 598 |
| 561 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 599 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
| 562 L"MZXW6YTB", L"MZXW6YTBOI"}; | 600 L"MZXW6YTB", L"MZXW6YTBOI"}; |
| 563 | 601 |
| 564 // Run the tests, with one more letter in the input every pass. | 602 // Run the tests, with one more letter in the input every pass. |
| 565 for (int i = 0; i < arraysize(expected); ++i) { | 603 for (int i = 0; i < arraysize(expected); ++i) { |
| 566 ASSERT_EQ(expected[i], | 604 ASSERT_EQ(expected[i], |
| 567 ShellUtil::ByteArrayToBase32(test_array, i)); | 605 ShellUtil::ByteArrayToBase32(test_array, i)); |
| 568 } | 606 } |
| 569 } | 607 } |
| OLD | NEW |