1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_TEST_SHELF_VIEW_TEST_API_H_
6 #define ASH_TEST_SHELF_VIEW_TEST_API_H_
8 #include "ash/shelf/shelf_item_types.h"
9 #include "base/basictypes.h"
32 // Use the api in this class to test ShelfView.
33 class ShelfViewTestAPI
{
35 explicit ShelfViewTestAPI(ShelfView
* shelf_view
);
38 // Number of icons displayed.
41 // Retrieve the button at |index|.
42 ShelfButton
* GetButton(int index
);
44 // First visible button index.
45 int GetFirstVisibleIndex();
47 // Last visible button index.
48 int GetLastVisibleIndex();
50 // Gets current/ideal bounds for button at |index|.
51 const gfx::Rect
& GetBoundsByIndex(int index
);
52 const gfx::Rect
& GetIdealBoundsByIndex(int index
);
54 // Returns true if overflow button is visible.
55 bool IsOverflowButtonVisible();
57 // Makes shelf view show its overflow bubble.
58 void ShowOverflowBubble();
60 // Sets animation duration in milliseconds for test.
61 void SetAnimationDuration(int duration_ms
);
63 // Runs message loop and waits until all add/remove animations are done.
64 void RunMessageLoopUntilAnimationsDone();
66 // An accessor for |shelf_view|.
67 ShelfView
* shelf_view() { return shelf_view_
; }
69 // An accessor for overflow bubble.
70 OverflowBubble
* overflow_bubble();
72 // Returns the preferred size of |shelf_view_|.
73 gfx::Size
GetPreferredSize();
75 // Returns the button size.
78 // Returns the button space size.
79 int GetButtonSpacing();
81 // Wrapper for ShelfView::ButtonPressed.
82 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
);
84 // Wrapper for ShelfView::SameDragType.
85 bool SameDragType(ShelfItemType typea
, ShelfItemType typeb
) const;
87 // Sets ShelfDelegate.
88 void SetShelfDelegate(ShelfDelegate
* delegate
);
90 // Returns re-insertable bounds in screen.
91 gfx::Rect
GetBoundsForDragInsertInScreen();
93 // Returns true if item is ripped off.
94 bool IsRippedOffFromShelf();
96 // Returns true if an item is ripped off and entered into shelf.
97 bool DraggedItemFromOverflowToShelf();
100 ShelfView
* shelf_view_
;
102 DISALLOW_COPY_AND_ASSIGN(ShelfViewTestAPI
);
108 #endif // ASH_TEST_SHELF_VIEW_TEST_API_H_