Commit 74c26c73 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: Remove more code from the non-scrollable shelf

Bug: 1009638
Change-Id: I6c712d615a113686e137c240bf5435bd20828869
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096565Reviewed-by: default avatarAndrew Xu <andrewxu@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748896}
parent c6fd7f2d
......@@ -39,10 +39,6 @@
namespace ash {
namespace {
bool IsScrollableShelfEnabled() {
return chromeos::switches::ShouldShowScrollableShelf();
}
// Custom window targeter for the hotseat. Used so the hotseat only processes
// events that land on the visible portion of the hotseat, and only while the
// hotseat is not animating.
......@@ -219,9 +215,6 @@ void HotseatWidget::DelegateView::Init(
ui::AnimationMetricsReporter* background_metrics_reporter) {
SetLayoutManager(std::make_unique<views::FillLayout>());
if (!chromeos::switches::ShouldShowScrollableShelf())
return;
WallpaperControllerImpl* wallpaper_controller =
Shell::Get()->wallpaper_controller();
OverviewController* overview_controller = Shell::Get()->overview_controller();
......@@ -317,9 +310,6 @@ bool HotseatWidget::DelegateView::CanActivate() const {
}
void HotseatWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) {
if (!chromeos::switches::ShouldShowScrollableShelf())
return;
views::View::ReorderChildLayers(parent_layer);
parent_layer->StackAtBottom(&translucent_background_);
}
......@@ -375,18 +365,9 @@ void HotseatWidget::Initialize(aura::Window* container, Shelf* shelf) {
set_focus_on_creation(false);
GetFocusManager()->set_arrow_key_traversal_enabled_for_widget(true);
if (IsScrollableShelfEnabled()) {
scrollable_shelf_view_ = GetContentsView()->AddChildView(
std::make_unique<ScrollableShelfView>(ShelfModel::Get(), shelf));
scrollable_shelf_view_->Init();
} else {
// The shelf view observes the shelf model and creates icons as items are
// added to the model.
shelf_view_ = GetContentsView()->AddChildView(std::make_unique<ShelfView>(
ShelfModel::Get(), shelf, /*drag_and_drop_host=*/nullptr,
/*shelf_button_delegate=*/nullptr));
shelf_view_->Init();
}
traslucent_background_metrics_reporter_ =
std::make_unique<HotseatWidgetBackgroundAnimationMetricsReporter>(
state());
......@@ -418,11 +399,7 @@ bool HotseatWidget::OnNativeWidgetActivationChanged(bool active) {
if (!Widget::OnNativeWidgetActivationChanged(active))
return false;
if (IsScrollableShelfEnabled())
scrollable_shelf_view_->OnFocusRingActivationChanged(active);
else if (active)
GetShelfView()->SetPaneFocusAndFocusDefault();
return true;
}
......@@ -597,13 +574,8 @@ void HotseatWidget::SetFocusCycler(FocusCycler* focus_cycler) {
}
ShelfView* HotseatWidget::GetShelfView() {
if (IsScrollableShelfEnabled()) {
DCHECK(scrollable_shelf_view_);
return scrollable_shelf_view_->shelf_view();
}
DCHECK(shelf_view_);
return shelf_view_;
}
int HotseatWidget::GetHotseatBackgroundBlurForTest() const {
......@@ -625,9 +597,6 @@ void HotseatWidget::SetState(HotseatState state) {
state_ = state;
if (!IsScrollableShelfEnabled())
return;
// If the hotseat is not extended we can use the normal targeting as the
// hidden parts of the hotseat will not block non-shelf items from taking
if (state == HotseatState::kExtended) {
......
......@@ -144,7 +144,6 @@ class ASH_EXPORT HotseatWidget : public ShelfComponent,
// View containing the shelf items within an active user session. Owned by
// the views hierarchy.
ShelfView* shelf_view_ = nullptr;
ScrollableShelfView* scrollable_shelf_view_ = nullptr;
// The contents view of this widget. Contains |shelf_view_| and the background
......
......@@ -1237,7 +1237,6 @@ void ScrollableShelfView::DestroyDragIconProxy() {
}
const bool drag_originated_from_app_list =
chromeos::switches::ShouldShowScrollableShelf() &&
shelf_view_->IsShelfViewHandlingDragAndDrop();
// The drag proxy is the DragImageView created for the DragAndDropHost which
......
......@@ -76,13 +76,8 @@ void ShelfFocusCycler::FocusShelf(bool last_element) {
Shell::Get()->focus_cycler()->FocusWidget(shelf_widget);
} else {
HotseatWidget* hotseat_widget = shelf_->hotseat_widget();
if (chromeos::switches::ShouldShowScrollableShelf()) {
hotseat_widget->scrollable_shelf_view()->set_default_last_focusable_child(
last_element);
} else {
hotseat_widget->GetShelfView()->set_default_last_focusable_child(
last_element);
}
Shell::Get()->focus_cycler()->FocusWidget(hotseat_widget);
}
}
......
......@@ -316,10 +316,6 @@ ShelfView::~ShelfView() {
Shell::Get()->RemoveShellObserver(this);
bounds_animator_->RemoveObserver(this);
model_->RemoveObserver(this);
// Resets the shelf tooltip delegate when the main shelf gets destroyed.
if (!chromeos::switches::ShouldShowScrollableShelf())
shelf_->tooltip()->set_shelf_tooltip_delegate(nullptr);
}
int ShelfView::GetSizeOfAppIcons(int count) {
......@@ -355,12 +351,6 @@ void ShelfView::Init() {
}
// We'll layout when our bounds change.
if (!chromeos::switches::ShouldShowScrollableShelf()) {
// Add the main shelf view as ShelfTooltipDelegate when scrollable shelf
// is not enabled.
shelf_->tooltip()->set_shelf_tooltip_delegate(this);
}
}
gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(const ShelfID& id) {
......@@ -512,11 +502,6 @@ void ShelfView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
// an exception of usage within the scrollable shelf. With scrollable shelf
// (and hotseat), tablet mode transition causes hotseat bounds changes, so
// animating shelf items as well would introduce a lag.
if (shelf_->is_tablet_mode_animation_running() &&
!chromeos::switches::ShouldShowScrollableShelf()) {
AnimateToIdealBounds();
return;
}
BoundsAnimatorDisabler disabler(bounds_animator_.get());
......@@ -541,12 +526,7 @@ void ShelfView::OnMouseEvent(ui::MouseEvent* event) {
switch (event->type()) {
case ui::ET_MOUSEWHEEL:
// The mousewheel event is handled by the ScrollableShelfView, but if the
// scrollable shelf is not active, then we delegate the event to the
// shelf.
if (!chromeos::switches::ShouldShowScrollableShelf())
shelf_->ProcessMouseWheelEvent(event->AsMouseWheelEvent(),
/*from_touchpad=*/false);
// The mousewheel event is handled by the ScrollableShelfView.
break;
case ui::ET_MOUSE_PRESSED:
if (!event->IsOnlyLeftMouseButton()) {
......@@ -576,12 +556,8 @@ void ShelfView::OnMouseEvent(ui::MouseEvent* event) {
}
views::FocusTraversable* ShelfView::GetPaneFocusTraversable() {
// ScrollableShelfView should handles the focus traversal if the flag
// is enabled.
if (chromeos::switches::ShouldShowScrollableShelf())
// ScrollableShelfView should handles the focus traversal.
return nullptr;
return this;
}
const char* ShelfView::GetClassName() const {
......@@ -823,12 +799,10 @@ void ShelfView::CreateDragIconProxyByLocationWithNoAnimation(
drag_image_->GetWidget()->SetVisibilityAnimationTransition(
views::Widget::ANIMATE_NONE);
drag_image_->SetWidgetVisible(true);
if (chromeos::switches::ShouldShowScrollableShelf()) {
// Add a layer in order to ensure the icon properly animates when a drag
// starts from AppsGridView and ends in the Shelf.
drag_image_->SetPaintToLayer();
drag_image_->layer()->SetFillsBoundsOpaquely(false);
}
}
void ShelfView::UpdateDragIconProxy(
......@@ -907,8 +881,6 @@ void ShelfView::CalculateIdealBounds() {
const int button_spacing = ShelfConfig::Get()->button_spacing();
const int separator_index = GetSeparatorIndex();
const AppCenteringStrategy app_centering_strategy =
CalculateAppCenteringStrategy();
// Don't show the separator if it isn't needed, or would appear after all
// visible items.
......@@ -918,39 +890,7 @@ void ShelfView::CalculateIdealBounds() {
int x = shelf()->PrimaryAxisValue(app_icons_layout_offset_, 0);
int y = shelf()->PrimaryAxisValue(0, app_icons_layout_offset_);
// When scrollable shelf is enabled, the padding is handled in
// ScrollableShelfView.
if (!chromeos::switches::ShouldShowScrollableShelf()) {
// Now add the necessary padding to center app icons.
const gfx::Rect display_bounds =
screen_util::GetDisplayBoundsWithShelf(GetWidget()->GetNativeWindow());
const int display_size_primary = shelf()->PrimaryAxisValue(
display_bounds.size().width(), display_bounds.size().height());
const int available_size_for_app_icons = GetAvailableSpaceForAppIcons();
const int icons_size = GetSizeOfAppIcons(number_of_visible_apps());
int padding_for_centering = 0;
if (app_centering_strategy.center_on_screen) {
// This is how far the first icon needs to be from the screen edge.
padding_for_centering = (display_size_primary - icons_size) / 2;
// Let's see how far this view is from the edge of this display to
// compute how much extra padding is needed.
gfx::Point origin = gfx::Point(0, 0);
views::View::ConvertPointToScreen(this, &origin);
padding_for_centering -= shelf_->IsHorizontalAlignment()
? (origin.x() - display_bounds.x())
: (origin.y() - display_bounds.y());
} else {
padding_for_centering = (available_size_for_app_icons - icons_size) / 2;
}
if (padding_for_centering > 0) {
x = shelf()->PrimaryAxisValue(padding_for_centering, 0);
y = shelf()->PrimaryAxisValue(0, padding_for_centering);
}
}
// The padding is handled in ScrollableShelfView.
for (int i = 0; i < view_model()->view_size(); ++i) {
const int button_size = ShelfConfig::Get()->button_size();
......@@ -1033,65 +973,6 @@ int ShelfView::GetSeparatorIndex() const {
return -1;
}
ShelfView::AppCenteringStrategy ShelfView::CalculateAppCenteringStrategy() {
AppCenteringStrategy strategy;
// When the scrollable shelf is enabled, overflow mode is disabled. Meanwhile,
// centering padding is calculated in ScrollableShelfView, which means that
// |center_on_screen| is always false.
if (chromeos::switches::ShouldShowScrollableShelf())
return strategy;
// There are two possibilities. Either all the apps fit when centered
// on the whole screen width, in which case we do that. Or, when space
// becomes a little tight (which happens especially when the status area
// is wider because of extra panels), we center apps on the available space.
const int total_available_size = shelf()->PrimaryAxisValue(width(), height());
StatusAreaWidget* status_widget = shelf_widget()->status_area_widget();
const int status_widget_size =
status_widget ? shelf()->PrimaryAxisValue(
status_widget->GetWindowBoundsInScreen().width(),
status_widget->GetWindowBoundsInScreen().height())
: 0;
const int screen_size = total_available_size + status_widget_size;
// An easy way to check whether the apps fit at the exact center of the
// screen is to imagine that we have another status widget on the other
// side (the status widget is always bigger than the home button plus
// the back button if applicable) and see if the apps can fit in the middle.
int available_space_for_screen_centering =
screen_size -
2 * (status_widget_size + ShelfConfig::Get()->app_icon_group_margin());
if (GetSizeOfAppIcons(view_model()->view_size()) <
available_space_for_screen_centering) {
// Everything fits in the center of the screen.
last_visible_index_ = view_model()->view_size() - 1;
strategy.center_on_screen = true;
return strategy;
}
const int available_size_for_app_icons = GetAvailableSpaceForAppIcons();
last_visible_index_ = -1;
// We know that replacing the last app that fits with the overflow button
// will not change the outcome, so we ignore that case for now.
while (last_visible_index() < view_model()->view_size() - 1) {
if (GetSizeOfAppIcons(last_visible_index() + 2) <=
available_size_for_app_icons) {
last_visible_index_++;
} else {
strategy.overflow = true;
// Make space for the overflow button by showing one fewer app icon. If
// we already don't have enough space, don't decrement the last visible
// index further than -1.
last_visible_index_ = std::max(-1, last_visible_index_ - 1);
break;
}
}
return strategy;
}
void ShelfView::DestroyDragIconProxy() {
drag_image_.reset();
drag_image_offset_ = gfx::Vector2d(0, 0);
......@@ -1192,13 +1073,11 @@ void ShelfView::EndDrag(bool cancel) {
} else if (drag_and_drop_view) {
std::unique_ptr<gfx::AnimationDelegate> animation_delegate;
if (chromeos::switches::ShouldShowScrollableShelf()) {
// Resets the dragged view's opacity at the end of drag. Otherwise, if
// the app is already pinned on shelf before drag starts, the dragged view
// will be invisible when drag ends.
animation_delegate = std::make_unique<StartFadeAnimationDelegate>(
this, drag_and_drop_view);
}
animation_delegate =
std::make_unique<StartFadeAnimationDelegate>(this, drag_and_drop_view);
if (cancel) {
// When a hosted drag gets canceled, the item can remain in the same slot
......@@ -1296,7 +1175,6 @@ void ShelfView::PointerReleasedOnButton(views::View* view,
if (drag_pointer_ != NONE)
return;
if (chromeos::switches::ShouldShowScrollableShelf())
drag_and_drop_host_->DestroyDragIconProxy();
// If the drag pointer is NONE, no drag operation is going on and the
......@@ -1320,10 +1198,7 @@ bool ShelfView::IsItemPinned(const ShelfItem& item) const {
}
void ShelfView::OnTabletModeChanged() {
// For scrollable shelf, the layout change will happen as part of shelf config
// update.
if (!chromeos::switches::ShouldShowScrollableShelf())
OnBoundsChanged(GetBoundsInScreen());
// The layout change will happen as part of shelf config update.
}
void ShelfView::AnimateToIdealBounds() {
......@@ -1375,12 +1250,10 @@ void ShelfView::PrepareForDrag(Pointer pointer, const ui::LocatedEvent& event) {
drag_view_->OnDragStarted(&event);
if (chromeos::switches::ShouldShowScrollableShelf()) {
drag_view_->layer()->SetOpacity(0.0f);
drag_and_drop_host_->CreateDragIconProxyByLocationWithNoAnimation(
event.root_location(), drag_view_->GetImage(), drag_view_,
/*scale_factor=*/1.0f, /*blur_radius=*/0);
}
}
void ShelfView::ContinueDrag(const ui::LocatedEvent& event) {
......@@ -1408,10 +1281,8 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) {
ConvertPointToTarget(drag_view_, this, &drag_point);
MoveDragViewTo(shelf_->PrimaryAxisValue(drag_point.x() - drag_origin_.x(),
drag_point.y() - drag_origin_.y()));
if (chromeos::switches::ShouldShowScrollableShelf()) {
drag_and_drop_host_->UpdateDragIconProxy(drag_point_in_screen -
drag_origin_.OffsetFromOrigin());
}
}
void ShelfView::MoveDragViewTo(int primary_axis_coordinate) {
......@@ -1496,12 +1367,9 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
// If the shelf/overflow bubble bounds contains |screen_location| we insert
// the item back into the shelf.
if (GetBoundsForDragInsertInScreen().Contains(screen_location)) {
if (chromeos::switches::ShouldShowScrollableShelf()) {
drag_and_drop_host_->CreateDragIconProxyByLocationWithNoAnimation(
event.root_location(), drag_view_->GetImage(), drag_image_.get(),
/*scale_factor=*/1.0f, /*blur_radius=*/0);
}
// Destroy our proxy view item.
DestroyDragIconProxy();
......@@ -1509,9 +1377,6 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
// the move as in any normal case.
dragged_off_shelf_ = false;
if (!chromeos::switches::ShouldShowScrollableShelf())
drag_view_->layer()->SetOpacity(1.0f);
return false;
}
// Move our proxy view item.
......@@ -1525,27 +1390,20 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
bool dragged_off_shelf = delta > kRipOffDistance;
if (dragged_off_shelf) {
// When scrollable shelf is enabled, replaces a proxy icon provided by
// drag_and_drop_host_ - keep cursor position consistent with the host
// provided icon, and disable visibility animations (to prevent the proxy
// icon from lingering on when replaced with the icon provided by host).
const bool animate_proxy_visibility =
!chromeos::switches::ShouldShowScrollableShelf();
// Replaces a proxy icon provided by drag_and_drop_host_ - keep cursor
// position consistent with the host provided icon, and disable
// visibility animations (to prevent the proxy icon from lingering on
// when replaced with the icon provided by the host).
const gfx::Point center = drag_view_->GetLocalBounds().CenterPoint();
const gfx::Vector2d cursor_offset_from_center =
chromeos::switches::ShouldShowScrollableShelf() ? drag_origin_ - center
: gfx::Vector2d();
const gfx::Vector2d cursor_offset_from_center = drag_origin_ - center;
// Create a proxy view item which can be moved anywhere.
CreateDragIconProxy(event.root_location(), drag_view_->GetImage(),
drag_view_, cursor_offset_from_center,
kDragAndDropProxyScale, animate_proxy_visibility);
kDragAndDropProxyScale, /*animate_visibility=*/false);
dragged_off_shelf_ = true;
if (chromeos::switches::ShouldShowScrollableShelf())
drag_and_drop_host_->DestroyDragIconProxy();
else
drag_view_->layer()->SetOpacity(0.0f);
if (RemovableByRipOff(current_index) == REMOVABLE) {
// Move the item to the back and hide it. ShelfItemMoved() callback will
......@@ -1679,14 +1537,12 @@ std::pair<int, int> ShelfView::GetDragRange(int index) {
void ShelfView::OnFadeInAnimationEnded() {
// Call PreferredSizeChanged() to notify container to re-layout at the end
// of fade-in animation.
if (chromeos::switches::ShouldShowScrollableShelf())
PreferredSizeChanged();
}
void ShelfView::OnFadeOutAnimationEnded() {
// Call PreferredSizeChanged() to notify container to re-layout at the end
// of removal animation.
if (chromeos::switches::ShouldShowScrollableShelf())
PreferredSizeChanged();
AnimateToIdealBounds();
......@@ -1895,7 +1751,6 @@ void ShelfView::ShelfItemRemoved(int model_index, const ShelfItem& old_item) {
shelf_->tooltip()->Close();
if (view->GetVisible() && view->layer()->opacity() > 0.0f) {
if (chromeos::switches::ShouldShowScrollableShelf())
UpdateVisibleIndices();
// The first animation fades out the view. When done we'll animate the rest
......@@ -1914,7 +1769,6 @@ void ShelfView::ShelfItemRemoved(int model_index, const ShelfItem& old_item) {
// If there is no fade out animation, notify the parent view of the
// changed size before bounds animations start.
if (chromeos::switches::ShouldShowScrollableShelf())
PreferredSizeChanged();
// We don't need to show a fade out animation for invisible |view|. When an
......@@ -2157,8 +2011,6 @@ void ShelfView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) {
// Do not call PreferredSizeChanged() so that container does not re-layout
// during the bounds animation.
if (!chromeos::switches::ShouldShowScrollableShelf())
PreferredSizeChanged();
}
void ShelfView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
......@@ -2248,8 +2100,6 @@ base::string16 ShelfView::GetTitleForChildView(const views::View* view) const {
}
void ShelfView::UpdateVisibleIndices() {
DCHECK_EQ(true, chromeos::switches::ShouldShowScrollableShelf());
// When the scrollable shelf is enabled, ShelfView's |last_visible_index_| is
// always the index to the last shelf item.
first_visible_index_ = view_model()->view_size() == 0 ? -1 : 0;
......
......@@ -317,11 +317,6 @@ class ASH_EXPORT ShelfView : public views::AccessiblePaneView,
NOT_REMOVABLE, // Item is fixed and can never be removed.
};
struct AppCenteringStrategy {
bool center_on_screen = false;
bool overflow = false;
};
// Minimum distance before drag starts.
static const int kMinimumDragDistance;
......@@ -348,11 +343,6 @@ class ASH_EXPORT ShelfView : public views::AccessiblePaneView,
// or -1 if no separator is required.
int GetSeparatorIndex() const;
// This method determines which centering strategy is adequate, returns that,
// and sets the |first_visible_index_| and |last_visible_index_| fields
// appropriately.
AppCenteringStrategy CalculateAppCenteringStrategy();
// Sets the bounds of each view to its ideal bounds.
void LayoutToIdealBounds();
......
......@@ -302,25 +302,6 @@ TEST_F(ShelfObserverIconTest, AddRemoveWithMultipleDisplays) {
second_observer.Reset();
}
TEST_F(ShelfObserverIconTest, BoundsChanged) {
// When scrollable shelf enabled, the shelf view's bounds are calculated in
// scrollable shelf and may remain unchanged when shelf widget's bounds are
// changed.
// TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
if (chromeos::switches::ShouldShowScrollableShelf())
return;
views::Widget* widget =
GetPrimaryShelf()->GetShelfViewForTesting()->GetWidget();
gfx::Rect shelf_bounds = widget->GetWindowBoundsInScreen();
shelf_bounds.set_width(shelf_bounds.width() / 2);
ASSERT_GT(shelf_bounds.width(), 0);
widget->SetBounds(shelf_bounds);
// No animation happens for ShelfView bounds change.
EXPECT_TRUE(observer()->icon_positions_changed());
observer()->Reset();
}
////////////////////////////////////////////////////////////////////////////////
// ShelfView tests.
......@@ -1195,49 +1176,6 @@ TEST_F(ShelfViewTest, ShouldHideTooltipWithAppListWindowTest) {
shelf_view_->GetMirroredXInView(center_point.x()), center_point.y())));
}
// Test that by moving the mouse cursor off the button onto the bubble it closes
// the bubble.
TEST_P(HotseatShelfViewTest, ShouldHideTooltipWhenHoveringOnTooltip) {
if (chromeos::switches::ShouldShowShelfHotseat() ||
chromeos::switches::ShouldShowScrollableShelf()) {
return;
}
ShelfTooltipManager* tooltip_manager = test_api_->tooltip_manager();
tooltip_manager->set_timer_delay_for_test(0);
ui::test::EventGenerator* generator = GetEventGenerator();
// Move the mouse off any item and check that no tooltip is shown.
generator->MoveMouseTo(gfx::Point(0, 0));
EXPECT_FALSE(tooltip_manager->IsVisible());
// Move the mouse over the button and check that it is visible.
views::View* button = shelf_view_->first_visible_button_for_testing();
gfx::Rect bounds = button->GetBoundsInScreen();
generator->MoveMouseTo(bounds.CenterPoint());
// Wait for the timer to go off.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(tooltip_manager->IsVisible());
// Move the mouse cursor slightly to the right of the item. The tooltip should
// now close.
generator->MoveMouseBy(bounds.width() / 2 + 5, 0);
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(tooltip_manager->IsVisible());
// Move back - it should appear again.
generator->MoveMouseBy(-(bounds.width() / 2 + 5), 0);
// Make sure there is no delayed close.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(tooltip_manager->IsVisible());
// Now move the mouse cursor slightly above the item - so that it is over the
// tooltip bubble. Now it should disappear.
generator->MoveMouseBy(0, -(bounds.height() / 2 + 5));
// Wait until the delayed close kicked in.
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(tooltip_manager->IsVisible());
}
// Checks the rip an item off from left aligned shelf in secondary monitor.
TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) {
UpdateDisplay("800x600,800x600");
......@@ -1362,14 +1300,12 @@ TEST_F(ShelfViewTest, TestShelfItemsAnimations) {
observer.Reset();
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
test_api_->RunMessageLoopUntilAnimationsDone();
EXPECT_EQ((chromeos::switches::ShouldShowScrollableShelf() ? 1 : 100),
observer.icon_positions_animation_duration().InMilliseconds());
EXPECT_EQ(1, observer.icon_positions_animation_duration().InMilliseconds());
observer.Reset();
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false);
test_api_->RunMessageLoopUntilAnimationsDone();
EXPECT_EQ((chromeos::switches::ShouldShowScrollableShelf() ? 1 : 100),
observer.icon_positions_animation_duration().InMilliseconds());
EXPECT_EQ(1, observer.icon_positions_animation_duration().InMilliseconds());
// The shelf items should not animate if we are entering or exiting tablet
// mode, and the shelf alignment is not bottom aligned.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment