Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc |
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc |
index ea3861f90553a44d80aa1382140e4b393e3a69be..f8e29af39b7b534879c129b44915e2a98aea0226 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc |
@@ -230,6 +230,13 @@ class ChromeLauncherControllerPerAppTest : public BrowserWithTestWindowTest { |
launcher_controller_->SetAppIconLoaderForTest(loader); |
} |
+ // Set the index at which the chrome icon should be. |
+ void SetShelfChromeIconIndex(int index) { |
+ profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex, |
+ index + 1); |
+ } |
+ |
+ |
void InsertPrefValue(base::ListValue* pref_value, |
int index, |
const std::string& extension_id) { |
@@ -307,35 +314,29 @@ class ChromeLauncherControllerPerAppTest : public BrowserWithTestWindowTest { |
}; |
// The testing framework to test the alternate shelf layout. |
-class AlternateLayoutChromeLauncherControllerPerAppTest |
+class LegacyShelfLayoutChromeLauncherControllerPerAppTest |
: public ChromeLauncherControllerPerAppTest { |
protected: |
- AlternateLayoutChromeLauncherControllerPerAppTest() { |
+ LegacyShelfLayoutChromeLauncherControllerPerAppTest() { |
} |
- virtual ~AlternateLayoutChromeLauncherControllerPerAppTest() { |
+ virtual ~LegacyShelfLayoutChromeLauncherControllerPerAppTest() { |
} |
// Overwrite the Setup function to add the Alternate Shelf layout option. |
virtual void SetUp() OVERRIDE { |
CommandLine::ForCurrentProcess()->AppendSwitch( |
- ash::switches::kAshUseAlternateShelfLayout); |
+ ash::switches::kAshDisableAlternateShelfLayout); |
ChromeLauncherControllerPerAppTest::SetUp(); |
} |
- // Set the index at which the chrome icon should be. |
- void SetShelfChromeIconIndex(int index) { |
- profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex, |
- index + 1); |
- } |
- |
private: |
- DISALLOW_COPY_AND_ASSIGN(AlternateLayoutChromeLauncherControllerPerAppTest); |
+ DISALLOW_COPY_AND_ASSIGN(LegacyShelfLayoutChromeLauncherControllerPerAppTest); |
}; |
-TEST_F(ChromeLauncherControllerPerAppTest, DefaultApps) { |
+TEST_F(LegacyShelfLayoutChromeLauncherControllerPerAppTest, DefaultApps) { |
InitLauncherController(); |
// Model should only contain the browser shortcut and app list items. |
EXPECT_EQ(2, model_->item_count()); |
@@ -354,7 +355,8 @@ TEST_F(ChromeLauncherControllerPerAppTest, DefaultApps) { |
// 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(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsReverseOrder) { |
+TEST_F(LegacyShelfLayoutChromeLauncherControllerPerAppTest, |
+ RestoreDefaultAppsReverseOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
@@ -393,7 +395,8 @@ TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsReverseOrder) { |
// 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(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsRandomOrder) { |
+TEST_F(LegacyShelfLayoutChromeLauncherControllerPerAppTest, |
+ RestoreDefaultAppsRandomOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
@@ -431,7 +434,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsRandomOrder) { |
// 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(ChromeLauncherControllerPerAppTest, |
+TEST_F(LegacyShelfLayoutChromeLauncherControllerPerAppTest, |
RestoreDefaultAppsRandomOrderChromeMoved) { |
InitLauncherController(); |
@@ -470,7 +473,8 @@ TEST_F(ChromeLauncherControllerPerAppTest, |
} |
// Check that syncing to a different state does the correct thing. |
-TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsResyncOrder) { |
+TEST_F(LegacyShelfLayoutChromeLauncherControllerPerAppTest, |
+ RestoreDefaultAppsResyncOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
InsertPrefValue(&policy_value, 0, extension1_->id()); |
@@ -505,7 +509,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsResyncOrder) { |
EXPECT_EQ("App2, Chrome, App3, App1, AppList, ", GetPinnedAppStatus()); |
} |
-TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, DefaultApps) { |
+TEST_F(ChromeLauncherControllerPerAppTest, DefaultApps) { |
InitLauncherController(); |
// Model should only contain the browser shortcut and app list items. |
EXPECT_EQ(2, model_->item_count()); |
@@ -524,8 +528,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, DefaultApps) { |
// 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(AlternateLayoutChromeLauncherControllerPerAppTest, |
- RestoreDefaultAppsReverseOrder) { |
+TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsReverseOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
@@ -564,8 +567,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, |
// 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(AlternateLayoutChromeLauncherControllerPerAppTest, |
- RestoreDefaultAppsRandomOrder) { |
+TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsRandomOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
@@ -603,7 +605,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, |
// 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 - using the alternate shelf layout. |
-TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, |
+TEST_F(ChromeLauncherControllerPerAppTest, |
RestoreDefaultAppsRandomOrderChromeMoved) { |
InitLauncherController(); |
@@ -642,8 +644,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, |
// Check that syncing to a different state does the correct thing with the |
// alternate shelf layout. |
-TEST_F(AlternateLayoutChromeLauncherControllerPerAppTest, |
- RestoreDefaultAppsResyncOrder) { |
+TEST_F(ChromeLauncherControllerPerAppTest, RestoreDefaultAppsResyncOrder) { |
InitLauncherController(); |
base::ListValue policy_value; |
InsertPrefValue(&policy_value, 0, extension1_->id()); |
@@ -718,7 +719,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckLockApps) { |
launcher_controller_->LockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
@@ -737,7 +738,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckLockApps) { |
} |
// Check that multiple locks of an application will be properly handled. |
-TEST_F(ChromeLauncherControllerPerAppTest, CheckMukltiLockApps) { |
+TEST_F(ChromeLauncherControllerPerAppTest, CheckMultiLockApps) { |
InitLauncherController(); |
// Model should only contain the browser shortcut and app list items. |
EXPECT_EQ(2, model_->item_count()); |
@@ -749,7 +750,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckMukltiLockApps) { |
launcher_controller_->LockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher( |
extension1_->id())); |
@@ -758,7 +759,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckMukltiLockApps) { |
launcher_controller_->UnlockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -787,7 +788,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckAlreadyPinnedLockApps) { |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -795,7 +796,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckAlreadyPinnedLockApps) { |
launcher_controller_->LockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -803,7 +804,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckAlreadyPinnedLockApps) { |
launcher_controller_->UnlockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -825,7 +826,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckPinnedAppsStayAfterUnlock) { |
launcher_controller_->PinAppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -833,7 +834,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckPinnedAppsStayAfterUnlock) { |
launcher_controller_->LockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -841,7 +842,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckPinnedAppsStayAfterUnlock) { |
launcher_controller_->UnpinAppsWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -862,14 +863,14 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckLockPinUnlockUnpin) { |
launcher_controller_->LockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
launcher_controller_->PinAppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -877,7 +878,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, CheckLockPinUnlockUnpin) { |
launcher_controller_->UnlockV1AppWithID(extension1_->id()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE( |
launcher_controller_->IsWindowedAppInLauncher(extension1_->id())); |
@@ -902,7 +903,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, Policy) { |
// take effect when the policy override is in place. |
InitLauncherController(); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
@@ -910,8 +911,8 @@ TEST_F(ChromeLauncherControllerPerAppTest, Policy) { |
// Installing |extension2_| should add it to the launcher. |
extension_service_->AddExtension(extension2_.get()); |
EXPECT_EQ(4, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[3].type); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |
@@ -921,7 +922,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, Policy) { |
profile()->GetTestingPrefService()->SetManagedPref(prefs::kPinnedLauncherApps, |
policy_value.DeepCopy()); |
EXPECT_EQ(3, model_->item_count()); |
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type); |
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); |
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); |
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); |