| 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/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 AddButtonsUntilOverflow(); | 1656 AddButtonsUntilOverflow(); |
| 1657 // Add one more button to prevent the overflow bubble to disappear upon | 1657 // Add one more button to prevent the overflow bubble to disappear upon |
| 1658 // dragging an item out on windows (flakiness, see crbug.com/425097). | 1658 // dragging an item out on windows (flakiness, see crbug.com/425097). |
| 1659 AddAppShortcut(); | 1659 AddAppShortcut(); |
| 1660 | 1660 |
| 1661 TestDraggingAnItemFromOverflowToShelf(false); | 1661 TestDraggingAnItemFromOverflowToShelf(false); |
| 1662 TestDraggingAnItemFromOverflowToShelf(true); | 1662 TestDraggingAnItemFromOverflowToShelf(true); |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 // Tests that the AppListButton renders as active in response to touches. | 1665 // Tests that the AppListButton renders as active in response to touches. |
| 1666 TEST_F(ShelfViewTest, DISABLED_AppListButtonTouchFeedback) { | 1666 TEST_F(ShelfViewTest, AppListButtonTouchFeedback) { |
| 1667 AppListButton* app_list_button = | 1667 AppListButton* app_list_button = |
| 1668 static_cast<AppListButton*>(shelf_view_->GetAppListButtonView()); | 1668 static_cast<AppListButton*>(shelf_view_->GetAppListButtonView()); |
| 1669 EXPECT_FALSE(app_list_button->draw_background_as_active()); | 1669 EXPECT_FALSE(app_list_button->draw_background_as_active()); |
| 1670 | 1670 |
| 1671 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 1671 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 1672 generator.set_current_location(app_list_button-> | 1672 generator.set_current_location(app_list_button-> |
| 1673 GetBoundsInScreen().CenterPoint()); | 1673 GetBoundsInScreen().CenterPoint()); |
| 1674 generator.PressTouch(); | 1674 generator.PressTouch(); |
| 1675 RunAllPendingInMessageLoop(); | |
| 1676 EXPECT_TRUE(app_list_button->draw_background_as_active()); | 1675 EXPECT_TRUE(app_list_button->draw_background_as_active()); |
| 1677 | 1676 |
| 1678 generator.ReleaseTouch(); | 1677 generator.ReleaseTouch(); |
| 1679 RunAllPendingInMessageLoop(); | |
| 1680 EXPECT_FALSE(app_list_button->draw_background_as_active()); | 1678 EXPECT_FALSE(app_list_button->draw_background_as_active()); |
| 1681 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); | 1679 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 1682 } | 1680 } |
| 1683 | 1681 |
| 1684 // Tests that a touch that slides out of the bounds of the AppListButton leads | 1682 // Tests that a touch that slides out of the bounds of the AppListButton leads |
| 1685 // to the end of rendering an active state. | 1683 // to the end of rendering an active state. |
| 1686 TEST_F(ShelfViewTest, DISABLED_AppListButtonTouchFeedbackCancellation) { | 1684 TEST_F(ShelfViewTest, AppListButtonTouchFeedbackCancellation) { |
| 1687 AppListButton* app_list_button = | 1685 AppListButton* app_list_button = |
| 1688 static_cast<AppListButton*>(shelf_view_->GetAppListButtonView()); | 1686 static_cast<AppListButton*>(shelf_view_->GetAppListButtonView()); |
| 1689 EXPECT_FALSE(app_list_button->draw_background_as_active()); | 1687 EXPECT_FALSE(app_list_button->draw_background_as_active()); |
| 1690 | 1688 |
| 1691 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 1689 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 1692 generator.set_current_location(app_list_button-> | 1690 generator.set_current_location(app_list_button-> |
| 1693 GetBoundsInScreen().CenterPoint()); | 1691 GetBoundsInScreen().CenterPoint()); |
| 1694 generator.PressTouch(); | 1692 generator.PressTouch(); |
| 1695 RunAllPendingInMessageLoop(); | |
| 1696 EXPECT_TRUE(app_list_button->draw_background_as_active()); | 1693 EXPECT_TRUE(app_list_button->draw_background_as_active()); |
| 1697 | 1694 |
| 1698 gfx::Point moved_point(app_list_button->GetBoundsInScreen().right() + 1, | 1695 gfx::Point moved_point(app_list_button->GetBoundsInScreen().right() + 1, |
| 1699 app_list_button-> | 1696 app_list_button-> |
| 1700 GetBoundsInScreen().CenterPoint().y()); | 1697 GetBoundsInScreen().CenterPoint().y()); |
| 1701 generator.MoveTouch(moved_point); | 1698 generator.MoveTouch(moved_point); |
| 1702 RunAllPendingInMessageLoop(); | |
| 1703 EXPECT_FALSE(app_list_button->draw_background_as_active()); | 1699 EXPECT_FALSE(app_list_button->draw_background_as_active()); |
| 1704 | 1700 |
| 1705 generator.set_current_location(moved_point); | 1701 generator.set_current_location(moved_point); |
| 1706 generator.ReleaseTouch(); | 1702 generator.ReleaseTouch(); |
| 1707 RunAllPendingInMessageLoop(); | |
| 1708 EXPECT_FALSE(app_list_button->draw_background_as_active()); | 1703 EXPECT_FALSE(app_list_button->draw_background_as_active()); |
| 1709 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); | 1704 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 1710 } | 1705 } |
| 1711 | 1706 |
| 1712 class ShelfViewVisibleBoundsTest : public ShelfViewTest, | 1707 class ShelfViewVisibleBoundsTest : public ShelfViewTest, |
| 1713 public testing::WithParamInterface<bool> { | 1708 public testing::WithParamInterface<bool> { |
| 1714 public: | 1709 public: |
| 1715 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) {} | 1710 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) {} |
| 1716 | 1711 |
| 1717 void CheckAllItemsAreInBounds() { | 1712 void CheckAllItemsAreInBounds() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 test_api_->RunMessageLoopUntilAnimationsDone(); | 1747 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1753 CheckAllItemsAreInBounds(); | 1748 CheckAllItemsAreInBounds(); |
| 1754 } | 1749 } |
| 1755 | 1750 |
| 1756 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1751 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
| 1757 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1752 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
| 1758 testing::Bool()); | 1753 testing::Bool()); |
| 1759 | 1754 |
| 1760 } // namespace test | 1755 } // namespace test |
| 1761 } // namespace ash | 1756 } // namespace ash |
| OLD | NEW |