OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf.h" | 5 #include "ash/shelf/shelf.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/shelf/shelf_button.h" | 9 #include "ash/shelf/shelf_button.h" |
10 #include "ash/shelf/shelf_item_delegate_manager.h" | 10 #include "ash/shelf/shelf_item_delegate_manager.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 ash::test::ShelfViewTestAPI* test_api() { | 78 ash::test::ShelfViewTestAPI* test_api() { |
79 return test_.get(); | 79 return test_.get(); |
80 } | 80 } |
81 | 81 |
82 private: | 82 private: |
83 Shelf* shelf_; | 83 Shelf* shelf_; |
84 ShelfView* shelf_view_; | 84 ShelfView* shelf_view_; |
85 ShelfModel* shelf_model_; | 85 ShelfModel* shelf_model_; |
86 ShelfItemDelegateManager* item_delegate_manager_; | 86 ShelfItemDelegateManager* item_delegate_manager_; |
87 scoped_ptr<test::ShelfViewTestAPI> test_; | 87 std::unique_ptr<test::ShelfViewTestAPI> test_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(ShelfTest); | 89 DISALLOW_COPY_AND_ASSIGN(ShelfTest); |
90 }; | 90 }; |
91 | 91 |
92 // Confirms that ShelfItem reflects the appropriated state. | 92 // Confirms that ShelfItem reflects the appropriated state. |
93 TEST_F(ShelfTest, StatusReflection) { | 93 TEST_F(ShelfTest, StatusReflection) { |
94 // Initially we have the app list. | 94 // Initially we have the app list. |
95 int button_count = test_api()->GetButtonCount(); | 95 int button_count = test_api()->GetButtonCount(); |
96 | 96 |
97 // Add running platform app. | 97 // Add running platform app. |
(...skipping 15 matching lines...) Expand all Loading... |
113 TEST_F(ShelfTest, checkHoverAfterMenu) { | 113 TEST_F(ShelfTest, checkHoverAfterMenu) { |
114 // Initially we have the app list. | 114 // Initially we have the app list. |
115 int button_count = test_api()->GetButtonCount(); | 115 int button_count = test_api()->GetButtonCount(); |
116 | 116 |
117 // Add running platform app. | 117 // Add running platform app. |
118 ShelfItem item; | 118 ShelfItem item; |
119 item.type = TYPE_PLATFORM_APP; | 119 item.type = TYPE_PLATFORM_APP; |
120 item.status = STATUS_RUNNING; | 120 item.status = STATUS_RUNNING; |
121 int index = shelf_model()->Add(item); | 121 int index = shelf_model()->Add(item); |
122 | 122 |
123 scoped_ptr<ShelfItemDelegate> delegate( | 123 std::unique_ptr<ShelfItemDelegate> delegate( |
124 new test::TestShelfItemDelegate(NULL)); | 124 new test::TestShelfItemDelegate(NULL)); |
125 item_manager()->SetShelfItemDelegate(shelf_model()->items()[index].id, | 125 item_manager()->SetShelfItemDelegate(shelf_model()->items()[index].id, |
126 std::move(delegate)); | 126 std::move(delegate)); |
127 | 127 |
128 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); | 128 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); |
129 ShelfButton* button = test_api()->GetButton(index); | 129 ShelfButton* button = test_api()->GetButton(index); |
130 button->AddState(ShelfButton::STATE_HOVERED); | 130 button->AddState(ShelfButton::STATE_HOVERED); |
131 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); | 131 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); |
132 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); | 132 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); |
133 | 133 |
(...skipping 22 matching lines...) Expand all Loading... |
156 | 156 |
157 // Removes the first item in main shelf view. | 157 // Removes the first item in main shelf view. |
158 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); | 158 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); |
159 | 159 |
160 // Waits for all transitions to finish and there should be no crash. | 160 // Waits for all transitions to finish and there should be no crash. |
161 test_api()->RunMessageLoopUntilAnimationsDone(); | 161 test_api()->RunMessageLoopUntilAnimationsDone(); |
162 EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); | 162 EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); |
163 } | 163 } |
164 | 164 |
165 } // namespace ash | 165 } // namespace ash |
OLD | NEW |