Roll src/third_party/skia 0f881c6:b436ed6
[chromium-blink-merge.git] / ash / test / shelf_view_test_api.h
blob7916ea766eea04b9731fa2ac592f4b998a6138e9
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"
11 namespace gfx {
12 class Rect;
13 class Size;
16 namespace ui {
17 class Event;
20 namespace views {
21 class Button;
24 namespace ash {
25 class OverflowBubble;
26 class ShelfButton;
27 class ShelfDelegate;
28 class ShelfView;
30 namespace test {
32 // Use the api in this class to test ShelfView.
33 class ShelfViewTestAPI {
34 public:
35 explicit ShelfViewTestAPI(ShelfView* shelf_view);
36 ~ShelfViewTestAPI();
38 // Number of icons displayed.
39 int GetButtonCount();
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.
76 int GetButtonSize();
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();
99 private:
100 ShelfView* shelf_view_;
102 DISALLOW_COPY_AND_ASSIGN(ShelfViewTestAPI);
105 } // namespace test
106 } // namespace ash
108 #endif // ASH_TEST_SHELF_VIEW_TEST_API_H_