Index: ash/shelf/shelf_view_unittest.cc |
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc |
index 5b99ed159415e9aabc302b50a292fc0dc8bc8696..28f2c0a2f6eb021b3ca01f433c9eb358b2aed5bc 100644 |
--- a/ash/shelf/shelf_view_unittest.cc |
+++ b/ash/shelf/shelf_view_unittest.cc |
@@ -270,8 +270,7 @@ class ShelfViewTest : public AshTestBase { |
shelf_view_ = ShelfTestAPI(shelf).shelf_view(); |
// The bounds should be big enough for 4 buttons + overflow chevron. |
- shelf_view_->SetBounds(0, 0, 500, |
- internal::ShelfLayoutManager::GetPreferredShelfSize()); |
+ shelf_view_->SetBounds(0, 0, 500, kShelfSize); |
test_api_.reset(new ShelfViewTestAPI(shelf_view_)); |
test_api_->SetAnimationDuration(1); // Speeds up animation for test. |
@@ -582,24 +581,6 @@ class ShelfViewTest : public AshTestBase { |
DISALLOW_COPY_AND_ASSIGN(ShelfViewTest); |
}; |
-class ShelfViewLegacyShelfLayoutTest : public ShelfViewTest { |
- public: |
- ShelfViewLegacyShelfLayoutTest() : ShelfViewTest() { |
- browser_index_ = 0; |
- } |
- |
- virtual ~ShelfViewLegacyShelfLayoutTest() {} |
- |
- virtual void SetUp() OVERRIDE { |
- CommandLine::ForCurrentProcess()->AppendSwitch( |
- ash::switches::kAshDisableAlternateShelfLayout); |
- ShelfViewTest::SetUp(); |
- } |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(ShelfViewLegacyShelfLayoutTest); |
-}; |
- |
class ScopedTextDirectionChange { |
public: |
ScopedTextDirectionChange(bool is_rtl) |
@@ -745,33 +726,6 @@ TEST_F(ShelfViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) { |
EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); |
} |
-TEST_F(ShelfViewLegacyShelfLayoutTest, |
- AddAppShortcutWithBrowserButtonUntilOverflow) { |
- // All buttons should be visible. |
- ASSERT_EQ(test_api_->GetButtonCount(), |
- test_api_->GetLastVisibleIndex() + 1); |
- |
- |
- LauncherID browser_button_id = AddPlatformApp(); |
- |
- // Add app shortcut until overflow. |
- int items_added = 0; |
- LauncherID last_added = AddAppShortcut(); |
- while (!test_api_->IsOverflowButtonVisible()) { |
- // Added button is visible after animation while in this loop. |
- EXPECT_TRUE(GetButtonByID(last_added)->visible()); |
- |
- last_added = AddAppShortcut(); |
- ++items_added; |
- ASSERT_LT(items_added, 10000); |
- } |
- |
- // The last added app short button should be visible. |
- EXPECT_TRUE(GetButtonByID(last_added)->visible()); |
- // And the platform app button is invisible. |
- EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); |
-} |
- |
TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) { |
// All buttons should be visible. |
ASSERT_EQ(test_api_->GetButtonCount(), |
@@ -800,36 +754,6 @@ TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) { |
EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); |
} |
-TEST_F(ShelfViewLegacyShelfLayoutTest, AddPanelHidesPlatformAppButton) { |
- // All buttons should be visible. |
- ASSERT_EQ(test_api_->GetButtonCount(), |
- test_api_->GetLastVisibleIndex() + 1); |
- |
- // Add platform app button until overflow, remember last visible platform app |
- // button. |
- int items_added = 0; |
- LauncherID first_added = AddPlatformApp(); |
- EXPECT_TRUE(GetButtonByID(first_added)->visible()); |
- LauncherID last_visible = first_added; |
- while (true) { |
- LauncherID added = AddPlatformApp(); |
- if (test_api_->IsOverflowButtonVisible()) { |
- EXPECT_FALSE(GetButtonByID(added)->visible()); |
- break; |
- } |
- last_visible = added; |
- ++items_added; |
- ASSERT_LT(items_added, 10000); |
- } |
- |
- LauncherID panel = AddPanel(); |
- EXPECT_TRUE(GetButtonByID(panel)->visible()); |
- EXPECT_FALSE(GetButtonByID(last_visible)->visible()); |
- |
- RemoveByID(panel); |
- EXPECT_TRUE(GetButtonByID(last_visible)->visible()); |
-} |
- |
// When there are more panels then platform app buttons we should hide panels |
// rather than platform apps. |
TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) { |
@@ -1022,72 +946,6 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { |
false); |
} |
-TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { |
- internal::ShelfButtonHost* button_host = shelf_view_; |
- |
- std::vector<std::pair<LauncherID, views::View*> > id_map; |
- SetupForDragTest(&id_map); |
- |
- // Dragging browser shortcut at index 0. |
- EXPECT_TRUE(model_->items()[0].type == TYPE_BROWSER_SHORTCUT); |
- views::View* dragged_button = SimulateDrag( |
- internal::ShelfButtonHost::MOUSE, 0, 2); |
- std::rotate(id_map.begin(), |
- id_map.begin() + 1, |
- id_map.begin() + 3); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- button_host->PointerReleasedOnButton(dragged_button, |
- internal::ShelfButtonHost::MOUSE, |
- false); |
- EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT); |
- |
- // Dragging changes model order. |
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); |
- std::rotate(id_map.begin(), |
- id_map.begin() + 1, |
- id_map.begin() + 3); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- |
- // Cancelling the drag operation restores previous order. |
- button_host->PointerReleasedOnButton(dragged_button, |
- internal::ShelfButtonHost::MOUSE, |
- true); |
- std::rotate(id_map.begin(), |
- id_map.begin() + 2, |
- id_map.begin() + 3); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- |
- // Deleting an item keeps the remaining intact. |
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); |
- model_->RemoveItemAt(1); |
- id_map.erase(id_map.begin() + 1); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- button_host->PointerReleasedOnButton(dragged_button, |
- internal::ShelfButtonHost::MOUSE, |
- false); |
- |
- // Adding a shelf item cancels the drag and respects the order. |
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); |
- LauncherID new_id = AddAppShortcut(); |
- id_map.insert(id_map.begin() + 5, |
- std::make_pair(new_id, GetButtonByID(new_id))); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- button_host->PointerReleasedOnButton(dragged_button, |
- internal::ShelfButtonHost::MOUSE, |
- false); |
- |
- // Adding a shelf item at the end (i.e. a panel) canels drag and respects |
- // the order. |
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); |
- new_id = AddPanel(); |
- id_map.insert(id_map.begin() + 7, |
- std::make_pair(new_id, GetButtonByID(new_id))); |
- ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); |
- button_host->PointerReleasedOnButton(dragged_button, |
- internal::ShelfButtonHost::MOUSE, |
- false); |
-} |
- |
// Check that 2nd drag from the other pointer would be ignored. |
TEST_F(ShelfViewTest, SimultaneousDrag) { |
internal::ShelfButtonHost* button_host = shelf_view_; |
@@ -1179,40 +1037,6 @@ TEST_F(ShelfViewTest, ShelfItemStatus) { |
ASSERT_EQ(internal::ShelfButton::STATE_ATTENTION, button->state()); |
} |
-TEST_F(ShelfViewLegacyShelfLayoutTest, |
- ShelfItemPositionReflectedOnStateChanged) { |
- // All buttons should be visible. |
- ASSERT_EQ(test_api_->GetButtonCount(), |
- test_api_->GetLastVisibleIndex() + 1); |
- |
- // Add 2 items to the shelf. |
- LauncherID item1_id = AddPlatformApp(); |
- LauncherID item2_id = AddPlatformAppNoWait(); |
- internal::ShelfButton* item1_button = GetButtonByID(item1_id); |
- internal::ShelfButton* item2_button = GetButtonByID(item2_id); |
- |
- internal::ShelfButton::State state_mask = |
- static_cast<internal::ShelfButton::State>( |
- internal::ShelfButton::STATE_NORMAL | |
- internal::ShelfButton::STATE_HOVERED | |
- internal::ShelfButton::STATE_RUNNING | |
- internal::ShelfButton::STATE_ACTIVE | |
- internal::ShelfButton::STATE_ATTENTION | |
- internal::ShelfButton::STATE_FOCUSED); |
- |
- // Clear the button states. |
- item1_button->ClearState(state_mask); |
- item2_button->ClearState(state_mask); |
- |
- // Since default alignment in tests is bottom, state is reflected in y-axis. |
- ASSERT_EQ(item1_button->GetIconBounds().y(), |
- item2_button->GetIconBounds().y()); |
- item1_button->AddState(internal::ShelfButton::STATE_HOVERED); |
- ASSERT_NE(item1_button->GetIconBounds().y(), |
- item2_button->GetIconBounds().y()); |
- item1_button->ClearState(internal::ShelfButton::STATE_HOVERED); |
-} |
- |
// Confirm that item status changes are reflected in the buttons |
// for platform apps. |
TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) { |
@@ -1474,7 +1298,7 @@ TEST_F(ShelfViewTest, ResizeDuringOverflowAddAnimation) { |
// Resize shelf view with that animation running and stay overflown. |
gfx::Rect bounds = shelf_view_->bounds(); |
- bounds.set_width(bounds.width() - kShelfPreferredSize); |
+ bounds.set_width(bounds.width() - kShelfSize); |
shelf_view_->SetBoundsRect(bounds); |
ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); |
@@ -1547,17 +1371,6 @@ TEST_F(ShelfViewTest, OverflowBubbleSize) { |
test_for_overflow_view.GetPreferredSize().width()); |
} |
-// Check that the first item in the list follows Fitt's law by including the |
-// first pixel and being therefore bigger then the others. |
-TEST_F(ShelfViewLegacyShelfLayoutTest, CheckFittsLaw) { |
- // All buttons should be visible. |
- ASSERT_EQ(test_api_->GetButtonCount(), |
- test_api_->GetLastVisibleIndex() + 1); |
- gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); |
- gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); |
- EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); |
-} |
- |
// Check the drag insertion bounds of scrolled overflow bubble. |
TEST_F(ShelfViewTest, CheckDragInsertBoundsOfScrolledOverflowBubble) { |
UpdateDisplay("400x300"); |
@@ -1624,8 +1437,7 @@ TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { |
ShelfTestAPI(secondary_shelf).shelf_view(); |
// The bounds should be big enough for 4 buttons + overflow chevron. |
- shelf_view_for_secondary->SetBounds(0, 0, 500, |
- internal::ShelfLayoutManager::GetPreferredShelfSize()); |
+ shelf_view_for_secondary->SetBounds(0, 0, 500, kShelfSize); |
ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); |
// Speeds up animation for test. |