| 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/wm/caption_buttons/frame_maximize_button.h" | 5 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 EXPECT_FALSE(window_state->IsMaximized()); | 743 EXPECT_FALSE(window_state->IsMaximized()); |
| 744 gfx::Rect new_bounds = widget()->GetWindowBoundsInScreen(); | 744 gfx::Rect new_bounds = widget()->GetWindowBoundsInScreen(); |
| 745 EXPECT_EQ(new_bounds.x(), initial_bounds.x()); | 745 EXPECT_EQ(new_bounds.x(), initial_bounds.x()); |
| 746 EXPECT_EQ(new_bounds.y(), initial_bounds.x()); | 746 EXPECT_EQ(new_bounds.y(), initial_bounds.x()); |
| 747 EXPECT_EQ(new_bounds.width(), initial_bounds.width()); | 747 EXPECT_EQ(new_bounds.width(), initial_bounds.width()); |
| 748 EXPECT_EQ(new_bounds.height(), initial_bounds.height()); | 748 EXPECT_EQ(new_bounds.height(), initial_bounds.height()); |
| 749 // Make sure that there is no restore rectangle left. | 749 // Make sure that there is no restore rectangle left. |
| 750 EXPECT_FALSE(window_state->HasRestoreBounds()); | 750 EXPECT_FALSE(window_state->HasRestoreBounds()); |
| 751 } | 751 } |
| 752 | 752 |
| 753 // Test hovering over the minimize button in the help bubble then tapping the | |
| 754 // snap left button. | |
| 755 TEST_F(FrameMaximizeButtonTest, MaximizeBubbleMouseHoverAndTouch) { | |
| 756 aura::Window* window = widget()->GetNativeWindow(); | |
| 757 ash::FrameMaximizeButton* maximize_button = | |
| 758 FrameMaximizeButtonTest::maximize_button(); | |
| 759 maximize_button->set_bubble_appearance_delay_ms(0); | |
| 760 | |
| 761 // Move the mouse cursor over the maximize button to make the help bubble | |
| 762 // appear. | |
| 763 aura::test::EventGenerator generator(window->GetRootWindow()); | |
| 764 generator.MoveMouseTo(maximize_button->GetBoundsInScreen().CenterPoint()); | |
| 765 MaximizeBubbleController* maximizer = maximize_button->maximizer(); | |
| 766 ASSERT_TRUE(maximizer); | |
| 767 | |
| 768 // Move the mouse cursor over the minimize button in the help bubble. | |
| 769 gfx::Point minimize_pos = maximizer->GetButtonForUnitTest(SNAP_MINIMIZE)-> | |
| 770 GetBoundsInScreen().CenterPoint(); | |
| 771 generator.MoveMouseTo(minimize_pos); | |
| 772 | |
| 773 // Tap the snap left button in the help bubble. | |
| 774 gfx::Point snap_pos = maximizer->GetButtonForUnitTest(SNAP_LEFT)-> | |
| 775 GetBoundsInScreen().CenterPoint(); | |
| 776 generator.GestureTapAt(snap_pos); | |
| 777 internal::SnapSizer sizer(wm::GetWindowState(window), gfx::Point(), | |
| 778 internal::SnapSizer::LEFT_EDGE, | |
| 779 internal::SnapSizer::OTHER_INPUT); | |
| 780 EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString()); | |
| 781 } | |
| 782 | |
| 783 // Test that minimizing the window per keyboard closes the maximize bubble. | 753 // Test that minimizing the window per keyboard closes the maximize bubble. |
| 784 TEST_F(FrameMaximizeButtonTest, MinimizePerKeyClosesBubble) { | 754 TEST_F(FrameMaximizeButtonTest, MinimizePerKeyClosesBubble) { |
| 785 aura::Window* window = widget()->GetNativeWindow(); | 755 aura::Window* window = widget()->GetNativeWindow(); |
| 786 ash::FrameMaximizeButton* maximize_button = | 756 ash::FrameMaximizeButton* maximize_button = |
| 787 FrameMaximizeButtonTest::maximize_button(); | 757 FrameMaximizeButtonTest::maximize_button(); |
| 788 | 758 |
| 789 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); | 759 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); |
| 790 gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100); | 760 gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100); |
| 791 | 761 |
| 792 aura::test::EventGenerator generator(window->GetRootWindow(), off_pos); | 762 aura::test::EventGenerator generator(window->GetRootWindow(), off_pos); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 871 |
| 902 // Test that we have properly reset the state of the now inactive window. | 872 // Test that we have properly reset the state of the now inactive window. |
| 903 EXPECT_FALSE(maximize_button->maximizer()); | 873 EXPECT_FALSE(maximize_button->maximizer()); |
| 904 EXPECT_FALSE(maximize_button->phantom_window_open()); | 874 EXPECT_FALSE(maximize_button->phantom_window_open()); |
| 905 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); | 875 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); |
| 906 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 876 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 907 } | 877 } |
| 908 | 878 |
| 909 } // namespace test | 879 } // namespace test |
| 910 } // namespace ash | 880 } // namespace ash |
| OLD | NEW |