| 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/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 widget.Show(); | 190 widget.Show(); |
| 191 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); | 191 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); |
| 192 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 192 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 193 EXPECT_TRUE(observer()->icon_positions_changed()); | 193 EXPECT_TRUE(observer()->icon_positions_changed()); |
| 194 observer()->Reset(); | 194 observer()->Reset(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Make sure creating/deleting an window on one displays notifies a | 197 // Make sure creating/deleting an window on one displays notifies a |
| 198 // shelf on external display as well as one on primary. | 198 // shelf on external display as well as one on primary. |
| 199 TEST_F(WmShelfObserverIconTest, AddRemoveWithMultipleDisplays) { | 199 TEST_F(WmShelfObserverIconTest, AddRemoveWithMultipleDisplays) { |
| 200 if (!SupportsMultipleDisplays()) | |
| 201 return; | |
| 202 | |
| 203 UpdateDisplay("400x400,400x400"); | 200 UpdateDisplay("400x400,400x400"); |
| 204 WmWindow* second_root = WmShell::Get()->GetAllRootWindows()[1]; | 201 WmWindow* second_root = WmShell::Get()->GetAllRootWindows()[1]; |
| 205 WmShelf* second_shelf = second_root->GetRootWindowController()->GetShelf(); | 202 WmShelf* second_shelf = second_root->GetRootWindowController()->GetShelf(); |
| 206 TestWmShelfObserver second_observer(second_shelf); | 203 TestWmShelfObserver second_observer(second_shelf); |
| 207 | 204 |
| 208 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 205 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 209 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 206 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 210 params.bounds = gfx::Rect(0, 0, 200, 200); | 207 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 211 params.context = CurrentContext(); | 208 params.context = CurrentContext(); |
| 212 views::Widget widget; | 209 views::Widget widget; |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 drag_reinsert_bounds = | 1673 drag_reinsert_bounds = |
| 1677 test_for_overflow_view.GetBoundsForDragInsertInScreen(); | 1674 test_for_overflow_view.GetBoundsForDragInsertInScreen(); |
| 1678 first_point = first_button->GetBoundsInScreen().CenterPoint(); | 1675 first_point = first_button->GetBoundsInScreen().CenterPoint(); |
| 1679 last_point = last_button->GetBoundsInScreen().CenterPoint(); | 1676 last_point = last_button->GetBoundsInScreen().CenterPoint(); |
| 1680 EXPECT_FALSE(drag_reinsert_bounds.Contains(first_point)); | 1677 EXPECT_FALSE(drag_reinsert_bounds.Contains(first_point)); |
| 1681 EXPECT_TRUE(drag_reinsert_bounds.Contains(last_point)); | 1678 EXPECT_TRUE(drag_reinsert_bounds.Contains(last_point)); |
| 1682 } | 1679 } |
| 1683 | 1680 |
| 1684 // Check the drag insertion bounds of shelf view in multi monitor environment. | 1681 // Check the drag insertion bounds of shelf view in multi monitor environment. |
| 1685 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { | 1682 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { |
| 1686 // win8-aura doesn't support multiple display. | |
| 1687 if (!SupportsMultipleDisplays()) | |
| 1688 return; | |
| 1689 | |
| 1690 UpdateDisplay("800x600,800x600"); | 1683 UpdateDisplay("800x600,800x600"); |
| 1691 WmShelf* secondary_shelf = | 1684 WmShelf* secondary_shelf = |
| 1692 WmShelf::ForWindow(WmShell::Get()->GetAllRootWindows()[1]); | 1685 WmShelf::ForWindow(WmShell::Get()->GetAllRootWindows()[1]); |
| 1693 ShelfView* shelf_view_for_secondary = | 1686 ShelfView* shelf_view_for_secondary = |
| 1694 secondary_shelf->GetShelfViewForTesting(); | 1687 secondary_shelf->GetShelfViewForTesting(); |
| 1695 | 1688 |
| 1696 // The bounds should be big enough for 4 buttons + overflow chevron. | 1689 // The bounds should be big enough for 4 buttons + overflow chevron. |
| 1697 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 1690 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); |
| 1698 | 1691 |
| 1699 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); | 1692 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 // Checks that a point out of shelf is not contained in drag insert bounds. | 1737 // Checks that a point out of shelf is not contained in drag insert bounds. |
| 1745 EXPECT_FALSE(drag_reinsert_bounds_in_secondary.Contains( | 1738 EXPECT_FALSE(drag_reinsert_bounds_in_secondary.Contains( |
| 1746 gfx::Point(point_in_secondary_shelf_view.x(), 0))); | 1739 gfx::Point(point_in_secondary_shelf_view.x(), 0))); |
| 1747 // Checks that a point of overflow bubble in primary shelf should not be | 1740 // Checks that a point of overflow bubble in primary shelf should not be |
| 1748 // contained by insert bounds of secondary shelf. | 1741 // contained by insert bounds of secondary shelf. |
| 1749 EXPECT_FALSE(drag_reinsert_bounds_in_secondary.Contains(point_in_shelf_view)); | 1742 EXPECT_FALSE(drag_reinsert_bounds_in_secondary.Contains(point_in_shelf_view)); |
| 1750 } | 1743 } |
| 1751 | 1744 |
| 1752 // Checks the rip an item off from left aligned shelf in secondary monitor. | 1745 // Checks the rip an item off from left aligned shelf in secondary monitor. |
| 1753 TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) { | 1746 TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) { |
| 1754 // win8-aura doesn't support multiple display. | |
| 1755 if (!SupportsMultipleDisplays()) | |
| 1756 return; | |
| 1757 | |
| 1758 UpdateDisplay("800x600,800x600"); | 1747 UpdateDisplay("800x600,800x600"); |
| 1759 ASSERT_EQ(2U, WmShell::Get()->GetAllRootWindows().size()); | 1748 ASSERT_EQ(2U, WmShell::Get()->GetAllRootWindows().size()); |
| 1760 | 1749 |
| 1761 WmWindow* second_root = WmShell::Get()->GetAllRootWindows()[1]; | 1750 WmWindow* second_root = WmShell::Get()->GetAllRootWindows()[1]; |
| 1762 WmShelf* secondary_shelf = second_root->GetRootWindowController()->GetShelf(); | 1751 WmShelf* secondary_shelf = second_root->GetRootWindowController()->GetShelf(); |
| 1763 | 1752 |
| 1764 secondary_shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1753 secondary_shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 1765 ASSERT_EQ(SHELF_ALIGNMENT_LEFT, secondary_shelf->alignment()); | 1754 ASSERT_EQ(SHELF_ALIGNMENT_LEFT, secondary_shelf->alignment()); |
| 1766 | 1755 |
| 1767 // Initially, app list and browser shortcut are added. | 1756 // Initially, app list and browser shortcut are added. |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 EXPECT_EQ(views::InkDropState::ACTIVATED, | 3051 EXPECT_EQ(views::InkDropState::ACTIVATED, |
| 3063 overflow_button_ink_drop_->GetTargetInkDropState()); | 3052 overflow_button_ink_drop_->GetTargetInkDropState()); |
| 3064 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3053 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), |
| 3065 IsEmpty()); | 3054 IsEmpty()); |
| 3066 | 3055 |
| 3067 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3056 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
| 3068 } | 3057 } |
| 3069 | 3058 |
| 3070 } // namespace test | 3059 } // namespace test |
| 3071 } // namespace ash | 3060 } // namespace ash |
| OLD | NEW |