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.
test_api_->RunMessageLoopUntilAnimationsDone();
}
- internal::ShelfButton* GetButtonByID(ShelfID id) {
+ ShelfButton* GetButtonByID(ShelfID id) {
int index = model_->ItemIndexByID(id);
return test_api_->GetButton(index);
}
}
}
- views::View* SimulateButtonPressed(
- internal::ShelfButtonHost::Pointer pointer,
- int button_index) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ views::View* SimulateButtonPressed(ShelfButtonHost::Pointer pointer,
+ int button_index) {
+ ShelfButtonHost* button_host = shelf_view_;
views::View* button = test_api_->GetButton(button_index);
ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED,
button->bounds().origin(),
return button;
}
- views::View* SimulateClick(internal::ShelfButtonHost::Pointer pointer,
+ views::View* SimulateClick(ShelfButtonHost::Pointer pointer,
int button_index) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ ShelfButtonHost* button_host = shelf_view_;
views::View* button = SimulateButtonPressed(pointer, button_index);
- button_host->PointerReleasedOnButton(button,
- internal::ShelfButtonHost::MOUSE,
- false);
+ button_host->PointerReleasedOnButton(button, ShelfButtonHost::MOUSE, false);
return button;
}
- views::View* SimulateDrag(internal::ShelfButtonHost::Pointer pointer,
+ views::View* SimulateDrag(ShelfButtonHost::Pointer pointer,
int button_index,
int destination_index) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ ShelfButtonHost* button_host = shelf_view_;
views::View* button = SimulateButtonPressed(pointer, button_index);
// Drag.
std::vector<std::pair<ShelfID, views::View*> >* id_map) {
// Initialize |id_map| with the automatically-created shelf buttons.
for (size_t i = 0; i < model_->items().size(); ++i) {
- internal::ShelfButton* button = test_api_->GetButton(i);
+ ShelfButton* button = test_api_->GetButton(i);
id_map->push_back(std::make_pair(model_->items()[i].id, button));
}
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map));
int drag_item_index =
test_api_for_overflow.GetLastVisibleIndex();
ShelfID drag_item_id = GetItemId(drag_item_index);
- internal::ShelfButton* drag_button =
- test_api_for_overflow.GetButton(drag_item_index);
+ ShelfButton* drag_button = test_api_for_overflow.GetButton(drag_item_index);
gfx::Point center_point_of_drag_item =
drag_button->GetBoundsInScreen().CenterPoint();
}
ShelfModel* model_;
- internal::ShelfView* shelf_view_;
+ ShelfView* shelf_view_;
int browser_index_;
ShelfItemDelegateManager* item_manager_;
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)
// in both LTR and RTL.
TEST_P(ShelfViewTextDirectionTest, IdealBoundsOfItemIcon) {
ShelfID id = AddPlatformApp();
- internal::ShelfButton* button = GetButtonByID(id);
+ ShelfButton* button = GetButtonByID(id);
gfx::Rect item_bounds = button->GetBoundsInScreen();
gfx::Point icon_offset = button->GetIconBounds().origin();
item_bounds.Offset(icon_offset.OffsetFromOrigin());
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);
-
-
- ShelfID browser_button_id = AddPlatformApp();
-
- // Add app shortcut until overflow.
- int items_added = 0;
- ShelfID 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(),
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;
- ShelfID first_added = AddPlatformApp();
- EXPECT_TRUE(GetButtonByID(first_added)->visible());
- ShelfID last_visible = first_added;
- while (true) {
- ShelfID added = AddPlatformApp();
- if (test_api_->IsOverflowButtonVisible()) {
- EXPECT_FALSE(GetButtonByID(added)->visible());
- break;
- }
- last_visible = added;
- ++items_added;
- ASSERT_LT(items_added, 10000);
- }
-
- ShelfID 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) {
// Verifies non-overflow buttons are visible.
for (int i = 0; i <= test_api_->GetLastVisibleIndex(); ++i) {
- internal::ShelfButton* button = test_api_->GetButton(i);
+ ShelfButton* button = test_api_->GetButton(i);
if (button) {
EXPECT_TRUE(button->visible()) << "button index=" << i;
EXPECT_EQ(1.0f, button->layer()->opacity()) << "button index=" << i;
// Check that model changes are handled correctly while a shelf icon is being
// dragged.
TEST_F(ShelfViewTest, ModelChangesWhileDragging) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ ShelfButtonHost* button_host = shelf_view_;
std::vector<std::pair<ShelfID, views::View*> > id_map;
SetupForDragTest(&id_map);
// Dragging browser shortcut at index 1.
EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT);
- views::View* dragged_button = SimulateDrag(
- internal::ShelfButtonHost::MOUSE, 1, 3);
+ views::View* dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
std::rotate(id_map.begin() + 1,
id_map.begin() + 2,
id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
- button_host->PointerReleasedOnButton(dragged_button,
- internal::ShelfButtonHost::MOUSE,
- false);
+ button_host->PointerReleasedOnButton(
+ dragged_button, ShelfButtonHost::MOUSE, false);
EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT);
// Dragging changes model order.
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3);
+ dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
std::rotate(id_map.begin() + 1,
id_map.begin() + 2,
id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Cancelling the drag operation restores previous order.
- button_host->PointerReleasedOnButton(dragged_button,
- internal::ShelfButtonHost::MOUSE,
- true);
+ button_host->PointerReleasedOnButton(
+ dragged_button, ShelfButtonHost::MOUSE, true);
std::rotate(id_map.begin() + 1,
id_map.begin() + 3,
id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Deleting an item keeps the remaining intact.
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3);
+ dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
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);
+ button_host->PointerReleasedOnButton(
+ dragged_button, ShelfButtonHost::MOUSE, false);
// Adding a shelf item cancels the drag and respects the order.
- dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3);
+ dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
ShelfID new_id = AddAppShortcut();
id_map.insert(id_map.begin() + 6,
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, 1, 3);
- 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);
-}
-
-TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) {
- internal::ShelfButtonHost* button_host = shelf_view_;
-
- std::vector<std::pair<ShelfID, 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);
- ShelfID 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);
+ button_host->PointerReleasedOnButton(
+ dragged_button, 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);
+ dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
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);
+ button_host->PointerReleasedOnButton(
+ dragged_button, ShelfButtonHost::MOUSE, false);
}
// Check that 2nd drag from the other pointer would be ignored.
TEST_F(ShelfViewTest, SimultaneousDrag) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ ShelfButtonHost* button_host = shelf_view_;
std::vector<std::pair<ShelfID, views::View*> > id_map;
SetupForDragTest(&id_map);
// Start a mouse drag.
- views::View* dragged_button_mouse = SimulateDrag(
- internal::ShelfButtonHost::MOUSE, 1, 3);
+ views::View* dragged_button_mouse =
+ SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
std::rotate(id_map.begin() + 1,
id_map.begin() + 2,
id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Attempt a touch drag before the mouse drag finishes.
- views::View* dragged_button_touch = SimulateDrag(
- internal::ShelfButtonHost::TOUCH, 4, 2);
+ views::View* dragged_button_touch =
+ SimulateDrag(ShelfButtonHost::TOUCH, 4, 2);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Finish the mouse drag.
- button_host->PointerReleasedOnButton(dragged_button_mouse,
- internal::ShelfButtonHost::MOUSE,
- false);
+ button_host->PointerReleasedOnButton(
+ dragged_button_mouse, ShelfButtonHost::MOUSE, false);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Now start a touch drag.
- dragged_button_touch = SimulateDrag(internal::ShelfButtonHost::TOUCH, 4, 2);
+ dragged_button_touch = SimulateDrag(ShelfButtonHost::TOUCH, 4, 2);
std::rotate(id_map.begin() + 3,
id_map.begin() + 4,
id_map.begin() + 5);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// And attempt a mouse drag before the touch drag finishes.
- dragged_button_mouse = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 2);
+ dragged_button_mouse = SimulateDrag(ShelfButtonHost::MOUSE, 1, 2);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
- button_host->PointerReleasedOnButton(dragged_button_touch,
- internal::ShelfButtonHost::TOUCH,
- false);
+ button_host->PointerReleasedOnButton(
+ dragged_button_touch, ShelfButtonHost::TOUCH, false);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
}
// Check that clicking first on one item and then dragging another works as
// expected.
TEST_F(ShelfViewTest, ClickOneDragAnother) {
- internal::ShelfButtonHost* button_host = shelf_view_;
+ ShelfButtonHost* button_host = shelf_view_;
std::vector<std::pair<ShelfID, views::View*> > id_map;
SetupForDragTest(&id_map);
// A click on item 1 is simulated.
- SimulateClick(internal::ShelfButtonHost::MOUSE, 1);
+ SimulateClick(ShelfButtonHost::MOUSE, 1);
// Dragging browser index at 0 should change the model order correctly.
EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT);
- views::View* dragged_button = SimulateDrag(
- internal::ShelfButtonHost::MOUSE, 1, 3);
+ views::View* dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
std::rotate(id_map.begin() + 1,
id_map.begin() + 2,
id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
- button_host->PointerReleasedOnButton(dragged_button,
- internal::ShelfButtonHost::MOUSE,
- false);
+ button_host->PointerReleasedOnButton(
+ dragged_button, ShelfButtonHost::MOUSE, false);
EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT);
}
ShelfID last_added = AddPlatformApp();
ShelfItem item = GetItemByID(last_added);
int index = model_->ItemIndexByID(last_added);
- internal::ShelfButton* button = GetButtonByID(last_added);
- ASSERT_EQ(internal::ShelfButton::STATE_RUNNING, button->state());
+ ShelfButton* button = GetButtonByID(last_added);
+ ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state());
item.status = STATUS_ACTIVE;
model_->Set(index, item);
- ASSERT_EQ(internal::ShelfButton::STATE_ACTIVE, button->state());
+ ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state());
item.status = STATUS_ATTENTION;
model_->Set(index, item);
- 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.
- ShelfID item1_id = AddPlatformApp();
- ShelfID 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);
+ ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state());
}
// Confirm that item status changes are reflected in the buttons
ShelfID last_added = AddPlatformApp();
ShelfItem item = GetItemByID(last_added);
int index = model_->ItemIndexByID(last_added);
- internal::ShelfButton* button = GetButtonByID(last_added);
- ASSERT_EQ(internal::ShelfButton::STATE_RUNNING, button->state());
+ ShelfButton* button = GetButtonByID(last_added);
+ ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state());
item.status = STATUS_ACTIVE;
model_->Set(index, item);
- ASSERT_EQ(internal::ShelfButton::STATE_ACTIVE, button->state());
+ ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state());
item.status = STATUS_ATTENTION;
model_->Set(index, item);
- ASSERT_EQ(internal::ShelfButton::STATE_ATTENTION, button->state());
+ ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state());
}
// Confirm that shelf item bounds are correctly updated on shelf changes.
ShelfID app_button_id = AddAppShortcut();
ShelfID platform_button_id = AddPlatformApp();
- internal::ShelfButton* app_button = GetButtonByID(app_button_id);
- internal::ShelfButton* platform_button = GetButtonByID(platform_button_id);
+ ShelfButton* app_button = GetButtonByID(app_button_id);
+ ShelfButton* platform_button = GetButtonByID(platform_button_id);
- internal::ShelfButtonHost* button_host = shelf_view_;
- internal::ShelfTooltipManager* tooltip_manager =
- shelf_view_->tooltip_manager();
+ ShelfButtonHost* button_host = shelf_view_;
+ ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager();
button_host->MouseEnteredButton(app_button);
// There's a delay to show the tooltip, so it's not visible yet.
// Verify a fix for crash caused by a tooltip update for a deletedshelf
// button, see crbug.com/288838.
TEST_F(ShelfViewTest, RemovingItemClosesTooltip) {
- internal::ShelfButtonHost* button_host = shelf_view_;
- internal::ShelfTooltipManager* tooltip_manager =
- shelf_view_->tooltip_manager();
+ ShelfButtonHost* button_host = shelf_view_;
+ ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager();
// Add an item to the shelf.
ShelfID app_button_id = AddAppShortcut();
- internal::ShelfButton* app_button = GetButtonByID(app_button_id);
+ ShelfButton* app_button = GetButtonByID(app_button_id);
// Spawn a tooltip on that item.
button_host->MouseEnteredButton(app_button);
// Changing the shelf alignment closes any open tooltip.
TEST_F(ShelfViewTest, ShelfAlignmentClosesTooltip) {
- internal::ShelfButtonHost* button_host = shelf_view_;
- internal::ShelfTooltipManager* tooltip_manager =
- shelf_view_->tooltip_manager();
+ ShelfButtonHost* button_host = shelf_view_;
+ ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager();
// Add an item to the shelf.
ShelfID app_button_id = AddAppShortcut();
- internal::ShelfButton* app_button = GetButtonByID(app_button_id);
+ ShelfButton* app_button = GetButtonByID(app_button_id);
// Spawn a tooltip on the item.
button_host->MouseEnteredButton(app_button);
// The tooltip shouldn't hide if the mouse is on normal buttons.
for (int i = 0; i < test_api_->GetButtonCount(); i++) {
- internal::ShelfButton* button = test_api_->GetButton(i);
+ ShelfButton* button = test_api_->GetButton(i);
if (!button)
continue;
// The tooltip should hide if it's outside of all buttons.
gfx::Rect all_area;
for (int i = 0; i < test_api_->GetButtonCount(); i++) {
- internal::ShelfButton* button = test_api_->GetButton(i);
+ ShelfButton* button = test_api_->GetButton(i);
if (!button)
continue;
// The tooltip shouldn't hide if the mouse is on normal buttons.
for (int i = 1; i < test_api_->GetButtonCount(); i++) {
- internal::ShelfButton* button = test_api_->GetButton(i);
+ ShelfButton* button = test_api_->GetButton(i);
if (!button)
continue;
// Test that by moving the mouse cursor off the button onto the bubble it closes
// the bubble.
TEST_F(ShelfViewTest, ShouldHideTooltipWhenHoveringOnTooltip) {
- internal::ShelfTooltipManager* tooltip_manager =
- shelf_view_->tooltip_manager();
+ ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager();
tooltip_manager->CreateZeroDelayTimerForTest();
aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
// 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());
aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
gfx::Point());
- internal::ShelfButton* button =
- test_for_overflow_view.GetButton(ripped_index);
+ ShelfButton* button = test_for_overflow_view.GetButton(ripped_index);
// Rip off the last visible item.
gfx::Point start_point = button->GetBoundsInScreen().CenterPoint();
gfx::Point rip_off_point(start_point.x(), 0);
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");
int item_width = test_api_->GetButtonSize() +
test_api_->GetButtonSpacing();
- internal::OverflowBubbleView* bubble_view =
- test_api_->overflow_bubble()->bubble_view();
+ OverflowBubbleView* bubble_view = test_api_->overflow_bubble()->bubble_view();
test::OverflowBubbleViewTestAPI bubble_view_api(bubble_view);
// Add more buttons until OverflowBubble is scrollable and it has 3 invisible
int first_index = test_for_overflow_view.GetFirstVisibleIndex();
int last_index = test_for_overflow_view.GetLastVisibleIndex();
- internal::ShelfButton* first_button =
- test_for_overflow_view.GetButton(first_index);
- internal::ShelfButton* last_button =
- test_for_overflow_view.GetButton(last_index);
+ ShelfButton* first_button = test_for_overflow_view.GetButton(first_index);
+ ShelfButton* last_button = test_for_overflow_view.GetButton(last_index);
gfx::Point first_point = first_button->GetBoundsInScreen().CenterPoint();
gfx::Point last_point = last_button->GetBoundsInScreen().CenterPoint();
gfx::Rect drag_reinsert_bounds =
UpdateDisplay("800x600,800x600");
Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]);
- internal::ShelfView* shelf_view_for_secondary =
+ ShelfView* shelf_view_for_secondary =
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.
ShelfViewTestAPI test_api_for_overflow_view(
test_api_->overflow_bubble()->shelf_view());
- internal::ShelfButton* button = test_api_for_overflow_view.GetButton(
+ ShelfButton* button = test_api_for_overflow_view.GetButton(
test_api_for_overflow_view.GetLastVisibleIndex());
// Checks that a point in shelf is contained in drag insert bounds.
ShelfViewTestAPI test_api_for_overflow_view_of_secondary(
test_api_for_secondary.overflow_bubble()->shelf_view());
- internal::ShelfButton* button_in_secondary =
+ ShelfButton* button_in_secondary =
test_api_for_overflow_view_of_secondary.GetButton(
test_api_for_overflow_view_of_secondary.GetLastVisibleIndex());
EXPECT_GT(browser_index, 0);
Shelf* secondary_shelf = Shelf::ForWindow(second_root);
- internal::ShelfView* shelf_view_for_secondary =
+ ShelfView* shelf_view_for_secondary =
ShelfTestAPI(secondary_shelf).shelf_view();
ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary);
- internal::ShelfButton* button =
- test_api_for_secondary_shelf_view.GetButton(browser_index);
+ ShelfButton* button =
+ test_api_for_secondary_shelf_view.GetButton(browser_index);
// Fetch the start point of dragging.
gfx::Point start_point = button->GetBoundsInScreen().CenterPoint();
gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen();
EXPECT_TRUE(shelf_bounds.Contains(visible_bounds));
for (int i = 0; i < test_api_->GetButtonCount(); ++i)
- if (internal::ShelfButton* button = test_api_->GetButton(i))
+ if (ShelfButton* button = test_api_->GetButton(i))
EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen()));
CheckAppListButtonIsInBounds();
}