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"
24 // Use the api in this class to test ShelfView.
25 class ShelfViewTestAPI {
27 explicit ShelfViewTestAPI(ShelfView* shelf_view);
30 // Number of icons displayed.
33 // Retrieve the button at |index|.
34 ShelfButton* GetButton(int index);
36 // First visible button index.
37 int GetFirstVisibleIndex();
39 // Last visible button index.
40 int GetLastVisibleIndex();
42 // Gets current/ideal bounds for button at |index|.
43 const gfx::Rect& GetBoundsByIndex(int index);
44 const gfx::Rect& GetIdealBoundsByIndex(int index);
46 // Returns true if overflow button is visible.
47 bool IsOverflowButtonVisible();
49 // Makes shelf view show its overflow bubble.
50 void ShowOverflowBubble();
52 // Sets animation duration in milliseconds for test.
53 void SetAnimationDuration(int duration_ms);
55 // Runs message loop and waits until all add/remove animations are done.
56 void RunMessageLoopUntilAnimationsDone();
58 // An accessor for |shelf_view|.
59 ShelfView* shelf_view() { return shelf_view_; }
61 // An accessor for overflow bubble.
62 OverflowBubble* overflow_bubble();
64 // Returns the preferred size of |shelf_view_|.
65 gfx::Size GetPreferredSize();
67 // Returns the button size.
70 // Returns the button space size.
71 int GetButtonSpacing();
73 // Wrapper for ShelfView::SameDragType.
74 bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const;
76 // Sets ShelfDelegate.
77 void SetShelfDelegate(ShelfDelegate* delegate);
79 // Returns re-insertable bounds in screen.
80 gfx::Rect GetBoundsForDragInsertInScreen();
82 // Returns true if item is ripped off.
83 bool IsRippedOffFromShelf();
85 // Returns true if an item is ripped off and entered into shelf.
86 bool DraggedItemFromOverflowToShelf();
89 ShelfView* shelf_view_;
91 DISALLOW_COPY_AND_ASSIGN(ShelfViewTestAPI);
97 #endif // ASH_TEST_SHELF_VIEW_TEST_API_H_