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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { | 349 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { |
| 350 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 350 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 351 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 352 *test_properties_, | 352 *test_properties_, |
| 353 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 353 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 354 | 354 |
| 355 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 355 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); |
| 356 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | 356 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); |
| 357 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 357 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 358 | 358 |
| 359 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 359 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 360 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 360 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 361 ShellUtil::CURRENT_USER, NULL)); | 361 chrome_exe_)); |
| 362 ASSERT_FALSE(file_util::PathExists(shortcut_path)); | 362 ASSERT_FALSE(file_util::PathExists(shortcut_path)); |
| 363 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 363 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 364 } | 364 } |
| 365 | 365 |
| 366 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { | 366 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { |
| 367 test_properties_->level = ShellUtil::SYSTEM_LEVEL; | 367 test_properties_->level = ShellUtil::SYSTEM_LEVEL; |
| 368 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 368 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 369 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 369 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 370 *test_properties_, | 370 *test_properties_, |
| 371 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 371 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 372 | 372 |
| 373 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 373 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); |
| 374 base::FilePath shortcut_path( | 374 base::FilePath shortcut_path( |
| 375 fake_common_desktop_.path().Append(shortcut_name)); | 375 fake_common_desktop_.path().Append(shortcut_name)); |
| 376 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 376 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 377 | 377 |
| 378 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 378 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 379 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 379 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, |
| 380 ShellUtil::SYSTEM_LEVEL, NULL)); | 380 chrome_exe_)); |
| 381 ASSERT_FALSE(file_util::PathExists(shortcut_path)); | |
| 382 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | |
| 383 } | |
| 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)); | 381 ASSERT_FALSE(file_util::PathExists(shortcut_path)); |
| 401 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 382 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 402 } | 383 } |
| 403 | 384 |
| 404 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { | 385 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { |
| 405 const wchar_t kShortcutName1[] = L"Chrome 1"; | 386 const wchar_t kShortcutName1[] = L"Chrome 1"; |
| 406 const wchar_t kShortcutName2[] = L"Chrome 2"; | 387 const wchar_t kShortcutName2[] = L"Chrome 2"; |
| 407 | 388 |
| 389 test_properties_->set_shortcut_name(kShortcutName1); | |
| 390 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 391 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 392 *test_properties_, | |
| 393 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 394 string16 shortcut1_name( | |
| 395 string16(kShortcutName1).append(installer::kLnkExt)); | |
| 396 base::FilePath shortcut1_path( | |
| 397 fake_user_desktop_.path().Append(shortcut1_name)); | |
| 398 ASSERT_TRUE(file_util::PathExists(shortcut1_path)); | |
| 399 | |
| 400 test_properties_->set_shortcut_name(kShortcutName2); | |
| 401 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); | |
| 402 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 403 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 404 *test_properties_, | |
| 405 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 406 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); | |
| 407 base::FilePath shortcut2_path( | |
| 408 fake_user_desktop_.path().Append(shortcut2_name)); | |
| 409 ASSERT_TRUE(file_util::PathExists(shortcut2_path)); | |
| 410 | |
| 411 ASSERT_TRUE(ShellUtil::RemoveShortcuts( | |
| 412 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, | |
| 413 chrome_exe_)); | |
| 414 ASSERT_FALSE(file_util::PathExists(shortcut1_path)); | |
| 415 ASSERT_FALSE(file_util::PathExists(shortcut2_path)); | |
| 416 ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); | |
| 417 } | |
| 418 | |
| 419 TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { | |
| 420 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 421 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 422 *test_properties_, | |
| 423 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 424 | |
| 425 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | |
| 426 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | |
| 427 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | |
| 428 | |
| 429 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); | |
| 430 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | |
|
gab
2013/05/02 22:05:40
nit: s/properties/updated_properties (here and in
huangs
2013/05/02 22:11:40
Done (for all 3 tests, of course).
| |
| 431 properties.set_target(new_exe); | |
| 432 | |
| 433 ASSERT_TRUE(ShellUtil::UpdateShortcuts( | |
| 434 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, | |
| 435 chrome_exe_, properties)); | |
| 436 | |
| 437 // TODO(huangs): Fix ValidateChromeShortcut() and use it. | |
| 438 base::FilePath target_path; | |
| 439 ASSERT_TRUE(base::win::ResolveShortcut(shortcut_path, &target_path, NULL)); | |
| 440 ASSERT_EQ(new_exe, target_path); | |
| 441 } | |
| 442 | |
| 443 TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { | |
| 444 test_properties_->level = ShellUtil::SYSTEM_LEVEL; | |
| 445 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | |
| 446 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | |
| 447 *test_properties_, | |
| 448 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | |
| 449 | |
| 450 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | |
| 451 base::FilePath shortcut_path( | |
| 452 fake_common_desktop_.path().Append(shortcut_name)); | |
| 453 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | |
| 454 | |
| 455 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); | |
| 456 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); | |
| 457 properties.set_target(new_exe); | |
| 458 | |
| 459 ASSERT_TRUE(ShellUtil::UpdateShortcuts( | |
| 460 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, | |
| 461 chrome_exe_, properties)); | |
| 462 | |
| 463 // TODO(huangs): Fix ValidateChromeShortcut() and use it. | |
| 464 base::FilePath target_path; | |
| 465 ASSERT_TRUE(base::win::ResolveShortcut(shortcut_path, &target_path, NULL)); | |
| 466 ASSERT_EQ(new_exe, target_path); | |
| 467 } | |
| 468 | |
| 469 TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { | |
| 470 const wchar_t kShortcutName1[] = L"Chrome 1"; | |
| 471 const wchar_t kShortcutName2[] = L"Chrome 2"; | |
| 472 | |
| 408 test_properties_->set_shortcut_name(kShortcutName1); | 473 test_properties_->set_shortcut_name(kShortcutName1); |
| 409 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 474 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 410 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 475 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 411 *test_properties_, | 476 *test_properties_, |
| 412 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 477 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 413 string16 shortcut1_name( | 478 string16 shortcut1_name( |
| 414 string16(kShortcutName1).append(installer::kLnkExt)); | 479 string16(kShortcutName1).append(installer::kLnkExt)); |
| 415 base::FilePath shortcut1_path( | 480 base::FilePath shortcut1_path( |
| 416 fake_user_desktop_.path().Append(shortcut1_name)); | 481 fake_user_desktop_.path().Append(shortcut1_name)); |
| 417 ASSERT_TRUE(file_util::PathExists(shortcut1_path)); | |
| 418 | 482 |
| 483 string16 shortcut2_args = L"--profile-directory=\"Profile 2\""; | |
| 419 test_properties_->set_shortcut_name(kShortcutName2); | 484 test_properties_->set_shortcut_name(kShortcutName2); |
| 420 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); | 485 test_properties_->set_arguments(shortcut2_args); |
| 421 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 486 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 422 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 487 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 423 *test_properties_, | 488 *test_properties_, |
| 424 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 489 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 425 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); | 490 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); |
| 426 base::FilePath shortcut2_path( | 491 base::FilePath shortcut2_path( |
| 427 fake_user_desktop_.path().Append(shortcut2_name)); | 492 fake_user_desktop_.path().Append(shortcut2_name)); |
| 428 ASSERT_TRUE(file_util::PathExists(shortcut2_path)); | 493 ASSERT_TRUE(file_util::PathExists(shortcut2_path)); |
| 429 | 494 |
| 430 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 495 base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); |
| 431 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 496 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 432 ShellUtil::CURRENT_USER, NULL)); | 497 properties.set_target(new_exe); |
| 433 ASSERT_FALSE(file_util::PathExists(shortcut1_path)); | 498 |
| 434 ASSERT_FALSE(file_util::PathExists(shortcut2_path)); | 499 ASSERT_TRUE(ShellUtil::UpdateShortcuts( |
| 435 ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); | 500 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 501 chrome_exe_, properties)); | |
| 502 | |
| 503 // TODO(huangs): Fix ValidateChromeShortcut() and use it. | |
| 504 base::FilePath target_path1; | |
| 505 ASSERT_TRUE(base::win::ResolveShortcut(shortcut1_path, &target_path1, NULL)); | |
| 506 ASSERT_EQ(new_exe, target_path1); | |
| 507 | |
| 508 base::FilePath target_path2; | |
| 509 string16 shortcut2_args_read; | |
| 510 ASSERT_TRUE(base::win::ResolveShortcut(shortcut2_path, &target_path2, | |
| 511 &shortcut2_args_read)); | |
| 512 ASSERT_EQ(new_exe, target_path2); | |
| 513 ASSERT_EQ(shortcut2_args, shortcut2_args_read); | |
| 436 } | 514 } |
| 437 | 515 |
| 438 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { | 516 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { |
| 439 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 517 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 440 ShellUtil::SHORTCUT_LOCATION_START_MENU, | 518 ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 441 dist_, *test_properties_, | 519 dist_, *test_properties_, |
| 442 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 520 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 443 test_properties_->set_shortcut_name(L"A second shortcut"); | 521 test_properties_->set_shortcut_name(L"A second shortcut"); |
| 444 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 522 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 445 ShellUtil::SHORTCUT_LOCATION_START_MENU, | 523 ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 446 dist_, *test_properties_, | 524 dist_, *test_properties_, |
| 447 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 525 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 448 | 526 |
| 449 base::FilePath shortcut_folder( | 527 base::FilePath shortcut_folder( |
| 450 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); | 528 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); |
| 451 file_util::FileEnumerator file_counter(shortcut_folder, false, | 529 file_util::FileEnumerator file_counter(shortcut_folder, false, |
| 452 file_util::FileEnumerator::FILES); | 530 file_util::FileEnumerator::FILES); |
| 453 int count = 0; | 531 int count = 0; |
| 454 while (!file_counter.Next().empty()) | 532 while (!file_counter.Next().empty()) |
| 455 ++count; | 533 ++count; |
| 456 EXPECT_EQ(2, count); | 534 EXPECT_EQ(2, count); |
| 457 | 535 |
| 458 ASSERT_TRUE(file_util::PathExists(shortcut_folder)); | 536 ASSERT_TRUE(file_util::PathExists(shortcut_folder)); |
| 459 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 537 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 460 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, chrome_exe_, | 538 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, |
| 461 ShellUtil::CURRENT_USER, NULL)); | 539 chrome_exe_)); |
| 462 ASSERT_FALSE(file_util::PathExists(shortcut_folder)); | 540 ASSERT_FALSE(file_util::PathExists(shortcut_folder)); |
| 463 } | 541 } |
| 464 | 542 |
| 465 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { | 543 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { |
| 466 base::ScopedTempDir other_exe_dir; | 544 base::ScopedTempDir other_exe_dir; |
| 467 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); | 545 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); |
| 468 base::FilePath other_chrome_exe = | 546 base::FilePath other_chrome_exe = |
| 469 other_exe_dir.path().Append(installer::kChromeExe); | 547 other_exe_dir.path().Append(installer::kChromeExe); |
| 470 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); | 548 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); |
| 471 | 549 |
| 472 test_properties_->set_target(other_chrome_exe); | 550 test_properties_->set_target(other_chrome_exe); |
| 473 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( | 551 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( |
| 474 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 552 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
| 475 *test_properties_, | 553 *test_properties_, |
| 476 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); | 554 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); |
| 477 | 555 |
| 478 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); | 556 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); |
| 479 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); | 557 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); |
| 480 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 558 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 481 | 559 |
| 482 // The shortcut shouldn't be removed as it was installed pointing to | 560 // The shortcut shouldn't be removed as it was installed pointing to |
| 483 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the | 561 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the |
| 484 // removed shortcut should point to |chrome_exe_|. | 562 // removed shortcut should point to |chrome_exe_|. |
| 485 ASSERT_TRUE(ShellUtil::RemoveShortcut( | 563 ASSERT_TRUE(ShellUtil::RemoveShortcuts( |
| 486 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, chrome_exe_, | 564 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, |
| 487 ShellUtil::CURRENT_USER, NULL)); | 565 chrome_exe_)); |
| 488 ASSERT_TRUE(file_util::PathExists(shortcut_path)); | 566 ASSERT_TRUE(file_util::PathExists(shortcut_path)); |
| 489 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); | 567 ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); |
| 490 } | 568 } |
| 491 | 569 |
| 492 TEST(ShellUtilTest, BuildAppModelIdBasic) { | 570 TEST(ShellUtilTest, BuildAppModelIdBasic) { |
| 493 std::vector<string16> components; | 571 std::vector<string16> components; |
| 494 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 572 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 495 const string16 base_app_id(dist->GetBaseAppId()); | 573 const string16 base_app_id(dist->GetBaseAppId()); |
| 496 components.push_back(base_app_id); | 574 components.push_back(base_app_id); |
| 497 ASSERT_EQ(base_app_id, ShellUtil::BuildAppModelId(components)); | 575 ASSERT_EQ(base_app_id, ShellUtil::BuildAppModelId(components)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 | 638 |
| 561 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 639 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
| 562 L"MZXW6YTB", L"MZXW6YTBOI"}; | 640 L"MZXW6YTB", L"MZXW6YTBOI"}; |
| 563 | 641 |
| 564 // Run the tests, with one more letter in the input every pass. | 642 // Run the tests, with one more letter in the input every pass. |
| 565 for (int i = 0; i < arraysize(expected); ++i) { | 643 for (int i = 0; i < arraysize(expected); ++i) { |
| 566 ASSERT_EQ(expected[i], | 644 ASSERT_EQ(expected[i], |
| 567 ShellUtil::ByteArrayToBase32(test_array, i)); | 645 ShellUtil::ByteArrayToBase32(test_array, i)); |
| 568 } | 646 } |
| 569 } | 647 } |
| OLD | NEW |