Commit da4d4fb0 authored by gab@chromium.org's avatar gab@chromium.org

Fix shortcut tests and remove legacy shortcut code for the Default-user

Quick Launch shortcut.

InstallShortcutTest.CreateAllShortcutsSystemLevel has been broken since http://crrev.com/164849 ...

The test expectations had not been adjusted in this CL as setup_unittests.exe
doesn't run on the waterfall yet (issue #153829) and the breakage had gone
unnoticed.

Expectations have now been adjusted such that we no longer expect a system-level
(Default-user) Quick Launch shortcut, but a per-user Quick Launch shortcut for
the admin running the install as the product code's logic has been doing for over
a year...

Also remove the code cleaning up the legacy Default-user Quick Launch shortcut as
this cleanup code has been running for 21 months now and leaving this shortcut
behind for a few users is a no-op (i.e. the Default-user shortcut will get copied
to new Windows profiles and Active Setup will kick in a few seconds later to try
to install the same shortcut which will already exist... the UX result will be
the same: a single Chrome Quick Launch shortcut will be installed).

BUG=329239, 153829

Review URL: https://codereview.chromium.org/432273005

Cr-Commit-Position: refs/heads/master@{#288393}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288393 0039d316-1c4b-4281-b951-d872f2087c98
parent 33d76bb0
...@@ -16,38 +16,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase; ...@@ -16,38 +16,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
using base::FilePath; using base::FilePath;
namespace {
bool GetQuickLaunchPath(bool default_user, FilePath* result) {
if (default_user) {
wchar_t system_buffer[MAX_PATH];
system_buffer[0] = 0;
// As per MSDN, passing -1 for |hToken| indicates the Default user:
// http://msdn.microsoft.com/library/windows/desktop/bb762181.aspx
if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA,
reinterpret_cast<HANDLE>(-1), SHGFP_TYPE_CURRENT,
system_buffer))) {
return false;
}
*result = FilePath(system_buffer);
} else if (!PathService::Get(base::DIR_APP_DATA, result)) {
// For the current user, grab the APPDATA directory directly from the
// PathService cache.
return false;
}
// According to various sources, appending
// "Microsoft\Internet Explorer\Quick Launch" to %appdata% is the only
// reliable way to get the quick launch folder across all versions of Windows.
// http://stackoverflow.com/questions/76080/how-do-you-reliably-get-the-quick-
// http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0901.mspx
*result = result->AppendASCII("Microsoft");
*result = result->AppendASCII("Internet Explorer");
*result = result->AppendASCII("Quick Launch");
return true;
}
} // namespace
namespace base { namespace base {
bool PathProviderWin(int key, FilePath* result) { bool PathProviderWin(int key, FilePath* result) {
...@@ -178,12 +146,17 @@ bool PathProviderWin(int key, FilePath* result) { ...@@ -178,12 +146,17 @@ bool PathProviderWin(int key, FilePath* result) {
cur = FilePath(system_buffer); cur = FilePath(system_buffer);
break; break;
case base::DIR_USER_QUICK_LAUNCH: case base::DIR_USER_QUICK_LAUNCH:
if (!GetQuickLaunchPath(false, &cur)) if (!PathService::Get(base::DIR_APP_DATA, &cur))
return false; return false;
break; // According to various sources, appending
case base::DIR_DEFAULT_USER_QUICK_LAUNCH: // "Microsoft\Internet Explorer\Quick Launch" to %appdata% is the only
if (!GetQuickLaunchPath(true, &cur)) // reliable way to get the quick launch folder across all versions of
return false; // Windows.
// http://stackoverflow.com/questions/76080/how-do-you-reliably-get-the-quick-
// http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0901.mspx
cur = cur.AppendASCII("Microsoft")
.AppendASCII("Internet Explorer")
.AppendASCII("Quick Launch");
break; break;
case base::DIR_TASKBAR_PINS: case base::DIR_TASKBAR_PINS:
if (!PathService::Get(base::DIR_USER_QUICK_LAUNCH, &cur)) if (!PathService::Get(base::DIR_USER_QUICK_LAUNCH, &cur))
......
...@@ -37,8 +37,6 @@ enum { ...@@ -37,8 +37,6 @@ enum {
DIR_COMMON_DESKTOP, // Directory for the common desktop (visible DIR_COMMON_DESKTOP, // Directory for the common desktop (visible
// on all user's Desktop). // on all user's Desktop).
DIR_USER_QUICK_LAUNCH, // Directory for the quick launch shortcuts. DIR_USER_QUICK_LAUNCH, // Directory for the quick launch shortcuts.
DIR_DEFAULT_USER_QUICK_LAUNCH, // Directory for the quick launch shortcuts
// of the Default user.
DIR_TASKBAR_PINS, // Directory for the shortcuts pinned to taskbar via DIR_TASKBAR_PINS, // Directory for the shortcuts pinned to taskbar via
// base::win::TaskbarPinShortcutLink(). // base::win::TaskbarPinShortcutLink().
DIR_WINDOWS_FONTS, // Usually C:\Windows\Fonts. DIR_WINDOWS_FONTS, // Usually C:\Windows\Fonts.
......
...@@ -15,10 +15,7 @@ ...@@ -15,10 +15,7 @@
#include "testing/platform_test.h" #include "testing/platform_test.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include <userenv.h>
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
// userenv.dll is required for GetDefaultUserProfileDirectory().
#pragma comment(lib, "userenv.lib")
#endif #endif
namespace { namespace {
...@@ -45,18 +42,7 @@ bool ReturnsValidPath(int dir_type) { ...@@ -45,18 +42,7 @@ bool ReturnsValidPath(int dir_type) {
check_path_exists = false; check_path_exists = false;
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
if (dir_type == base::DIR_DEFAULT_USER_QUICK_LAUNCH) { if (dir_type == base::DIR_TASKBAR_PINS) {
// On Windows XP, the Quick Launch folder for the "Default User" doesn't
// exist by default. At least confirm that the path returned begins with the
// Default User's profile path.
if (base::win::GetVersion() < base::win::VERSION_VISTA) {
wchar_t default_profile_path[MAX_PATH];
DWORD size = arraysize(default_profile_path);
return (result &&
::GetDefaultUserProfileDirectory(default_profile_path, &size) &&
StartsWith(path.value(), default_profile_path, false));
}
} else if (dir_type == base::DIR_TASKBAR_PINS) {
// There is no pinned-to-taskbar shortcuts prior to Win7. // There is no pinned-to-taskbar shortcuts prior to Win7.
if (base::win::GetVersion() < base::win::VERSION_WIN7) if (base::win::GetVersion() < base::win::VERSION_WIN7)
check_path_exists = false; check_path_exists = false;
......
...@@ -244,11 +244,8 @@ installer::InstallStatus InstallNewVersion( ...@@ -244,11 +244,8 @@ installer::InstallStatus InstallNewVersion(
return installer::INSTALL_FAILED; return installer::INSTALL_FAILED;
} }
// Deletes the old "Uninstall Google Chrome" shortcut in the Start menu and, if // Deletes the old "Uninstall Google Chrome" shortcut in the Start menu which
// this is a system-level install, also deletes the old Default user Quick // was installed prior to Chrome 24.
// Launch shortcut. Both of these were created prior to Chrome 24; in Chrome 24,
// the uninstall shortcut was removed and the Default user Quick Launch shortcut
// was replaced by per-user shortcuts created via Active Setup.
void CleanupLegacyShortcuts(const installer::InstallerState& installer_state, void CleanupLegacyShortcuts(const installer::InstallerState& installer_state,
BrowserDistribution* dist, BrowserDistribution* dist,
const base::FilePath& chrome_exe) { const base::FilePath& chrome_exe) {
...@@ -260,12 +257,6 @@ void CleanupLegacyShortcuts(const installer::InstallerState& installer_state, ...@@ -260,12 +257,6 @@ void CleanupLegacyShortcuts(const installer::InstallerState& installer_state,
uninstall_shortcut_path = uninstall_shortcut_path.Append( uninstall_shortcut_path = uninstall_shortcut_path.Append(
dist->GetUninstallLinkName() + installer::kLnkExt); dist->GetUninstallLinkName() + installer::kLnkExt);
base::DeleteFile(uninstall_shortcut_path, false); base::DeleteFile(uninstall_shortcut_path, false);
if (installer_state.system_install()) {
ShellUtil::RemoveShortcuts(
ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist,
ShellUtil::SYSTEM_LEVEL, chrome_exe);
}
} }
// Returns the appropriate shortcut operations for App Launcher, // Returns the appropriate shortcut operations for App Launcher,
......
...@@ -94,7 +94,6 @@ class InstallShortcutTest : public testing::Test { ...@@ -94,7 +94,6 @@ class InstallShortcutTest : public testing::Test {
ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir()); ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
ASSERT_TRUE(fake_common_desktop_.CreateUniqueTempDir()); ASSERT_TRUE(fake_common_desktop_.CreateUniqueTempDir());
ASSERT_TRUE(fake_user_quick_launch_.CreateUniqueTempDir()); ASSERT_TRUE(fake_user_quick_launch_.CreateUniqueTempDir());
ASSERT_TRUE(fake_default_user_quick_launch_.CreateUniqueTempDir());
ASSERT_TRUE(fake_start_menu_.CreateUniqueTempDir()); ASSERT_TRUE(fake_start_menu_.CreateUniqueTempDir());
ASSERT_TRUE(fake_common_start_menu_.CreateUniqueTempDir()); ASSERT_TRUE(fake_common_start_menu_.CreateUniqueTempDir());
user_desktop_override_.reset( user_desktop_override_.reset(
...@@ -106,9 +105,6 @@ class InstallShortcutTest : public testing::Test { ...@@ -106,9 +105,6 @@ class InstallShortcutTest : public testing::Test {
user_quick_launch_override_.reset( user_quick_launch_override_.reset(
new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH, new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH,
fake_user_quick_launch_.path())); fake_user_quick_launch_.path()));
default_user_quick_launch_override_.reset(
new base::ScopedPathOverride(base::DIR_DEFAULT_USER_QUICK_LAUNCH,
fake_default_user_quick_launch_.path()));
start_menu_override_.reset( start_menu_override_.reset(
new base::ScopedPathOverride(base::DIR_START_MENU, new base::ScopedPathOverride(base::DIR_START_MENU,
fake_start_menu_.path())); fake_start_menu_.path()));
...@@ -134,8 +130,6 @@ class InstallShortcutTest : public testing::Test { ...@@ -134,8 +130,6 @@ class InstallShortcutTest : public testing::Test {
.Append(shortcut_name); .Append(shortcut_name);
system_desktop_shortcut_ = system_desktop_shortcut_ =
fake_common_desktop_.path().Append(shortcut_name); fake_common_desktop_.path().Append(shortcut_name);
system_quick_launch_shortcut_ =
fake_default_user_quick_launch_.path().Append(shortcut_name);
system_start_menu_shortcut_ = system_start_menu_shortcut_ =
fake_common_start_menu_.path().Append( fake_common_start_menu_.path().Append(
dist_->GetStartMenuShortcutSubfolder( dist_->GetStartMenuShortcutSubfolder(
...@@ -195,13 +189,11 @@ class InstallShortcutTest : public testing::Test { ...@@ -195,13 +189,11 @@ class InstallShortcutTest : public testing::Test {
base::ScopedTempDir fake_user_desktop_; base::ScopedTempDir fake_user_desktop_;
base::ScopedTempDir fake_common_desktop_; base::ScopedTempDir fake_common_desktop_;
base::ScopedTempDir fake_user_quick_launch_; base::ScopedTempDir fake_user_quick_launch_;
base::ScopedTempDir fake_default_user_quick_launch_;
base::ScopedTempDir fake_start_menu_; base::ScopedTempDir fake_start_menu_;
base::ScopedTempDir fake_common_start_menu_; base::ScopedTempDir fake_common_start_menu_;
scoped_ptr<base::ScopedPathOverride> user_desktop_override_; scoped_ptr<base::ScopedPathOverride> user_desktop_override_;
scoped_ptr<base::ScopedPathOverride> common_desktop_override_; scoped_ptr<base::ScopedPathOverride> common_desktop_override_;
scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_;
scoped_ptr<base::ScopedPathOverride> default_user_quick_launch_override_;
scoped_ptr<base::ScopedPathOverride> start_menu_override_; scoped_ptr<base::ScopedPathOverride> start_menu_override_;
scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; scoped_ptr<base::ScopedPathOverride> common_start_menu_override_;
...@@ -209,7 +201,6 @@ class InstallShortcutTest : public testing::Test { ...@@ -209,7 +201,6 @@ class InstallShortcutTest : public testing::Test {
base::FilePath user_quick_launch_shortcut_; base::FilePath user_quick_launch_shortcut_;
base::FilePath user_start_menu_shortcut_; base::FilePath user_start_menu_shortcut_;
base::FilePath system_desktop_shortcut_; base::FilePath system_desktop_shortcut_;
base::FilePath system_quick_launch_shortcut_;
base::FilePath system_start_menu_shortcut_; base::FilePath system_start_menu_shortcut_;
base::FilePath user_alternate_desktop_shortcut_; base::FilePath user_alternate_desktop_shortcut_;
}; };
...@@ -264,16 +255,17 @@ TEST_F(InstallShortcutTest, CreateAllShortcuts) { ...@@ -264,16 +255,17 @@ TEST_F(InstallShortcutTest, CreateAllShortcuts) {
expected_start_menu_properties_); expected_start_menu_properties_);
} }
// Disabled failing test; http://crbug.com/329239. TEST_F(InstallShortcutTest, CreateAllShortcutsSystemLevel) {
TEST_F(InstallShortcutTest, DISABLED_CreateAllShortcutsSystemLevel) {
installer::CreateOrUpdateShortcuts( installer::CreateOrUpdateShortcuts(
chrome_exe_, *product_, *prefs_, installer::ALL_USERS, chrome_exe_, *product_, *prefs_, installer::ALL_USERS,
installer::INSTALL_SHORTCUT_CREATE_ALL); installer::INSTALL_SHORTCUT_CREATE_ALL);
base::win::ValidateShortcut(system_desktop_shortcut_, expected_properties_); base::win::ValidateShortcut(system_desktop_shortcut_, expected_properties_);
base::win::ValidateShortcut(system_quick_launch_shortcut_,
expected_properties_);
base::win::ValidateShortcut(system_start_menu_shortcut_, base::win::ValidateShortcut(system_start_menu_shortcut_,
expected_start_menu_properties_); expected_start_menu_properties_);
// The quick launch shortcut is always created per-user for the admin running
// the install (other users will get it via Active Setup).
base::win::ValidateShortcut(user_quick_launch_shortcut_,
expected_properties_);
} }
TEST_F(InstallShortcutTest, CreateAllShortcutsAlternateDesktopName) { TEST_F(InstallShortcutTest, CreateAllShortcutsAlternateDesktopName) {
...@@ -376,9 +368,6 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { ...@@ -376,9 +368,6 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) {
ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
system_desktop_shortcut_, dummy_properties, system_desktop_shortcut_, dummy_properties,
base::win::SHORTCUT_CREATE_ALWAYS)); base::win::SHORTCUT_CREATE_ALWAYS));
ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
system_quick_launch_shortcut_, dummy_properties,
base::win::SHORTCUT_CREATE_ALWAYS));
ASSERT_TRUE(base::CreateDirectory( ASSERT_TRUE(base::CreateDirectory(
system_start_menu_shortcut_.DirName())); system_start_menu_shortcut_.DirName()));
ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
...@@ -389,8 +378,10 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { ...@@ -389,8 +378,10 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) {
chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, chrome_exe_, *product_, *prefs_, installer::CURRENT_USER,
installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL);
ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); ASSERT_FALSE(base::PathExists(user_desktop_shortcut_));
ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_));
ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_));
// There is no system-level quick launch shortcut, so creating the user-level
// one should always succeed.
ASSERT_TRUE(base::PathExists(user_quick_launch_shortcut_));
} }
TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) { TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) {
......
...@@ -1335,6 +1335,13 @@ bool BatchShortcutAction( ...@@ -1335,6 +1335,13 @@ bool BatchShortcutAction(
ShellUtil::ShellChange level, ShellUtil::ShellChange level,
const scoped_refptr<ShellUtil::SharedCancellationFlag>& cancel) { const scoped_refptr<ShellUtil::SharedCancellationFlag>& cancel) {
DCHECK(!shortcut_operation.is_null()); DCHECK(!shortcut_operation.is_null());
// There is no system-level Quick Launch shortcut folder.
if (level == ShellUtil::SYSTEM_LEVEL &&
location == ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH) {
return true;
}
base::FilePath shortcut_folder; base::FilePath shortcut_folder;
if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) { if (!ShellUtil::GetShortcutPath(location, dist, level, &shortcut_folder)) {
LOG(WARNING) << "Cannot find path at location " << location; LOG(WARNING) << "Cannot find path at location " << location;
...@@ -1474,8 +1481,9 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, ...@@ -1474,8 +1481,9 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location,
base::DIR_COMMON_DESKTOP; base::DIR_COMMON_DESKTOP;
break; break;
case SHORTCUT_LOCATION_QUICK_LAUNCH: case SHORTCUT_LOCATION_QUICK_LAUNCH:
dir_key = (level == CURRENT_USER) ? base::DIR_USER_QUICK_LAUNCH : // There is no support for a system-level Quick Launch shortcut.
base::DIR_DEFAULT_USER_QUICK_LAUNCH; DCHECK_EQ(level, CURRENT_USER);
dir_key = base::DIR_USER_QUICK_LAUNCH;
break; break;
case SHORTCUT_LOCATION_START_MENU_ROOT: case SHORTCUT_LOCATION_START_MENU_ROOT:
dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU :
...@@ -1539,7 +1547,11 @@ bool ShellUtil::CreateOrUpdateShortcut( ...@@ -1539,7 +1547,11 @@ bool ShellUtil::CreateOrUpdateShortcut(
base::FilePath user_shortcut_path; base::FilePath user_shortcut_path;
base::FilePath system_shortcut_path; base::FilePath system_shortcut_path;
if (!GetShortcutPath(location, dist, SYSTEM_LEVEL, &system_shortcut_path)) { if (location == SHORTCUT_LOCATION_QUICK_LAUNCH) {
// There is no system-level shortcut for Quick Launch.
DCHECK_EQ(properties.level, CURRENT_USER);
} else if (!GetShortcutPath(
location, dist, SYSTEM_LEVEL, &system_shortcut_path)) {
NOTREACHED(); NOTREACHED();
return false; return false;
} }
...@@ -1554,6 +1566,7 @@ bool ShellUtil::CreateOrUpdateShortcut( ...@@ -1554,6 +1566,7 @@ bool ShellUtil::CreateOrUpdateShortcut(
// Install the system-level shortcut if requested. // Install the system-level shortcut if requested.
chosen_path = &system_shortcut_path; chosen_path = &system_shortcut_path;
} else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL || } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL ||
system_shortcut_path.empty() ||
!base::PathExists(system_shortcut_path)) { !base::PathExists(system_shortcut_path)) {
// Otherwise install the user-level shortcut, unless the system-level // Otherwise install the user-level shortcut, unless the system-level
// variant of this shortcut is present on the machine and |operation| states // variant of this shortcut is present on the machine and |operation| states
......
...@@ -71,9 +71,6 @@ class ShellUtilShortcutTest : public testing::Test { ...@@ -71,9 +71,6 @@ class ShellUtilShortcutTest : public testing::Test {
user_quick_launch_override_.reset( user_quick_launch_override_.reset(
new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH, new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH,
fake_user_quick_launch_.path())); fake_user_quick_launch_.path()));
default_user_quick_launch_override_.reset(
new base::ScopedPathOverride(base::DIR_DEFAULT_USER_QUICK_LAUNCH,
fake_default_user_quick_launch_.path()));
start_menu_override_.reset( start_menu_override_.reset(
new base::ScopedPathOverride(base::DIR_START_MENU, new base::ScopedPathOverride(base::DIR_START_MENU,
fake_start_menu_.path())); fake_start_menu_.path()));
...@@ -104,9 +101,7 @@ class ShellUtilShortcutTest : public testing::Test { ...@@ -104,9 +101,7 @@ class ShellUtilShortcutTest : public testing::Test {
fake_user_desktop_.path() : fake_common_desktop_.path(); fake_user_desktop_.path() : fake_common_desktop_.path();
break; break;
case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH:
expected_path = (properties.level == ShellUtil::CURRENT_USER) ? expected_path = fake_user_quick_launch_.path();
fake_user_quick_launch_.path() :
fake_default_user_quick_launch_.path();
break; break;
case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR:
expected_path = (properties.level == ShellUtil::CURRENT_USER) ? expected_path = (properties.level == ShellUtil::CURRENT_USER) ?
...@@ -195,7 +190,6 @@ class ShellUtilShortcutTest : public testing::Test { ...@@ -195,7 +190,6 @@ class ShellUtilShortcutTest : public testing::Test {
scoped_ptr<base::ScopedPathOverride> user_desktop_override_; scoped_ptr<base::ScopedPathOverride> user_desktop_override_;
scoped_ptr<base::ScopedPathOverride> common_desktop_override_; scoped_ptr<base::ScopedPathOverride> common_desktop_override_;
scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_;
scoped_ptr<base::ScopedPathOverride> default_user_quick_launch_override_;
scoped_ptr<base::ScopedPathOverride> start_menu_override_; scoped_ptr<base::ScopedPathOverride> start_menu_override_;
scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; scoped_ptr<base::ScopedPathOverride> common_start_menu_override_;
...@@ -209,18 +203,19 @@ class ShellUtilShortcutTest : public testing::Test { ...@@ -209,18 +203,19 @@ class ShellUtilShortcutTest : public testing::Test {
TEST_F(ShellUtilShortcutTest, GetShortcutPath) { TEST_F(ShellUtilShortcutTest, GetShortcutPath) {
base::FilePath path; base::FilePath path;
ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
ShellUtil::CURRENT_USER, &path); ShellUtil::CURRENT_USER, &path);
EXPECT_EQ(fake_user_desktop_.path(), path); EXPECT_EQ(fake_user_desktop_.path(), path);
ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
ShellUtil::SYSTEM_LEVEL, &path); ShellUtil::SYSTEM_LEVEL, &path);
EXPECT_EQ(fake_common_desktop_.path(), path); EXPECT_EQ(fake_common_desktop_.path(), path);
ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
ShellUtil::CURRENT_USER, &path); ShellUtil::CURRENT_USER, &path);
EXPECT_EQ(fake_user_quick_launch_.path(), path); EXPECT_EQ(fake_user_quick_launch_.path(), path);
ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
ShellUtil::SYSTEM_LEVEL, &path);
EXPECT_EQ(fake_default_user_quick_launch_.path(), path);
base::string16 start_menu_subfolder = base::string16 start_menu_subfolder =
dist_->GetStartMenuShortcutSubfolder( dist_->GetStartMenuShortcutSubfolder(
BrowserDistribution::SUBFOLDER_CHROME); BrowserDistribution::SUBFOLDER_CHROME);
...@@ -228,6 +223,7 @@ TEST_F(ShellUtilShortcutTest, GetShortcutPath) { ...@@ -228,6 +223,7 @@ TEST_F(ShellUtilShortcutTest, GetShortcutPath) {
dist_, ShellUtil::CURRENT_USER, &path); dist_, ShellUtil::CURRENT_USER, &path);
EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder),
path); path);
ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
dist_, ShellUtil::SYSTEM_LEVEL, &path); dist_, ShellUtil::SYSTEM_LEVEL, &path);
EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder),
...@@ -255,10 +251,10 @@ TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { ...@@ -255,10 +251,10 @@ TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) {
dist_, test_properties_); dist_, test_properties_);
} }
TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) { TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelDesktopShortcut) {
test_properties_.level = ShellUtil::SYSTEM_LEVEL; test_properties_.level = ShellUtil::SYSTEM_LEVEL;
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, ShellUtil::SHORTCUT_LOCATION_DESKTOP,
dist_, test_properties_, dist_, test_properties_,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
...@@ -267,7 +263,7 @@ TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) { ...@@ -267,7 +263,7 @@ TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) {
new_properties.set_description(L"New description"); new_properties.set_description(L"New description");
new_properties.set_arguments(L"--new-arguments"); new_properties.set_arguments(L"--new-arguments");
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, ShellUtil::SHORTCUT_LOCATION_DESKTOP,
dist_, new_properties, dist_, new_properties,
ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING)); ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING));
...@@ -277,7 +273,7 @@ TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) { ...@@ -277,7 +273,7 @@ TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) {
ShellUtil::ShortcutProperties expected_properties(new_properties); ShellUtil::ShortcutProperties expected_properties(new_properties);
expected_properties.set_dual_mode(false); expected_properties.set_dual_mode(false);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
expected_properties); expected_properties);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment