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

Unified Diff: chrome/browser/shell_integration_win_unittest.cc

Issue 14027008: Migrate app_host.exe shortcuts to chrome.exe shortcuts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
Index: chrome/browser/shell_integration_win_unittest.cc
diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc
index 04b600d01aff02218c765fcedda398d4e803cfa6..a63b54e0bef6fa09e65a13fb27885be99868f5c2 100644
--- a/chrome/browser/shell_integration_win_unittest.cc
+++ b/chrome/browser/shell_integration_win_unittest.cc
@@ -33,11 +33,23 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test {
// This doesn't need to actually have a base name of "chrome.exe".
file_util::CreateTemporaryFileInDir(temp_dir_.path(), &chrome_exe_);
+ file_util::CreateTemporaryFileInDir(temp_dir_.path(), &app_host_exe_);
chrome_app_id_ =
ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(),
true);
+ base::FilePath default_user_data_dir;
+ chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
+ base::FilePath default_profile_path =
+ default_user_data_dir.AppendASCII(chrome::kInitialProfile);
+ app_list_app_id_ =
+ ShellIntegration::GetAppListAppModelIdForProfile(default_profile_path);
+ non_default_profile_ = string16(L"NonDefault");
+ non_default_chrome_app_id_ =
+ ShellIntegration::GetChromiumModelIdForProfile(
+ default_user_data_dir.Append(non_default_profile_));
+
// A temporary object to pass properties to AddTestShortcut().
base::win::ShortcutProperties temp_properties;
@@ -89,6 +101,24 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test {
base::win::ShortcutProperties no_properties;
no_properties.set_target(chrome_exe_);
ASSERT_NO_FATAL_FAILURE(AddTestShortcut(no_properties));
+
+ // Shortcut 7 tests that a non-default profile directory gets a non-default
koz (OOO until 15th September) 2013/04/18 02:06:08 nit: the above comments describe the shortcut, as
calamity 2013/04/18 08:24:34 Done.
+ // app id.
+ temp_properties.set_target(chrome_exe_);
+ temp_properties.set_app_id(L"Dumbo");
+ temp_properties.set_arguments(
+ string16(L"--profile-directory=") + non_default_profile_);
+ temp_properties.set_dual_mode(false);
+ ASSERT_NO_FATAL_FAILURE(AddTestShortcut(temp_properties));
+
+ // TODO(calamity): remove this test once app_host.exe is removed
+ // Shortcut 8 tests that app_host.exe shortcuts are migrated to chrome.exe
koz (OOO until 15th September) 2013/04/18 02:06:08 // Shortcut 8 points to app_host.exe and should be
calamity 2013/04/18 08:24:34 Done.
+ // shortcuts.
+ temp_properties.set_target(app_host_exe_);
+ temp_properties.set_app_id(L"SomeAppId");
+ temp_properties.set_arguments(L"--show-app-list");
+ temp_properties.set_dual_mode(false);
+ ASSERT_NO_FATAL_FAILURE(AddTestShortcut(temp_properties));
}
void AddTestShortcut(
@@ -110,6 +140,9 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test {
// The path to a fake chrome.exe.
base::FilePath chrome_exe_;
+ // The path to a fake app_host.exe.
+ base::FilePath app_host_exe_;
+
// Test shortcuts.
std::vector<base::FilePath> shortcuts_;
@@ -118,6 +151,15 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test {
// Chrome's AppUserModelId.
string16 chrome_app_id_;
+
+ // A profile that isn't the Default profile.
+ string16 non_default_profile_;
+
+ // Chrome's AppUserModelId for the non-default profile.
+ string16 non_default_chrome_app_id_;
+
+ // The app launcher's app id.
+ string16 app_list_app_id_;
};
} // namespace
@@ -127,15 +169,19 @@ TEST_F(ShellIntegrationWinMigrateShortcutTest, DontCheckDualMode) {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
- EXPECT_EQ(4,
+ EXPECT_EQ(6,
ShellIntegration::MigrateShortcutsInPathInternal(
- chrome_exe_, temp_dir_.path(), false));
+ chrome_exe_, app_host_exe_, temp_dir_.path(), false, false));
- // Only shortcut 1, 4, 5, and 6 should have been migrated.
+ // Only shortcut 1, 4, 5, 6, 7 and 8 should have been migrated.
shortcuts_properties_[1].set_app_id(chrome_app_id_);
shortcuts_properties_[4].set_app_id(chrome_app_id_);
shortcuts_properties_[5].set_app_id(chrome_app_id_);
shortcuts_properties_[6].set_app_id(chrome_app_id_);
+ shortcuts_properties_[7].set_app_id(non_default_chrome_app_id_);
+ // app_host.exe should now be chrome.exe
+ shortcuts_properties_[8].set_target(chrome_exe_);
+ shortcuts_properties_[8].set_app_id(app_list_app_id_);
for (size_t i = 0; i < shortcuts_.size(); ++i)
base::win::ValidateShortcut(shortcuts_[i], shortcuts_properties_[i]);
@@ -146,23 +192,29 @@ TEST_F(ShellIntegrationWinMigrateShortcutTest, CheckDualMode) {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
- EXPECT_EQ(5,
+ EXPECT_EQ(7,
ShellIntegration::MigrateShortcutsInPathInternal(
- chrome_exe_, temp_dir_.path(), true));
+ chrome_exe_, app_host_exe_, temp_dir_.path(), true, false));
- // Shortcut 1, 4, 5, and 6 should have had both their app_id and dual_mode
- // properties fixed and shortcut 2 should also have had it's dual_mode
- // property fixed.
+ // Shortcut 1, 4, 5, 6, 7 and 8 should have had both their app_id and
+ // dual_mode properties fixed and shortcut 2 should also have had it's
+ // dual_mode property fixed.
shortcuts_properties_[1].set_app_id(chrome_app_id_);
shortcuts_properties_[4].set_app_id(chrome_app_id_);
shortcuts_properties_[5].set_app_id(chrome_app_id_);
shortcuts_properties_[6].set_app_id(chrome_app_id_);
+ shortcuts_properties_[7].set_app_id(non_default_chrome_app_id_);
+ // app_host.exe should now be chrome.exe
+ shortcuts_properties_[8].set_target(chrome_exe_);
+ shortcuts_properties_[8].set_app_id(app_list_app_id_);
shortcuts_properties_[1].set_dual_mode(true);
shortcuts_properties_[2].set_dual_mode(true);
shortcuts_properties_[4].set_dual_mode(true);
shortcuts_properties_[5].set_dual_mode(true);
shortcuts_properties_[6].set_dual_mode(true);
+ shortcuts_properties_[7].set_dual_mode(true);
+ shortcuts_properties_[8].set_dual_mode(true);
for (size_t i = 0; i < shortcuts_.size(); ++i)
base::win::ValidateShortcut(shortcuts_[i], shortcuts_properties_[i]);
« chrome/browser/shell_integration_win.cc ('K') | « chrome/browser/shell_integration_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698