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 #include "ash/test/shelf_view_test_api.h" | 5 #include "ash/test/shelf_view_test_api.h" |
6 | 6 |
7 #include "ash/shelf/overflow_button.h" | 7 #include "ash/shelf/overflow_button.h" |
8 #include "ash/shelf/shelf_button.h" | 8 #include "ash/shelf/shelf_button.h" |
9 #include "ash/shelf/shelf_model.h" | 9 #include "ash/shelf/shelf_model.h" |
10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 private: | 30 private: |
31 DISALLOW_COPY_AND_ASSIGN(TestAPIAnimationObserver); | 31 DISALLOW_COPY_AND_ASSIGN(TestAPIAnimationObserver); |
32 }; | 32 }; |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 namespace ash { | 36 namespace ash { |
37 namespace test { | 37 namespace test { |
38 | 38 |
39 ShelfViewTestAPI::ShelfViewTestAPI(internal::ShelfView* shelf_view) | 39 ShelfViewTestAPI::ShelfViewTestAPI(ShelfView* shelf_view) |
40 : shelf_view_(shelf_view) { | 40 : shelf_view_(shelf_view) {} |
41 } | |
42 | 41 |
43 ShelfViewTestAPI::~ShelfViewTestAPI() { | 42 ShelfViewTestAPI::~ShelfViewTestAPI() { |
44 } | 43 } |
45 | 44 |
46 int ShelfViewTestAPI::GetButtonCount() { | 45 int ShelfViewTestAPI::GetButtonCount() { |
47 return shelf_view_->view_model_->view_size(); | 46 return shelf_view_->view_model_->view_size(); |
48 } | 47 } |
49 | 48 |
50 internal::ShelfButton* ShelfViewTestAPI::GetButton(int index) { | 49 ShelfButton* ShelfViewTestAPI::GetButton(int index) { |
51 // App list button is not a ShelfButton. | 50 // App list button is not a ShelfButton. |
52 if (shelf_view_->model_->items()[index].type == ash::TYPE_APP_LIST) | 51 if (shelf_view_->model_->items()[index].type == ash::TYPE_APP_LIST) |
53 return NULL; | 52 return NULL; |
54 | 53 |
55 return static_cast<internal::ShelfButton*>( | 54 return static_cast<ShelfButton*>(shelf_view_->view_model_->view_at(index)); |
56 shelf_view_->view_model_->view_at(index)); | |
57 } | 55 } |
58 | 56 |
59 int ShelfViewTestAPI::GetFirstVisibleIndex() { | 57 int ShelfViewTestAPI::GetFirstVisibleIndex() { |
60 return shelf_view_->first_visible_index_; | 58 return shelf_view_->first_visible_index_; |
61 } | 59 } |
62 | 60 |
63 int ShelfViewTestAPI::GetLastVisibleIndex() { | 61 int ShelfViewTestAPI::GetLastVisibleIndex() { |
64 return shelf_view_->last_visible_index_; | 62 return shelf_view_->last_visible_index_; |
65 } | 63 } |
66 | 64 |
(...skipping 25 matching lines...) Expand all Loading... |
92 scoped_ptr<TestAPIAnimationObserver> observer(new TestAPIAnimationObserver()); | 90 scoped_ptr<TestAPIAnimationObserver> observer(new TestAPIAnimationObserver()); |
93 shelf_view_->bounds_animator_->AddObserver(observer.get()); | 91 shelf_view_->bounds_animator_->AddObserver(observer.get()); |
94 | 92 |
95 // This nested loop will quit when TestAPIAnimationObserver's | 93 // This nested loop will quit when TestAPIAnimationObserver's |
96 // OnBoundsAnimatorDone is called. | 94 // OnBoundsAnimatorDone is called. |
97 base::MessageLoop::current()->Run(); | 95 base::MessageLoop::current()->Run(); |
98 | 96 |
99 shelf_view_->bounds_animator_->RemoveObserver(observer.get()); | 97 shelf_view_->bounds_animator_->RemoveObserver(observer.get()); |
100 } | 98 } |
101 | 99 |
102 internal::OverflowBubble* ShelfViewTestAPI::overflow_bubble() { | 100 OverflowBubble* ShelfViewTestAPI::overflow_bubble() { |
103 return shelf_view_->overflow_bubble_.get(); | 101 return shelf_view_->overflow_bubble_.get(); |
104 } | 102 } |
105 | 103 |
106 gfx::Size ShelfViewTestAPI::GetPreferredSize() { | 104 gfx::Size ShelfViewTestAPI::GetPreferredSize() { |
107 return shelf_view_->GetPreferredSize(); | 105 return shelf_view_->GetPreferredSize(); |
108 } | 106 } |
109 | 107 |
110 int ShelfViewTestAPI::GetButtonSize() { | 108 int ShelfViewTestAPI::GetButtonSize() { |
111 return shelf_view_->GetButtonSize(); | 109 return shelf_view_->GetButtonSize(); |
112 } | 110 } |
(...skipping 18 matching lines...) Expand all Loading... |
131 bool ShelfViewTestAPI::IsRippedOffFromShelf() { | 129 bool ShelfViewTestAPI::IsRippedOffFromShelf() { |
132 return shelf_view_->dragged_off_shelf_; | 130 return shelf_view_->dragged_off_shelf_; |
133 } | 131 } |
134 | 132 |
135 bool ShelfViewTestAPI::DraggedItemFromOverflowToShelf() { | 133 bool ShelfViewTestAPI::DraggedItemFromOverflowToShelf() { |
136 return shelf_view_->dragged_off_from_overflow_to_shelf_; | 134 return shelf_view_->dragged_off_from_overflow_to_shelf_; |
137 } | 135 } |
138 | 136 |
139 } // namespace test | 137 } // namespace test |
140 } // namespace ash | 138 } // namespace ash |
OLD | NEW |