Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2388)

Unified Diff: chrome/installer/util/shell_util_unittest.cc

Issue 23581012: Restricting scope of ShellUtil's shortcut update feature for its specific usage in Chrome self-dest… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/installer/setup/uninstall.cc ('K') | « chrome/installer/util/shell_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util_unittest.cc
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc
index 29a0723346b4d05fae704b5a4d326f3827bfdd0d..b7303e898f0b9a24e794304f6bd04f15a023ba7e 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -434,7 +434,7 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) {
ASSERT_TRUE(base::PathExists(shortcut1_path.DirName()));
}
-TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
+TEST_F(ShellUtilShortcutTest, UpdateChromeShortcutsWithArgs) {
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
@@ -448,10 +448,10 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
updated_properties.set_target(new_exe);
-
- ASSERT_TRUE(ShellUtil::UpdateShortcuts(
+ // |updated_properties| has arguments.
+ ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, false, updated_properties));
+ chrome_exe_, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -459,7 +459,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
expected_properties);
}
-TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
+TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcutsWithArgs) {
test_properties_.level = ShellUtil::SYSTEM_LEVEL;
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
@@ -475,10 +475,10 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
updated_properties.set_target(new_exe);
-
- ASSERT_TRUE(ShellUtil::UpdateShortcuts(
+ // |updated_properties| has arguments.
+ ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL,
- chrome_exe_, false, updated_properties));
+ chrome_exe_, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -486,7 +486,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
expected_properties);
}
-TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
+TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcutsWithArgs) {
const wchar_t kShortcutName1[] = L"Chrome 1";
const wchar_t kShortcutName2[] = L"Chrome 2";
@@ -519,11 +519,10 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
updated_properties.set_target(new_exe);
- // |require_args| = true, so only changing shrotcuts that have non-empty
- // arguments; only shortcut 2 is updated.
- ASSERT_TRUE(ShellUtil::UpdateShortcuts(
+ // Only changing shrotcuts that have non-empty arguments, i.e., shortcut 2.
+ ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, /*require_args*/ true, updated_properties));
+ chrome_exe_, updated_properties));
// Verify shortcut 1.
// |expected_properties1| was unchanged and still targets "chrome.exe", since
// it has empty target, yet we passed |require_args| = true.
@@ -533,18 +532,6 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
expected_properties2.set_target(new_exe);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
expected_properties2);
-
- // |require_args| = false, now both shortcuts are updated.
- ASSERT_TRUE(ShellUtil::UpdateShortcuts(
- ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, /*require_args*/ false, updated_properties));
- // Verify shortcut 1.
- expected_properties1.set_target(new_exe);
- ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
- expected_properties1);
- // Verify shortcut 2.
- ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
- expected_properties2);
}
TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) {
« chrome/installer/setup/uninstall.cc ('K') | « chrome/installer/util/shell_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698