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

Unified Diff: ash/shelf/shelf_model_unittest.cc

Issue 140323010: Ash:Shelf - Cleanup of Alternate Shelf (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ButtonSize and ButtonSpacing moved to shelf_constants Created 6 years, 11 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: ash/shelf/shelf_model_unittest.cc
diff --git a/ash/shelf/shelf_model_unittest.cc b/ash/shelf/shelf_model_unittest.cc
index 7a36d0e835f0527c24d5b9060eeade47a2ca96a5..73b886f1904d86dbd07875bbf0e407a7dd640c8a 100644
--- a/ash/shelf/shelf_model_unittest.cc
+++ b/ash/shelf/shelf_model_unittest.cc
@@ -302,89 +302,6 @@ TEST_F(ShelfModelTest, FirstRunningAppIndexUsingPlatformAppFirst) {
EXPECT_EQ(running_app_index, model_->FirstRunningAppIndex());
}
-// Assertions around where items are added.
-TEST_F(ShelfModelTest, AddIndicesForLegacyShelfLayout) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- ash::switches::kAshDisableAlternateShelfLayout);
-
- // Insert browser short cut at index 0.
- LauncherItem browser_shortcut;
- browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
- int browser_shortcut_index = model_->Add(browser_shortcut);
- EXPECT_EQ(0, browser_shortcut_index);
-
- // platform app items should be after browser shortcut.
- LauncherItem item;
- item.type = TYPE_PLATFORM_APP;
- int platform_app_index1 = model_->Add(item);
- EXPECT_EQ(1, platform_app_index1);
-
- // Add another platform app item, it should follow first.
- int platform_app_index2 = model_->Add(item);
- EXPECT_EQ(2, platform_app_index2);
-
- // APP_SHORTCUT priority is higher than PLATFORM_APP but same as
- // BROWSER_SHORTCUT. So APP_SHORTCUT is located after BROWSER_SHORCUT.
- item.type = TYPE_APP_SHORTCUT;
- int app_shortcut_index1 = model_->Add(item);
- EXPECT_EQ(1, app_shortcut_index1);
-
- item.type = TYPE_APP_SHORTCUT;
- int app_shortcut_index2 = model_->Add(item);
- EXPECT_EQ(2, app_shortcut_index2);
-
- // Check that AddAt() figures out the correct indexes for app shortcuts.
- // APP_SHORTCUT and BROWSER_SHORTCUT has the same weight.
- // So APP_SHORTCUT is located at index 0. And, BROWSER_SHORTCUT is located at
- // index 1.
- item.type = TYPE_APP_SHORTCUT;
- int app_shortcut_index3 = model_->AddAt(0, item);
- EXPECT_EQ(0, app_shortcut_index3);
-
- item.type = TYPE_APP_SHORTCUT;
- int app_shortcut_index4 = model_->AddAt(5, item);
- EXPECT_EQ(4, app_shortcut_index4);
-
- item.type = TYPE_APP_SHORTCUT;
- int app_shortcut_index5 = model_->AddAt(2, item);
- EXPECT_EQ(2, app_shortcut_index5);
-
- // Before there are any panels, no icons should be right aligned.
- EXPECT_EQ(model_->item_count(), model_->FirstPanelIndex());
-
- // Check that AddAt() figures out the correct indexes for platform apps and
- // panels.
- item.type = TYPE_PLATFORM_APP;
- int platform_app_index3 = model_->AddAt(2, item);
- EXPECT_EQ(6, platform_app_index3);
-
- item.type = TYPE_APP_PANEL;
- int app_panel_index1 = model_->AddAt(2, item);
- EXPECT_EQ(10, app_panel_index1);
-
- item.type = TYPE_PLATFORM_APP;
- int platform_app_index4 = model_->AddAt(11, item);
- EXPECT_EQ(9, platform_app_index4);
-
- item.type = TYPE_APP_PANEL;
- int app_panel_index2 = model_->AddAt(12, item);
- EXPECT_EQ(12, app_panel_index2);
-
- item.type = TYPE_PLATFORM_APP;
- int platform_app_index5 = model_->AddAt(7, item);
- EXPECT_EQ(7, platform_app_index5);
-
- item.type = TYPE_APP_PANEL;
- int app_panel_index3 = model_->AddAt(13, item);
- EXPECT_EQ(13, app_panel_index3);
-
- // Right aligned index should be the first app panel index.
- EXPECT_EQ(12, model_->FirstPanelIndex());
-
- EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model_->items()[1].type);
- EXPECT_EQ(TYPE_APP_LIST, model_->items()[model_->FirstPanelIndex() - 1].type);
-}
-
// Assertions around id generation and usage.
TEST_F(ShelfModelTest, LauncherIDTests) {
// Get the next to use ID counter.
@@ -438,34 +355,4 @@ TEST_F(ShelfModelTest, CorrectMoveItemsWhenStateChange) {
EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type);
}
-TEST_F(ShelfModelTest, CorrectMoveItemsWhenStateChangeForLegacyShelfLayout) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- ash::switches::kAshDisableAlternateShelfLayout);
-
- // The first item is the browser and the second item is app list.
- LauncherItem browser_shortcut;
- browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
- int browser_shortcut_index = model_->Add(browser_shortcut);
- EXPECT_EQ(0, browser_shortcut_index);
- EXPECT_EQ(TYPE_APP_LIST, model_->items()[1].type);
-
- // Add three shortcuts. They should all be moved between the two.
- LauncherItem item;
- item.type = TYPE_APP_SHORTCUT;
- int app1_index = model_->Add(item);
- EXPECT_EQ(1, app1_index);
- int app2_index = model_->Add(item);
- EXPECT_EQ(2, app2_index);
- int app3_index = model_->Add(item);
- EXPECT_EQ(3, app3_index);
-
- // Now change the type of the second item and make sure that it is moving
- // behind the shortcuts.
- item.type = TYPE_PLATFORM_APP;
- model_->Set(app2_index, item);
-
- // The item should have moved in front of the app launcher.
- EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[3].type);
-}
-
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698