Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc |
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc |
index e104fc12cc7f448b9da5e68cee7806eb0c3fadcb..5033de334f560ccd0cf1297da68cc92b80230923 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc |
@@ -616,27 +616,6 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { |
DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest); |
}; |
-// The testing framework to test the legacy shelf layout. |
-class LegacyShelfLayoutChromeLauncherControllerTest |
- : public ChromeLauncherControllerTest { |
- protected: |
- LegacyShelfLayoutChromeLauncherControllerTest() { |
- } |
- |
- virtual ~LegacyShelfLayoutChromeLauncherControllerTest() { |
- } |
- |
- // Overwrite the Setup function to use the legacy shelf layout option. |
- virtual void SetUp() OVERRIDE { |
- CommandLine::ForCurrentProcess()->AppendSwitch( |
- ash::switches::kAshDisableAlternateShelfLayout); |
- ChromeLauncherControllerTest::SetUp(); |
- } |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(LegacyShelfLayoutChromeLauncherControllerTest); |
-}; |
- |
#if defined(OS_CHROMEOS) |
// A browser window proxy which is able to associate an aura native window with |
// it. |
@@ -972,179 +951,9 @@ class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest |
}; |
#endif // defined(OS_CHROMEOS) |
-TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, DefaultApps) { |
- InitLauncherController(); |
- // Model should only contain the browser shortcut and app list items. |
- EXPECT_EQ(2, model_->item_count()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- |
- // Installing |extension3_| should add it to the launcher - behind the |
- // chrome icon. |
- extension_service_->AddExtension(extension3_.get()); |
- EXPECT_EQ("Chrome, App3, AppList", GetPinnedAppStatus()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
-} |
- |
-// Check that the restauration of launcher items is happening in the same order |
-// as the user has pinned them (on another system) when they are synced reverse |
-// order. |
-TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, |
- RestoreDefaultAppsReverseOrder) { |
- InitLauncherController(); |
- |
- base::ListValue policy_value; |
- InsertPrefValue(&policy_value, 0, extension1_->id()); |
- InsertPrefValue(&policy_value, 1, extension2_->id()); |
- InsertPrefValue(&policy_value, 2, extension3_->id()); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value.DeepCopy()); |
- EXPECT_EQ(0, profile()->GetPrefs()->GetInteger(prefs::kShelfChromeIconIndex)); |
- // Model should only contain the browser shortcut and app list items. |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension3_| should add it to the shelf - behind the |
- // chrome icon. |
- ash::ShelfItem item; |
- extension_service_->AddExtension(extension3_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
- EXPECT_EQ("Chrome, App3, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension2_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension2_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_EQ("Chrome, App2, App3, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension1_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension1_.get()); |
- EXPECT_EQ("Chrome, App1, App2, App3, AppList", GetPinnedAppStatus()); |
-} |
- |
-// Check that the restauration of launcher items is happening in the same order |
-// as the user has pinned them (on another system) when they are synced random |
-// order. |
-TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, |
- RestoreDefaultAppsRandomOrder) { |
- InitLauncherController(); |
- |
- base::ListValue policy_value; |
- InsertPrefValue(&policy_value, 0, extension1_->id()); |
- InsertPrefValue(&policy_value, 1, extension2_->id()); |
- InsertPrefValue(&policy_value, 2, extension3_->id()); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value.DeepCopy()); |
- EXPECT_EQ(0, profile()->GetPrefs()->GetInteger(prefs::kShelfChromeIconIndex)); |
- // Model should only contain the browser shortcut and app list items. |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension2_| should add it to the launcher - behind the |
- // chrome icon. |
- extension_service_->AddExtension(extension2_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, App2, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension1_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension1_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, App1, App2, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension3_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension3_.get()); |
- EXPECT_EQ("Chrome, App1, App2, App3, AppList", GetPinnedAppStatus()); |
-} |
- |
// Check that the restauration of launcher items is happening in the same order |
// as the user has pinned / moved them (on another system) when they are synced |
// random order - including the chrome icon. |
-TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, |
- RestoreDefaultAppsRandomOrderChromeMoved) { |
- InitLauncherController(); |
- |
- base::ListValue policy_value; |
- InsertPrefValue(&policy_value, 0, extension1_->id()); |
- InsertPrefValue(&policy_value, 1, extension2_->id()); |
- InsertPrefValue(&policy_value, 2, extension3_->id()); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value.DeepCopy()); |
- profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex, |
- 1); |
- // Model should only contain the browser shortcut and app list items. |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension2_| should add it to the shelf - behind the |
- // chrome icon. |
- ash::ShelfItem item; |
- extension_service_->AddExtension(extension2_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("Chrome, App2, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension1_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension1_.get()); |
- EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
- EXPECT_EQ("App1, Chrome, App2, AppList", GetPinnedAppStatus()); |
- |
- // Installing |extension3_| should add it to the launcher - behind the |
- // chrome icon, but in first location. |
- extension_service_->AddExtension(extension3_.get()); |
- EXPECT_EQ("App1, Chrome, App2, App3, AppList", GetPinnedAppStatus()); |
-} |
- |
-// Check that syncing to a different state does the correct thing. |
-TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, |
- RestoreDefaultAppsResyncOrder) { |
- InitLauncherController(); |
- base::ListValue policy_value; |
- InsertPrefValue(&policy_value, 0, extension1_->id()); |
- InsertPrefValue(&policy_value, 1, extension2_->id()); |
- InsertPrefValue(&policy_value, 2, extension3_->id()); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value.DeepCopy()); |
- EXPECT_EQ(0, profile()->GetPrefs()->GetInteger(prefs::kShelfChromeIconIndex)); |
- extension_service_->AddExtension(extension2_.get()); |
- extension_service_->AddExtension(extension1_.get()); |
- extension_service_->AddExtension(extension3_.get()); |
- EXPECT_EQ("Chrome, App1, App2, App3, AppList", GetPinnedAppStatus()); |
- |
- // Change the order with increasing chrome position and decreasing position. |
- base::ListValue policy_value1; |
- InsertPrefValue(&policy_value1, 0, extension3_->id()); |
- InsertPrefValue(&policy_value1, 1, extension1_->id()); |
- InsertPrefValue(&policy_value1, 2, extension2_->id()); |
- profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex, |
- 2); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value1.DeepCopy()); |
- EXPECT_EQ("App3, App1, Chrome, App2, AppList", GetPinnedAppStatus()); |
- base::ListValue policy_value2; |
- InsertPrefValue(&policy_value2, 0, extension2_->id()); |
- InsertPrefValue(&policy_value2, 1, extension3_->id()); |
- InsertPrefValue(&policy_value2, 2, extension1_->id()); |
- profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex, |
- 1); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value2.DeepCopy()); |
- EXPECT_EQ("App2, Chrome, App3, App1, AppList", GetPinnedAppStatus()); |
-} |
- |
TEST_F(ChromeLauncherControllerTest, DefaultApps) { |
InitLauncherController(); |
// Model should only contain the browser shortcut and app list items. |
@@ -1161,29 +970,6 @@ TEST_F(ChromeLauncherControllerTest, DefaultApps) { |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
} |
-// Check that changing from the alternate shelf layout to the old shelflayout |
-// and back does keep the app launcher at location #0. |
-TEST_F(ChromeLauncherControllerTest, |
- SwitchingFromAlternateShelfLayoutToLegacyAndBack) { |
- InitLauncherController(); |
- |
- // We simulate this problem by intentionally placing the app list item in |
- // the middle of several apps which caused a crash (see crbug.com/329597). |
- const char kAppShelfIdPlaceholder[] = "AppShelfIDPlaceholder--------"; |
- |
- base::ListValue policy_value; |
- InsertPrefValue(&policy_value, 0, extension1_->id()); |
- InsertPrefValue(&policy_value, 1, kAppShelfIdPlaceholder); |
- InsertPrefValue(&policy_value, 2, extension2_->id()); |
- profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
- policy_value.DeepCopy()); |
- EXPECT_EQ(0, profile()->GetPrefs()->GetInteger(prefs::kShelfChromeIconIndex)); |
- // Model should only contain the browser shortcut and app list items. |
- extension_service_->AddExtension(extension1_.get()); |
- extension_service_->AddExtension(extension2_.get()); |
- EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); |
-} |
- |
// Check that the restauration of launcher items is happening in the same order |
// as the user has pinned them (on another system) when they are synced reverse |
// order. |