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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/public/cpp/config.h" | 8 #include "ash/public/cpp/config.h" |
9 #include "ash/public/cpp/shelf_types.h" | 9 #include "ash/public/cpp/shelf_types.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); | 743 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
744 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); | 744 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); |
745 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); | 745 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); |
746 | 746 |
747 // Clicking outside the bounds closes the app list. | 747 // Clicking outside the bounds closes the app list. |
748 generator.MoveMouseTo(gfx::Point(10, 10)); | 748 generator.MoveMouseTo(gfx::Point(10, 10)); |
749 generator.ClickLeftButton(); | 749 generator.ClickLeftButton(); |
750 EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); | 750 EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); |
751 } | 751 } |
752 | 752 |
| 753 // Tests that the app list transitions on mousewheel and gesture scroll events. |
| 754 TEST_P(FullscreenAppListPresenterDelegateTest, |
| 755 MouseWheelAndGestureScrollTransition) { |
| 756 const bool test_mouse_event = GetParam(); |
| 757 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
| 758 app_list::AppListView* view = app_list_presenter_impl()->GetView(); |
| 759 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 760 EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING); |
| 761 |
| 762 // Move mouse to over the searchbox, mousewheel scroll up. |
| 763 generator.MoveMouseTo(GetPointInsideSearchbox()); |
| 764 if (test_mouse_event) { |
| 765 generator.MoveMouseWheel(0, -30); |
| 766 } else { |
| 767 generator.ScrollSequence(GetPointInsideSearchbox(), |
| 768 base::TimeDelta::FromMilliseconds(5), 0, -300, 2, |
| 769 2); |
| 770 } |
| 771 EXPECT_EQ(view->app_list_state(), app_list::AppListView::FULLSCREEN_ALL_APPS); |
| 772 |
| 773 // Swipe down, the app list should return to peeking mode. |
| 774 generator.GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720), |
| 775 base::TimeDelta::FromMilliseconds(100), 10); |
| 776 EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING); |
| 777 |
| 778 // Move mouse away from the searchbox, mousewheel scroll up. |
| 779 generator.MoveMouseTo(GetPointOutsideSearchbox()); |
| 780 if (test_mouse_event) { |
| 781 generator.MoveMouseWheel(0, -30); |
| 782 } else { |
| 783 generator.ScrollSequence(GetPointOutsideSearchbox(), |
| 784 base::TimeDelta::FromMilliseconds(5), 0, -300, 2, |
| 785 2); |
| 786 } |
| 787 EXPECT_EQ(view->app_list_state(), app_list::AppListView::FULLSCREEN_ALL_APPS); |
| 788 } |
| 789 |
753 } // namespace ash | 790 } // namespace ash |
OLD | NEW |