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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "ash/common/shelf/shelf_button.h" | 7 #include "ash/common/shelf/shelf_button.h" |
8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
9 #include "ash/common/shelf/shelf_view.h" | 9 #include "ash/common/shelf/shelf_view.h" |
10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 TEST_F(ShelfTest, CheckHoverAfterMenu) { | 65 TEST_F(ShelfTest, CheckHoverAfterMenu) { |
66 // Initially we have the app list. | 66 // Initially we have the app list. |
67 int button_count = test_api()->GetButtonCount(); | 67 int button_count = test_api()->GetButtonCount(); |
68 | 68 |
69 // Add a running app. | 69 // Add a running app. |
70 ShelfItem item; | 70 ShelfItem item; |
71 item.type = TYPE_APP; | 71 item.type = TYPE_APP; |
72 item.status = STATUS_RUNNING; | 72 item.status = STATUS_RUNNING; |
73 int index = shelf_model()->Add(item); | 73 int index = shelf_model()->Add(item); |
74 | 74 |
75 std::unique_ptr<ShelfItemDelegate> delegate( | 75 shelf_model()->SetShelfItemDelegate( |
76 new test::TestShelfItemDelegate(NULL)); | 76 shelf_model()->items()[index].id, |
77 shelf_model()->SetShelfItemDelegate(shelf_model()->items()[index].id, | 77 base::MakeUnique<test::TestShelfItemDelegate>(nullptr)); |
78 std::move(delegate)); | |
79 | 78 |
80 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); | 79 ASSERT_EQ(++button_count, test_api()->GetButtonCount()); |
81 ShelfButton* button = test_api()->GetButton(index); | 80 ShelfButton* button = test_api()->GetButton(index); |
82 button->AddState(ShelfButton::STATE_HOVERED); | 81 button->AddState(ShelfButton::STATE_HOVERED); |
83 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); | 82 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); |
84 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); | 83 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); |
85 | 84 |
86 // Remove it. | 85 // Remove it. |
87 shelf_model()->RemoveItemAt(index); | 86 shelf_model()->RemoveItemAt(index); |
88 } | 87 } |
(...skipping 20 matching lines...) Expand all Loading... |
109 | 108 |
110 // Removes the first item in main shelf view. | 109 // Removes the first item in main shelf view. |
111 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); | 110 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); |
112 | 111 |
113 // Waits for all transitions to finish and there should be no crash. | 112 // Waits for all transitions to finish and there should be no crash. |
114 test_api()->RunMessageLoopUntilAnimationsDone(); | 113 test_api()->RunMessageLoopUntilAnimationsDone(); |
115 EXPECT_FALSE(shelf_widget->IsShowingOverflowBubble()); | 114 EXPECT_FALSE(shelf_widget->IsShowingOverflowBubble()); |
116 } | 115 } |
117 | 116 |
118 } // namespace ash | 117 } // namespace ash |
OLD | NEW |