| 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/common/shelf/shelf_button.h" | 9 #include "ash/common/shelf/shelf_button.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 ShelfButton* button = test_api()->GetButton(index); | 101 ShelfButton* button = test_api()->GetButton(index); |
| 102 button->AddState(ShelfButton::STATE_HOVERED); | 102 button->AddState(ShelfButton::STATE_HOVERED); |
| 103 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); | 103 button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); |
| 104 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); | 104 EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED); |
| 105 | 105 |
| 106 // Remove it. | 106 // Remove it. |
| 107 shelf_model()->RemoveItemAt(index); | 107 shelf_model()->RemoveItemAt(index); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TEST_F(ShelfTest, ShowOverflowBubble) { | 110 TEST_F(ShelfTest, ShowOverflowBubble) { |
| 111 ShelfWidget* shelf_widget = shelf()->shelf_widget(); |
| 111 ShelfID first_item_id = shelf_model()->next_id(); | 112 ShelfID first_item_id = shelf_model()->next_id(); |
| 112 | 113 |
| 113 // Add platform app button until overflow. | 114 // Add platform app button until overflow. |
| 114 int items_added = 0; | 115 int items_added = 0; |
| 115 while (!test_api()->IsOverflowButtonVisible()) { | 116 while (!test_api()->IsOverflowButtonVisible()) { |
| 116 ShelfItem item; | 117 ShelfItem item; |
| 117 item.type = TYPE_PLATFORM_APP; | 118 item.type = TYPE_PLATFORM_APP; |
| 118 item.status = STATUS_RUNNING; | 119 item.status = STATUS_RUNNING; |
| 119 shelf_model()->Add(item); | 120 shelf_model()->Add(item); |
| 120 | 121 |
| 121 ++items_added; | 122 ++items_added; |
| 122 ASSERT_LT(items_added, 10000); | 123 ASSERT_LT(items_added, 10000); |
| 123 } | 124 } |
| 124 | 125 |
| 125 // Shows overflow bubble. | 126 // Shows overflow bubble. |
| 126 test_api()->ShowOverflowBubble(); | 127 test_api()->ShowOverflowBubble(); |
| 127 EXPECT_TRUE(shelf()->IsShowingOverflowBubble()); | 128 EXPECT_TRUE(shelf_widget->IsShowingOverflowBubble()); |
| 128 | 129 |
| 129 // Removes the first item in main shelf view. | 130 // Removes the first item in main shelf view. |
| 130 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); | 131 shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); |
| 131 | 132 |
| 132 // Waits for all transitions to finish and there should be no crash. | 133 // Waits for all transitions to finish and there should be no crash. |
| 133 test_api()->RunMessageLoopUntilAnimationsDone(); | 134 test_api()->RunMessageLoopUntilAnimationsDone(); |
| 134 EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); | 135 EXPECT_FALSE(shelf_widget->IsShowingOverflowBubble()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 } // namespace ash | 138 } // namespace ash |
| OLD | NEW |