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/launcher_view_test_api.h" | 5 #include "ash/test/launcher_view_test_api.h" |
6 | 6 |
7 #include "ash/launcher/launcher_button.h" | 7 #include "ash/launcher/launcher_button.h" |
| 8 #include "ash/launcher/launcher_model.h" |
8 #include "ash/launcher/launcher_view.h" | 9 #include "ash/launcher/launcher_view.h" |
9 #include "ash/launcher/overflow_button.h" | 10 #include "ash/launcher/overflow_button.h" |
10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
11 #include "ui/views/animation/bounds_animator.h" | 12 #include "ui/views/animation/bounds_animator.h" |
12 #include "ui/views/view_model.h" | 13 #include "ui/views/view_model.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // A class used to wait for animations. | 17 // A class used to wait for animations. |
17 class TestAPIAnimationObserver : public views::BoundsAnimatorObserver { | 18 class TestAPIAnimationObserver : public views::BoundsAnimatorObserver { |
(...skipping 23 matching lines...) Expand all Loading... |
41 | 42 |
42 LauncherViewTestAPI::~LauncherViewTestAPI() { | 43 LauncherViewTestAPI::~LauncherViewTestAPI() { |
43 } | 44 } |
44 | 45 |
45 int LauncherViewTestAPI::GetButtonCount() { | 46 int LauncherViewTestAPI::GetButtonCount() { |
46 return launcher_view_->view_model_->view_size(); | 47 return launcher_view_->view_model_->view_size(); |
47 } | 48 } |
48 | 49 |
49 internal::LauncherButton* LauncherViewTestAPI::GetButton(int index) { | 50 internal::LauncherButton* LauncherViewTestAPI::GetButton(int index) { |
50 // App list button is not a LauncherButton. | 51 // App list button is not a LauncherButton. |
51 if (index == GetButtonCount() - 1) | 52 if (launcher_view_->model_->items()[index].type == ash::TYPE_APP_LIST) |
52 return NULL; | 53 return NULL; |
53 | 54 |
54 return static_cast<internal::LauncherButton*>( | 55 return static_cast<internal::LauncherButton*>( |
55 launcher_view_->view_model_->view_at(index)); | 56 launcher_view_->view_model_->view_at(index)); |
56 } | 57 } |
57 | 58 |
58 int LauncherViewTestAPI::GetLastVisibleIndex() { | 59 int LauncherViewTestAPI::GetLastVisibleIndex() { |
59 return launcher_view_->last_visible_index_; | 60 return launcher_view_->last_visible_index_; |
60 } | 61 } |
61 | 62 |
(...skipping 22 matching lines...) Expand all Loading... |
84 | 85 |
85 // This nested loop will quit when TestAPIAnimationObserver's | 86 // This nested loop will quit when TestAPIAnimationObserver's |
86 // OnBoundsAnimatorDone is called. | 87 // OnBoundsAnimatorDone is called. |
87 MessageLoop::current()->Run(); | 88 MessageLoop::current()->Run(); |
88 | 89 |
89 launcher_view_->bounds_animator_->RemoveObserver(observer.get()); | 90 launcher_view_->bounds_animator_->RemoveObserver(observer.get()); |
90 } | 91 } |
91 | 92 |
92 } // namespace test | 93 } // namespace test |
93 } // namespace ash | 94 } // namespace ash |
OLD | NEW |