| 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 |
| 7 #include <utility> |
| 8 |
| 6 #include "ash/shelf/shelf_button.h" | 9 #include "ash/shelf/shelf_button.h" |
| 7 #include "ash/shelf/shelf_item_delegate_manager.h" | 10 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 8 #include "ash/shelf/shelf_model.h" | 11 #include "ash/shelf/shelf_model.h" |
| 9 #include "ash/shelf/shelf_view.h" | 12 #include "ash/shelf/shelf_view.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 11 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/shelf_test_api.h" | 16 #include "ash/test/shelf_test_api.h" |
| 14 #include "ash/test/shelf_view_test_api.h" | 17 #include "ash/test/shelf_view_test_api.h" |
| 15 #include "ash/test/test_shelf_item_delegate.h" | 18 #include "ash/test/test_shelf_item_delegate.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 116 |
| 114 // Add running platform app. | 117 // Add running platform app. |
| 115 ShelfItem item; | 118 ShelfItem item; |
| 116 item.type = TYPE_PLATFORM_APP; | 119 item.type = TYPE_PLATFORM_APP; |
| 117 item.status = STATUS_RUNNING; | 120 item.status = STATUS_RUNNING; |
| 118 int index = shelf_model()->Add(item); | 121 int index = shelf_model()->Add(item); |
| 119 | 122 |
| 120 scoped_ptr<ShelfItemDelegate> delegate( | 123 scoped_ptr<ShelfItemDelegate> delegate( |
| 121 new test::TestShelfItemDelegate(NULL)); | 124 new test::TestShelfItemDelegate(NULL)); |
| 122 item_manager()->SetShelfItemDelegate(shelf_model()->items()[index].id, | 125 item_manager()->SetShelfItemDelegate(shelf_model()->items()[index].id, |
| 123 delegate.Pass()); | 126 std::move(delegate)); |
| 124 | 127 |
| 125 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); | 128 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); |
| 126 ShelfButton* button = test_api()->GetButton(index); | 129 ShelfButton* button = test_api()->GetButton(index); |
| 127 button->AddState(ShelfButton::STATE_HOVERED); | 130 button->AddState(ShelfButton::STATE_HOVERED); |
| 128 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); | 131 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); |
| 129 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); | 132 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); |
| 130 | 133 |
| 131 // Remove it. | 134 // Remove it. |
| 132 shelf_model()->RemoveItemAt(index); | 135 shelf_model()->RemoveItemAt(index); |
| 133 } | 136 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 153 | 156 |
| 154 // Removes the first item in main shelf view. | 157 // Removes the first item in main shelf view. |
| 155 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); | 158 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); |
| 156 | 159 |
| 157 // 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. |
| 158 test_api()->RunMessageLoopUntilAnimationsDone(); | 161 test_api()->RunMessageLoopUntilAnimationsDone(); |
| 159 EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); | 162 EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); |
| 160 } | 163 } |
| 161 | 164 |
| 162 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |