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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
10 #include "ash/common/ash_switches.h" | |
11 #include "ash/common/shelf/shelf_widget.h" | |
12 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
13 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
14 #include "ash/common/test/test_shelf_delegate.h" | 12 #include "ash/common/test/test_shelf_delegate.h" |
15 #include "ash/common/wm/dock/docked_window_layout_manager.h" | |
16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
17 #include "ash/common/wm/mru_window_tracker.h" | |
18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" | |
19 #include "ash/common/wm/overview/window_grid.h" | 14 #include "ash/common/wm/overview/window_grid.h" |
20 #include "ash/common/wm/overview/window_selector.h" | 15 #include "ash/common/wm/overview/window_selector.h" |
21 #include "ash/common/wm/overview/window_selector_controller.h" | 16 #include "ash/common/wm/overview/window_selector_controller.h" |
22 #include "ash/common/wm/overview/window_selector_item.h" | 17 #include "ash/common/wm/overview/window_selector_item.h" |
23 #include "ash/common/wm/panels/panel_layout_manager.h" | 18 #include "ash/common/wm/panels/panel_layout_manager.h" |
24 #include "ash/common/wm/window_state.h" | 19 #include "ash/common/wm/window_state.h" |
25 #include "ash/common/wm/wm_event.h" | 20 #include "ash/common/wm/wm_event.h" |
26 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 21 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
27 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
28 #include "ash/common/wm_window.h" | 23 #include "ash/common/wm_window.h" |
29 #include "ash/drag_drop/drag_drop_controller.h" | 24 #include "ash/drag_drop/drag_drop_controller.h" |
30 #include "ash/public/cpp/shell_window_ids.h" | |
31 #include "ash/root_window_controller.h" | |
32 #include "ash/shell.h" | 25 #include "ash/shell.h" |
33 #include "ash/test/ash_test_base.h" | 26 #include "ash/test/ash_test_base.h" |
34 #include "ash/test/shelf_view_test_api.h" | 27 #include "ash/test/shelf_view_test_api.h" |
35 #include "ash/test/shell_test_api.h" | 28 #include "ash/test/shell_test_api.h" |
36 #include "ash/test/test_app_list_view_presenter_impl.h" | 29 #include "ash/test/test_app_list_view_presenter_impl.h" |
37 #include "ash/wm/window_state_aura.h" | 30 #include "ash/wm/window_state_aura.h" |
38 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
39 #include "base/command_line.h" | |
40 #include "base/compiler_specific.h" | |
41 #include "base/memory/ptr_util.h" | |
42 #include "base/run_loop.h" | |
43 #include "base/strings/string_piece.h" | |
44 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
45 #include "base/test/user_action_tester.h" | 33 #include "base/test/user_action_tester.h" |
46 #include "base/threading/thread_task_runner_handle.h" | |
47 #include "ui/aura/client/aura_constants.h" | 34 #include "ui/aura/client/aura_constants.h" |
48 #include "ui/aura/client/cursor_client.h" | |
49 #include "ui/aura/client/focus_client.h" | 35 #include "ui/aura/client/focus_client.h" |
50 #include "ui/aura/test/test_window_delegate.h" | |
51 #include "ui/aura/test/test_windows.h" | 36 #include "ui/aura/test/test_windows.h" |
52 #include "ui/aura/window.h" | 37 #include "ui/aura/window.h" |
53 #include "ui/aura/window_event_dispatcher.h" | |
54 #include "ui/base/hit_test.h" | 38 #include "ui/base/hit_test.h" |
55 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 39 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
56 #include "ui/display/display_layout.h" | 40 #include "ui/display/display_layout.h" |
57 #include "ui/display/manager/display_manager.h" | 41 #include "ui/display/manager/display_manager.h" |
58 #include "ui/display/test/display_manager_test_api.h" | 42 #include "ui/display/test/display_manager_test_api.h" |
59 #include "ui/events/event_utils.h" | 43 #include "ui/events/event_utils.h" |
60 #include "ui/events/test/event_generator.h" | 44 #include "ui/events/test/event_generator.h" |
61 #include "ui/gfx/animation/slide_animation.h" | 45 #include "ui/gfx/animation/slide_animation.h" |
62 #include "ui/gfx/geometry/point_conversions.h" | 46 #include "ui/gfx/geometry/point_conversions.h" |
63 #include "ui/gfx/geometry/rect_conversions.h" | |
64 #include "ui/gfx/geometry/safe_integer_conversions.h" | |
65 #include "ui/gfx/transform.h" | 47 #include "ui/gfx/transform.h" |
66 #include "ui/gfx/transform_util.h" | 48 #include "ui/gfx/transform_util.h" |
67 #include "ui/views/controls/button/image_button.h" | |
68 #include "ui/views/controls/label.h" | |
69 #include "ui/views/widget/native_widget_aura.h" | |
70 #include "ui/views/widget/widget_delegate.h" | |
71 #include "ui/wm/core/coordinate_conversion.h" | 49 #include "ui/wm/core/coordinate_conversion.h" |
72 #include "ui/wm/core/window_util.h" | 50 #include "ui/wm/core/window_util.h" |
73 #include "ui/wm/public/activation_delegate.h" | 51 #include "ui/wm/public/activation_delegate.h" |
74 | 52 |
75 namespace ash { | 53 namespace ash { |
76 namespace { | 54 namespace { |
77 | 55 |
78 // The label covers selector item windows with a padding in order to prevent | 56 // The label covers selector item windows with a padding in order to prevent |
79 // them from receiving user input events while in overview. | 57 // them from receiving user input events while in overview. |
80 static const int kWindowMargin = 5; | 58 static const int kWindowMargin = 5; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview2 = | 533 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview2 = |
556 GetWindowItemsForRoot(0); | 534 GetWindowItemsForRoot(0); |
557 | 535 |
558 // The order should be MRU. | 536 // The order should be MRU. |
559 EXPECT_EQ(2, overview2[0]->GetWindow()->GetShellWindowId()); | 537 EXPECT_EQ(2, overview2[0]->GetWindow()->GetShellWindowId()); |
560 EXPECT_EQ(1, overview2[1]->GetWindow()->GetShellWindowId()); | 538 EXPECT_EQ(1, overview2[1]->GetWindow()->GetShellWindowId()); |
561 EXPECT_EQ(3, overview2[2]->GetWindow()->GetShellWindowId()); | 539 EXPECT_EQ(3, overview2[2]->GetWindow()->GetShellWindowId()); |
562 ToggleOverview(); | 540 ToggleOverview(); |
563 } | 541 } |
564 | 542 |
565 // Test class used for tests that need docked windows enabled. | |
566 class EnabledDockedWindowsWindowSelectorTest : public WindowSelectorTest { | |
567 public: | |
568 EnabledDockedWindowsWindowSelectorTest() = default; | |
569 ~EnabledDockedWindowsWindowSelectorTest() override = default; | |
570 | |
571 void SetUp() override { | |
572 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
573 ash::switches::kAshEnableDockedWindows); | |
574 WindowSelectorTest::SetUp(); | |
575 } | |
576 | |
577 private: | |
578 DISALLOW_COPY_AND_ASSIGN(EnabledDockedWindowsWindowSelectorTest); | |
579 }; | |
580 | |
581 // Tests entering overview mode with docked windows | |
582 TEST_F(EnabledDockedWindowsWindowSelectorTest, BasicWithDocked) { | |
583 // aura::Window* root_window = Shell::GetPrimaryRootWindow(); | |
584 gfx::Rect bounds(300, 0, 200, 200); | |
585 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | |
586 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | |
587 std::unique_ptr<aura::Window> docked1(CreateWindow(bounds)); | |
588 std::unique_ptr<aura::Window> docked2(CreateWindow(bounds)); | |
589 | |
590 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | |
591 wm::GetWindowState(docked1.get())->OnWMEvent(&dock_event); | |
592 | |
593 wm::WindowState* docked_state2 = wm::GetWindowState(docked2.get()); | |
594 docked_state2->OnWMEvent(&dock_event); | |
595 wm::WMEvent minimize_event(wm::WM_EVENT_MINIMIZE); | |
596 docked_state2->OnWMEvent(&minimize_event); | |
597 | |
598 EXPECT_TRUE(WindowsOverlapping(window1.get(), window2.get())); | |
599 gfx::Rect docked_bounds = docked1->GetBoundsInScreen(); | |
600 | |
601 EXPECT_NE(bounds.ToString(), docked_bounds.ToString()); | |
602 EXPECT_FALSE(WindowsOverlapping(window1.get(), docked1.get())); | |
603 EXPECT_FALSE(WindowsOverlapping(window1.get(), docked2.get())); | |
604 EXPECT_FALSE(docked2->IsVisible()); | |
605 | |
606 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, | |
607 wm::GetWindowState(docked1.get())->GetStateType()); | |
608 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, | |
609 wm::GetWindowState(docked2.get())->GetStateType()); | |
610 | |
611 ToggleOverview(); | |
612 | |
613 EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get())); | |
614 | |
615 gfx::Rect container_bounds = docked1->parent()->bounds(); | |
616 ShelfWidget* shelf = GetPrimaryShelf()->shelf_widget(); | |
617 DockedWindowLayoutManager* manager = | |
618 DockedWindowLayoutManager::Get(WmWindow::Get(docked1.get())); | |
619 | |
620 // Minimized docked windows stays invisible. | |
621 EXPECT_FALSE(docked2->IsVisible()); | |
622 EXPECT_TRUE(GetOverviewWindowForMinimizedState(0, docked2.get())); | |
623 | |
624 // Docked area shrinks. | |
625 EXPECT_EQ(0, manager->docked_bounds().width()); | |
626 | |
627 // Work area takes the whole screen minus the shelf. | |
628 gfx::Rect work_area = display::Screen::GetScreen() | |
629 ->GetDisplayNearestWindow(docked1.get()) | |
630 .work_area(); | |
631 gfx::Size expected_work_area_bounds(container_bounds.size()); | |
632 expected_work_area_bounds.Enlarge(0, | |
633 -shelf->GetWindowBoundsInScreen().height()); | |
634 EXPECT_EQ(expected_work_area_bounds.ToString(), work_area.size().ToString()); | |
635 | |
636 // Docked window can still be activated, which will exit the overview mode. | |
637 ClickWindow(docked1.get()); | |
638 EXPECT_TRUE(wm::IsActiveWindow(docked1.get())); | |
639 EXPECT_FALSE(window_selector_controller()->IsSelecting()); | |
640 | |
641 // Docked area has a window in it. | |
642 EXPECT_GT(manager->docked_bounds().width(), 0); | |
643 | |
644 // Work area takes the whole screen minus the shelf and the docked area. | |
645 work_area = display::Screen::GetScreen() | |
646 ->GetDisplayNearestWindow(docked1.get()) | |
647 .work_area(); | |
648 expected_work_area_bounds = container_bounds.size(); | |
649 expected_work_area_bounds.Enlarge(-manager->docked_bounds().width(), | |
650 -shelf->GetWindowBoundsInScreen().height()); | |
651 EXPECT_EQ(expected_work_area_bounds.ToString(), work_area.size().ToString()); | |
652 } | |
653 | |
654 // Tests that selecting a docked window updates docked layout pushing another | |
655 // window to get docked-minimized. | |
656 TEST_F(EnabledDockedWindowsWindowSelectorTest, ActivateDockedWindow) { | |
657 // aura::Window* root_window = Shell::GetPrimaryRootWindow(); | |
658 gfx::Rect bounds(300, 0, 200, 200); | |
659 std::unique_ptr<views::Widget> widget1 = CreateWindowWidget(bounds); | |
660 std::unique_ptr<views::Widget> widget2 = CreateWindowWidget(bounds); | |
661 | |
662 aura::test::TestWindowDelegate delegate; | |
663 delegate.set_minimum_size(gfx::Size(200, 500)); | |
664 std::unique_ptr<aura::Window> docked_window1( | |
665 CreateTestWindowInShellWithDelegate(&delegate, -1, bounds)); | |
666 docked_window1->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | |
667 std::unique_ptr<aura::Window> docked_window2( | |
668 CreateTestWindowInShellWithDelegate(&delegate, -1, bounds)); | |
669 docked_window2->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | |
670 wm::WindowState* state1 = wm::GetWindowState(docked_window1.get()); | |
671 wm::WindowState* state2 = wm::GetWindowState(docked_window2.get()); | |
672 | |
673 // Dock the second window first, then the first window. | |
674 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | |
675 state2->OnWMEvent(&dock_event); | |
676 state1->OnWMEvent(&dock_event); | |
677 | |
678 // Both windows' restored bounds are same. | |
679 const gfx::Rect expected_bounds = docked_window1->bounds(); | |
680 EXPECT_EQ(expected_bounds.ToString(), docked_window2->bounds().ToString()); | |
681 | |
682 // |docked_window1| is docked and visible. | |
683 EXPECT_TRUE(docked_window1->IsVisible()); | |
684 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state1->GetStateType()); | |
685 // |docked_window2| is docked-minimized and hidden. | |
686 EXPECT_FALSE(docked_window2->IsVisible()); | |
687 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state2->GetStateType()); | |
688 | |
689 ToggleOverview(); | |
690 | |
691 // Minimized should stay minimized. | |
692 EXPECT_FALSE(docked_window2->IsVisible()); | |
693 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state2->GetStateType()); | |
694 | |
695 aura::Window* window_for_minimized_docked_window2 = | |
696 GetOverviewWindowForMinimizedState(0, docked_window2.get()); | |
697 ASSERT_TRUE(window_for_minimized_docked_window2); | |
698 | |
699 // Activate |docked_window2| leaving the overview. | |
700 const gfx::Rect rect = | |
701 GetTransformedBoundsInRootWindow(window_for_minimized_docked_window2); | |
702 gfx::Point point(rect.top_right().x() - 50, rect.top_right().y() + 50); | |
703 ui::test::EventGenerator event_generator(docked_window2->GetRootWindow(), | |
704 point); | |
705 event_generator.ClickLeftButton(); | |
706 | |
707 EXPECT_FALSE(IsSelecting()); | |
708 | |
709 // Windows' bounds are still the same. | |
710 EXPECT_EQ(expected_bounds.ToString(), docked_window1->bounds().ToString()); | |
711 EXPECT_EQ(expected_bounds.ToString(), docked_window2->bounds().ToString()); | |
712 | |
713 // |docked_window1| is docked-minimized and hidden. | |
714 EXPECT_FALSE(docked_window1->IsVisible()); | |
715 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state1->GetStateType()); | |
716 // |docked_window2| is docked and visible. | |
717 EXPECT_TRUE(docked_window2->IsVisible()); | |
718 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state2->GetStateType()); | |
719 } | |
720 | |
721 // Tests that clicking on the close button closes the docked window. | |
722 TEST_F(EnabledDockedWindowsWindowSelectorTest, CloseDockedWindow) { | |
723 // aura::Window* root_window = Shell::GetPrimaryRootWindow(); | |
724 gfx::Rect bounds(300, 0, 200, 200); | |
725 std::unique_ptr<views::Widget> widget1 = CreateWindowWidget(bounds); | |
726 std::unique_ptr<views::Widget> widget2 = CreateWindowWidget(bounds); | |
727 | |
728 aura::test::TestWindowDelegate delegate; | |
729 delegate.set_minimum_size(gfx::Size(200, 500)); | |
730 std::unique_ptr<aura::Window> docked_window1( | |
731 CreateTestWindowInShellWithDelegate(&delegate, -1, bounds)); | |
732 docked_window1->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | |
733 std::unique_ptr<views::Widget> docked2 = CreateWindowWidget(bounds); | |
734 aura::Window* docked_window2 = docked2->GetNativeWindow(); | |
735 wm::WindowState* state1 = wm::GetWindowState(docked_window1.get()); | |
736 wm::WindowState* state2 = wm::GetWindowState(docked_window2); | |
737 | |
738 // Dock the first window first, then the second window. | |
739 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | |
740 state1->OnWMEvent(&dock_event); | |
741 state2->OnWMEvent(&dock_event); | |
742 | |
743 const gfx::Rect expected_bounds1 = docked_window1->bounds(); | |
744 | |
745 // |docked_window1| is docked-minimized and hidden. | |
746 EXPECT_FALSE(docked_window1->IsVisible()); | |
747 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state1->GetStateType()); | |
748 // |docked_window2| is docked and visible. | |
749 EXPECT_TRUE(docked_window2->IsVisible()); | |
750 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state2->GetStateType()); | |
751 | |
752 ToggleOverview(); | |
753 | |
754 // Close |docked_window2| (staying in overview). | |
755 const gfx::Rect rect = GetTransformedBoundsInRootWindow(docked_window2); | |
756 gfx::Point point(rect.top_right().x() - 5, rect.top_right().y() + 5); | |
757 ui::test::EventGenerator event_generator(docked_window2->GetRootWindow(), | |
758 point); | |
759 | |
760 // Minimized window stays invisible and in the minimized state while in | |
761 // overview. | |
762 EXPECT_FALSE(docked_window1->IsVisible()); | |
763 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state1->GetStateType()); | |
764 EXPECT_TRUE(docked_window2->IsVisible()); | |
765 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state2->GetStateType()); | |
766 | |
767 EXPECT_TRUE(GetOverviewWindowForMinimizedState(0, docked_window1.get())); | |
768 | |
769 event_generator.ClickLeftButton(); | |
770 // |docked2| widget is closed. | |
771 EXPECT_TRUE(docked2->IsClosed()); | |
772 | |
773 // Exit overview. | |
774 ToggleOverview(); | |
775 | |
776 // Window bounds are still the same. | |
777 EXPECT_EQ(expected_bounds1.ToString(), docked_window1->bounds().ToString()); | |
778 | |
779 // |docked_window1| returns to docked-minimized and hidden state. | |
780 EXPECT_FALSE(docked_window1->IsVisible()); | |
781 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state1->GetStateType()); | |
782 } | |
783 | |
784 // Tests that clicking on the close button closes the docked-minimized window. | |
785 TEST_F(EnabledDockedWindowsWindowSelectorTest, CloseDockedMinimizedWindow) { | |
786 // aura::Window* root_window = Shell::GetPrimaryRootWindow(); | |
787 gfx::Rect bounds(300, 0, 200, 200); | |
788 std::unique_ptr<views::Widget> widget1 = CreateWindowWidget(bounds); | |
789 std::unique_ptr<views::Widget> widget2 = CreateWindowWidget(bounds); | |
790 | |
791 aura::test::TestWindowDelegate delegate; | |
792 delegate.set_minimum_size(gfx::Size(200, 500)); | |
793 std::unique_ptr<aura::Window> docked_window1( | |
794 CreateTestWindowInShellWithDelegate(&delegate, -1, bounds)); | |
795 docked_window1->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | |
796 std::unique_ptr<views::Widget> docked2 = CreateWindowWidget(bounds); | |
797 aura::Window* docked_window2 = docked2->GetNativeWindow(); | |
798 wm::WindowState* state1 = wm::GetWindowState(docked_window1.get()); | |
799 wm::WindowState* state2 = wm::GetWindowState(docked_window2); | |
800 | |
801 // Dock the second window first, then the first window. | |
802 wm::WMEvent dock_event(wm::WM_EVENT_DOCK); | |
803 state2->OnWMEvent(&dock_event); | |
804 state1->OnWMEvent(&dock_event); | |
805 | |
806 const gfx::Rect expected_bounds1 = docked_window1->bounds(); | |
807 | |
808 // |docked_window1| is docked and visible. | |
809 EXPECT_TRUE(docked_window1->IsVisible()); | |
810 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state1->GetStateType()); | |
811 // |docked_window2| is docked-minimized and hidden. | |
812 EXPECT_FALSE(docked_window2->IsVisible()); | |
813 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state2->GetStateType()); | |
814 | |
815 ToggleOverview(); | |
816 | |
817 // Both windows are visible while in overview. | |
818 EXPECT_TRUE(docked_window1->IsVisible()); | |
819 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state1->GetStateType()); | |
820 EXPECT_FALSE(docked_window2->IsVisible()); | |
821 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, state2->GetStateType()); | |
822 | |
823 // Close |docked_window2| (staying in overview). | |
824 aura::Window* window_for_minimized_docked_window2 = | |
825 GetOverviewWindowForMinimizedState(0, docked_window2); | |
826 ASSERT_TRUE(window_for_minimized_docked_window2); | |
827 const gfx::Rect rect = | |
828 GetTransformedBoundsInRootWindow(window_for_minimized_docked_window2); | |
829 gfx::Point point(rect.top_right().x() - 10, rect.top_right().y() - 10); | |
830 ui::test::EventGenerator event_generator(docked_window2->GetRootWindow(), | |
831 point); | |
832 event_generator.ClickLeftButton(); | |
833 // |docked2| widget is closed. | |
834 EXPECT_TRUE(docked2->IsClosed()); | |
835 | |
836 // Exit overview. | |
837 ToggleOverview(); | |
838 | |
839 // Window bounds are still the same. | |
840 EXPECT_EQ(expected_bounds1.ToString(), | |
841 docked_window1->GetTargetBounds().ToString()); | |
842 | |
843 // |docked_window1| returns to docked and visible state. | |
844 EXPECT_TRUE(docked_window1->IsVisible()); | |
845 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED, state1->GetStateType()); | |
846 } | |
847 | |
848 // Tests selecting a window by tapping on it. | 543 // Tests selecting a window by tapping on it. |
849 TEST_F(WindowSelectorTest, BasicGesture) { | 544 TEST_F(WindowSelectorTest, BasicGesture) { |
850 gfx::Rect bounds(0, 0, 400, 400); | 545 gfx::Rect bounds(0, 0, 400, 400); |
851 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 546 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
852 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | 547 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
853 wm::ActivateWindow(window1.get()); | 548 wm::ActivateWindow(window1.get()); |
854 EXPECT_EQ(window1.get(), GetFocusedWindow()); | 549 EXPECT_EQ(window1.get(), GetFocusedWindow()); |
855 ToggleOverview(); | 550 ToggleOverview(); |
856 EXPECT_EQ(text_filter_widget()->GetNativeWindow(), GetFocusedWindow()); | 551 EXPECT_EQ(text_filter_widget()->GetNativeWindow(), GetFocusedWindow()); |
857 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 552 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 1859 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
2165 ASSERT_TRUE(resizer.get()); | 1860 ASSERT_TRUE(resizer.get()); |
2166 gfx::Point location = resizer->GetInitialLocation(); | 1861 gfx::Point location = resizer->GetInitialLocation(); |
2167 location.Offset(20, 20); | 1862 location.Offset(20, 20); |
2168 resizer->Drag(location, 0); | 1863 resizer->Drag(location, 0); |
2169 ToggleOverview(); | 1864 ToggleOverview(); |
2170 resizer->RevertDrag(); | 1865 resizer->RevertDrag(); |
2171 } | 1866 } |
2172 | 1867 |
2173 } // namespace ash | 1868 } // namespace ash |
OLD | NEW |