OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_TEST_SHELF_VIEW_TEST_API_H_ | 5 #ifndef ASH_TEST_SHELF_VIEW_TEST_API_H_ |
6 #define ASH_TEST_SHELF_VIEW_TEST_API_H_ | 6 #define ASH_TEST_SHELF_VIEW_TEST_API_H_ |
7 | 7 |
8 #include "ash/shelf/shelf_item_types.h" | 8 #include "ash/shelf/shelf_item_types.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 class Rect; | 12 class Rect; |
13 class Size; | 13 class Size; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 | |
18 class ShelfDelegate; | |
19 | |
20 namespace internal { | |
21 class OverflowBubble; | 17 class OverflowBubble; |
22 class ShelfButton; | 18 class ShelfButton; |
| 19 class ShelfDelegate; |
23 class ShelfView; | 20 class ShelfView; |
24 } | |
25 | 21 |
26 namespace test { | 22 namespace test { |
27 | 23 |
28 // Use the api in this class to test ShelfView. | 24 // Use the api in this class to test ShelfView. |
29 class ShelfViewTestAPI { | 25 class ShelfViewTestAPI { |
30 public: | 26 public: |
31 explicit ShelfViewTestAPI(internal::ShelfView* shelf_view); | 27 explicit ShelfViewTestAPI(ShelfView* shelf_view); |
32 ~ShelfViewTestAPI(); | 28 ~ShelfViewTestAPI(); |
33 | 29 |
34 // Number of icons displayed. | 30 // Number of icons displayed. |
35 int GetButtonCount(); | 31 int GetButtonCount(); |
36 | 32 |
37 // Retrieve the button at |index|. | 33 // Retrieve the button at |index|. |
38 internal::ShelfButton* GetButton(int index); | 34 ShelfButton* GetButton(int index); |
39 | 35 |
40 // First visible button index. | 36 // First visible button index. |
41 int GetFirstVisibleIndex(); | 37 int GetFirstVisibleIndex(); |
42 | 38 |
43 // Last visible button index. | 39 // Last visible button index. |
44 int GetLastVisibleIndex(); | 40 int GetLastVisibleIndex(); |
45 | 41 |
46 // Gets current/ideal bounds for button at |index|. | 42 // Gets current/ideal bounds for button at |index|. |
47 const gfx::Rect& GetBoundsByIndex(int index); | 43 const gfx::Rect& GetBoundsByIndex(int index); |
48 const gfx::Rect& GetIdealBoundsByIndex(int index); | 44 const gfx::Rect& GetIdealBoundsByIndex(int index); |
49 | 45 |
50 // Returns true if overflow button is visible. | 46 // Returns true if overflow button is visible. |
51 bool IsOverflowButtonVisible(); | 47 bool IsOverflowButtonVisible(); |
52 | 48 |
53 // Makes shelf view show its overflow bubble. | 49 // Makes shelf view show its overflow bubble. |
54 void ShowOverflowBubble(); | 50 void ShowOverflowBubble(); |
55 | 51 |
56 // Sets animation duration in milliseconds for test. | 52 // Sets animation duration in milliseconds for test. |
57 void SetAnimationDuration(int duration_ms); | 53 void SetAnimationDuration(int duration_ms); |
58 | 54 |
59 // Runs message loop and waits until all add/remove animations are done. | 55 // Runs message loop and waits until all add/remove animations are done. |
60 void RunMessageLoopUntilAnimationsDone(); | 56 void RunMessageLoopUntilAnimationsDone(); |
61 | 57 |
62 // An accessor for |shelf_view|. | 58 // An accessor for |shelf_view|. |
63 internal::ShelfView* shelf_view() { return shelf_view_; } | 59 ShelfView* shelf_view() { return shelf_view_; } |
64 | 60 |
65 // An accessor for overflow bubble. | 61 // An accessor for overflow bubble. |
66 internal::OverflowBubble* overflow_bubble(); | 62 OverflowBubble* overflow_bubble(); |
67 | 63 |
68 // Returns the preferred size of |shelf_view_|. | 64 // Returns the preferred size of |shelf_view_|. |
69 gfx::Size GetPreferredSize(); | 65 gfx::Size GetPreferredSize(); |
70 | 66 |
71 // Returns the button size. | 67 // Returns the button size. |
72 int GetButtonSize(); | 68 int GetButtonSize(); |
73 | 69 |
74 // Returns the button space size. | 70 // Returns the button space size. |
75 int GetButtonSpacing(); | 71 int GetButtonSpacing(); |
76 | 72 |
77 // Wrapper for ShelfView::SameDragType. | 73 // Wrapper for ShelfView::SameDragType. |
78 bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const; | 74 bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const; |
79 | 75 |
80 // Sets ShelfDelegate. | 76 // Sets ShelfDelegate. |
81 void SetShelfDelegate(ShelfDelegate* delegate); | 77 void SetShelfDelegate(ShelfDelegate* delegate); |
82 | 78 |
83 // Returns re-insertable bounds in screen. | 79 // Returns re-insertable bounds in screen. |
84 gfx::Rect GetBoundsForDragInsertInScreen(); | 80 gfx::Rect GetBoundsForDragInsertInScreen(); |
85 | 81 |
86 // Returns true if item is ripped off. | 82 // Returns true if item is ripped off. |
87 bool IsRippedOffFromShelf(); | 83 bool IsRippedOffFromShelf(); |
88 | 84 |
89 // Returns true if an item is ripped off and entered into shelf. | 85 // Returns true if an item is ripped off and entered into shelf. |
90 bool DraggedItemFromOverflowToShelf(); | 86 bool DraggedItemFromOverflowToShelf(); |
91 | 87 |
92 private: | 88 private: |
93 internal::ShelfView* shelf_view_; | 89 ShelfView* shelf_view_; |
94 | 90 |
95 DISALLOW_COPY_AND_ASSIGN(ShelfViewTestAPI); | 91 DISALLOW_COPY_AND_ASSIGN(ShelfViewTestAPI); |
96 }; | 92 }; |
97 | 93 |
98 } // namespace test | 94 } // namespace test |
99 } // namespace ash | 95 } // namespace ash |
100 | 96 |
101 #endif // ASH_TEST_SHELF_VIEW_TEST_API_H_ | 97 #endif // ASH_TEST_SHELF_VIEW_TEST_API_H_ |
OLD | NEW |