summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/shell_util_unittest.cc
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 14:58:23 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 14:58:23 +0000
commitf8b2ca3555497caedc341ec16f110e310c15562d (patch)
treee9d22ccd68a40201dc1bb9834efb7ed26ab49561 /chrome/installer/util/shell_util_unittest.cc
parentd21a8a5fb4d3af19452149bdcf7f6855ba80a194 (diff)
downloadchromium_src-f8b2ca3555497caedc341ec16f110e310c15562d.zip
chromium_src-f8b2ca3555497caedc341ec16f110e310c15562d.tar.gz
chromium_src-f8b2ca3555497caedc341ec16f110e310c15562d.tar.bz2
Add Windows desktop shortcut for multiple profiles.
BUG=87770 TEST=new unit tests added with this CL. Review URL: http://codereview.chromium.org/8502033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/shell_util_unittest.cc')
-rw-r--r--chrome/installer/util/shell_util_unittest.cc86
1 files changed, 79 insertions, 7 deletions
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc
index f6d3dd1..625010e 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -109,9 +109,12 @@ TEST_F(ShellUtilTest, UpdateChromeShortcutTest) {
FilePath shortcut_path = temp_dir_.path().AppendASCII("shortcut.lnk");
const std::wstring description(L"dummy description");
- EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(),
+ EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist,
+ exe_path.value(),
shortcut_path.value(),
- description, true));
+ L"",
+ description,
+ true));
EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(),
shortcut_path.value(),
description, 0));
@@ -130,9 +133,12 @@ TEST_F(ShellUtilTest, UpdateChromeShortcutTest) {
"}";
file.close();
ASSERT_TRUE(file_util::Delete(shortcut_path, false));
- EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(),
+ EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist,
+ exe_path.value(),
shortcut_path.value(),
- description, true));
+ L"",
+ description,
+ true));
EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(),
shortcut_path.value(),
description, 1));
@@ -140,9 +146,12 @@ TEST_F(ShellUtilTest, UpdateChromeShortcutTest) {
// Now change only description to update shortcut and make sure icon index
// doesn't change.
const std::wstring description2(L"dummy description 2");
- EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist, exe_path.value(),
+ EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist,
+ exe_path.value(),
shortcut_path.value(),
- description2, false));
+ L"",
+ description2,
+ false));
EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(),
shortcut_path.value(),
description2, 1));
@@ -173,15 +182,34 @@ TEST_F(ShellUtilTest, CreateChromeDesktopShortcutTest) {
EXPECT_TRUE(ShellUtil::GetDesktopPath(true, &system_desktop_path));
std::wstring shortcut_name;
- EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist, &shortcut_name, false));
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist, false, L"",
+ &shortcut_name));
+
+ std::wstring default_profile_shortcut_name;
+ const std::wstring default_profile_user_name = L"Minsk";
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist, false,
+ default_profile_user_name,
+ &default_profile_shortcut_name));
+
+ std::wstring second_profile_shortcut_name;
+ const std::wstring second_profile_user_name = L"Pinsk";
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist, false,
+ second_profile_user_name,
+ &second_profile_shortcut_name));
FilePath user_shortcut_path = user_desktop_path.Append(shortcut_name);
FilePath system_shortcut_path = system_desktop_path.Append(shortcut_name);
+ FilePath default_profile_shortcut_path = user_desktop_path.Append(
+ default_profile_shortcut_name);
+ FilePath second_profile_shortcut_path = user_desktop_path.Append(
+ second_profile_shortcut_name);
// Test simple creation of a user-level shortcut.
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::CURRENT_USER,
false,
true));
@@ -197,6 +225,8 @@ TEST_F(ShellUtilTest, CreateChromeDesktopShortcutTest) {
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::SYSTEM_LEVEL,
false,
true));
@@ -213,12 +243,16 @@ TEST_F(ShellUtilTest, CreateChromeDesktopShortcutTest) {
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::SYSTEM_LEVEL,
false,
true));
EXPECT_FALSE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::CURRENT_USER,
false,
true));
@@ -236,12 +270,16 @@ TEST_F(ShellUtilTest, CreateChromeDesktopShortcutTest) {
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::CURRENT_USER,
false,
true));
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(dist,
exe_path.value(),
description,
+ L"",
+ L"",
ShellUtil::SYSTEM_LEVEL,
false,
true));
@@ -259,4 +297,38 @@ TEST_F(ShellUtilTest, CreateChromeDesktopShortcutTest) {
EXPECT_TRUE(ShellUtil::RemoveChromeDesktopShortcut(dist,
ShellUtil::SYSTEM_LEVEL,
false));
+
+ // Test creation of two profile-specific shortcuts (these are always
+ // user-level).
+ EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(
+ dist,
+ exe_path.value(),
+ description,
+ default_profile_user_name,
+ L"--profile-directory=\"Default\"",
+ ShellUtil::CURRENT_USER,
+ false,
+ true));
+ EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(),
+ default_profile_shortcut_path.value(),
+ description,
+ 0));
+ EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut(
+ dist,
+ exe_path.value(),
+ description,
+ second_profile_user_name,
+ L"--profile-directory=\"Profile 1\"",
+ ShellUtil::CURRENT_USER,
+ false,
+ true));
+ EXPECT_TRUE(VerifyChromeShortcut(exe_path.value(),
+ second_profile_shortcut_path.value(),
+ description,
+ 0));
+ std::vector<string16> profile_names;
+ profile_names.push_back(default_profile_shortcut_name);
+ profile_names.push_back(second_profile_shortcut_name);
+ EXPECT_TRUE(ShellUtil::RemoveChromeDesktopShortcutsWithAppendedNames(
+ profile_names));
}