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

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

Issue 22382007: On user-level Chrome self-destruct, make user-created shortcuts target system-level chrome.exe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. 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/util/shell_util.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 400081312733e9244da4ca958b45901883df073c..29a0723346b4d05fae704b5a4d326f3827bfdd0d 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -451,7 +451,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
ASSERT_TRUE(ShellUtil::UpdateShortcuts(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, updated_properties));
+ chrome_exe_, false, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -478,7 +478,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
ASSERT_TRUE(ShellUtil::UpdateShortcuts(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL,
- chrome_exe_, updated_properties));
+ chrome_exe_, false, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -490,18 +490,18 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
const wchar_t kShortcutName1[] = L"Chrome 1";
const wchar_t kShortcutName2[] = L"Chrome 2";
- // Setup shortcut 1.
+ // Setup shortcut 1, which has empty arguments.
test_properties_.set_shortcut_name(kShortcutName1);
+ test_properties_.set_arguments(L"");
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
- string16 shortcut1_name(
- string16(kShortcutName1).append(installer::kLnkExt));
+ string16 shortcut1_name(string16(kShortcutName1).append(installer::kLnkExt));
base::FilePath shortcut1_path(
fake_user_desktop_.path().Append(shortcut1_name));
ShellUtil::ShortcutProperties expected_properties1(test_properties_);
- // Setup shortcut 2, which also has arguments.
+ // Setup shortcut 2, which has non-empty arguments.
string16 shortcut2_args = L"--profile-directory=\"Profile 2\"";
test_properties_.set_shortcut_name(kShortcutName2);
test_properties_.set_arguments(shortcut2_args);
@@ -518,17 +518,31 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
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(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, updated_properties));
+ chrome_exe_, /*require_args*/ true, updated_properties));
gab 2013/09/09 13:00:31 nit: I'm not against the inline comment, but I'd p
huangs 2013/09/11 19:02:52 I'm putting it in front for resemblance with Pytho
+ // Verify shortcut 1.
+ // |expected_properties1| was unchanged and still targets "chrome.exe", since
+ // it has empty target, yet we passed |require_args| = true.
+ ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
+ expected_properties1);
+ // Verify shortcut 2.
+ 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));
gab 2013/09/09 13:00:31 Same here.
huangs 2013/09/11 19:02:52 Done.
// Verify shortcut 1.
expected_properties1.set_target(new_exe);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
expected_properties1);
-
// Verify shortcut 2.
- expected_properties2.set_target(new_exe);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
expected_properties2);
}
« chrome/installer/util/shell_util.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