blob: 97aab428da752e447623fbcd341192bbf3f49e00 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/public/cpp/shelf_item.h"
#include "base/macros.h"
namespace gfx {
class Rect;
namespace views {
class View;
namespace ash {
class OverflowBubble;
class OverflowButton;
class ShelfButton;
class ShelfButtonPressedMetricTracker;
class ShelfTooltipManager;
class ShelfView;
// Use the api in this class to test ShelfView.
class ShelfViewTestAPI {
explicit ShelfViewTestAPI(ShelfView* shelf_view);
// Number of icons displayed.
int GetButtonCount();
// Retrieve the button at |index|, doesn't support the app list button,
// because the app list button is not a ShelfButton.
ShelfButton* GetButton(int index);
// Retrieve the view at |index|.
views::View* GetViewAt(int index);
// First visible button index.
int GetFirstVisibleIndex();
// Last visible button index.
int GetLastVisibleIndex();
// Gets current/ideal bounds for button at |index|.
const gfx::Rect& GetBoundsByIndex(int index);
const gfx::Rect& GetIdealBoundsByIndex(int index);
// Returns true if overflow button is visible.
bool IsOverflowButtonVisible();
// Makes shelf view show its overflow bubble.
void ShowOverflowBubble();
// Makes shelf view hide its overflow bubble.
void HideOverflowBubble();
// Returns true if the overflow bubble is visible.
bool IsShowingOverflowBubble() const;
// An accessor for the |bounds_animator_| duration.
int GetAnimationDuration() const;
// Sets animation duration in milliseconds for test.
void SetAnimationDuration(int duration_ms);
// Runs message loop and waits until all add/remove animations are done.
void RunMessageLoopUntilAnimationsDone();
// Close any open app list or context menu; returns true if a menu was closed.
bool CloseMenu();
// An accessor for |shelf_view|.
ShelfView* shelf_view() { return shelf_view_; }
// An accessor for the shelf tooltip manager.
ShelfTooltipManager* tooltip_manager();
// An accessor for overflow bubble.
OverflowBubble* overflow_bubble();
// An accessor for overflow button.
OverflowButton* overflow_button() const;
// Returns minimum distance before drag starts.
int GetMinimumDragDistance() const;
// Wrapper for ShelfView::SameDragType.
bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const;
// Returns re-insertable bounds in screen.
gfx::Rect GetBoundsForDragInsertInScreen();
// Returns true if item is ripped off.
bool IsRippedOffFromShelf();
// Returns true when an item is dragged from one shelf to another (eg.
// overflow).
bool DraggedItemToAnotherShelf();
// An accessor for |shelf_button_pressed_metric_tracker_|.
ShelfButtonPressedMetricTracker* shelf_button_pressed_metric_tracker();
ShelfView* shelf_view_;
} // namespace ash