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/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_layout.h" | 10 #include "ash/display/display_layout.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10); | 732 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10); |
733 | 733 |
734 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1, | 734 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1, |
735 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 735 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
736 | 736 |
737 ui::EventTarget* root_target = root_window; | 737 ui::EventTarget* root_target = root_window; |
738 ui::EventTargeter* targeter = root_target->GetEventTargeter(); | 738 ui::EventTargeter* targeter = root_target->GetEventTargeter(); |
739 | 739 |
740 // The event should target the window because we are still not in overview | 740 // The event should target the window because we are still not in overview |
741 // mode. | 741 // mode. |
742 EXPECT_EQ(window, static_cast<aura::Window*>( | 742 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &event1)); |
743 targeter->FindTargetForEvent(root_target, &event1))); | |
744 | 743 |
745 ToggleOverview(); | 744 ToggleOverview(); |
746 | 745 |
747 // The bounds have changed, take that into account. | 746 // The bounds have changed, take that into account. |
748 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get()); | 747 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get()); |
749 gfx::Point point2(bounds.x() + 10, bounds.y() + 10); | 748 gfx::Point point2(bounds.x() + 10, bounds.y() + 10); |
750 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2, | 749 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2, |
751 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 750 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
752 | 751 |
753 // Now the transparent window should be intercepting this event. | 752 // Now the transparent window should be intercepting this event. |
754 EXPECT_NE(window, static_cast<aura::Window*>( | 753 EXPECT_NE(window.get(), targeter->FindTargetForEvent(root_target, &event2)); |
755 targeter->FindTargetForEvent(root_target, &event2))); | |
756 } | 754 } |
757 | 755 |
758 // Tests that clicking on the close button effectively closes the window. | 756 // Tests that clicking on the close button effectively closes the window. |
759 TEST_F(WindowSelectorTest, CloseButton) { | 757 TEST_F(WindowSelectorTest, CloseButton) { |
760 scoped_ptr<views::Widget> widget = | 758 scoped_ptr<views::Widget> widget = |
761 CreateWindowWidget(gfx::Rect(0, 0, 400, 400)); | 759 CreateWindowWidget(gfx::Rect(0, 0, 400, 400)); |
762 | 760 |
763 ToggleOverview(); | 761 ToggleOverview(); |
764 | 762 |
765 aura::Window* window = widget->GetNativeWindow(); | 763 aura::Window* window = widget->GetNativeWindow(); |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 // Switch to overview mode. | 1627 // Switch to overview mode. |
1630 ToggleOverview(); | 1628 ToggleOverview(); |
1631 ASSERT_TRUE(IsSelecting()); | 1629 ASSERT_TRUE(IsSelecting()); |
1632 | 1630 |
1633 // Tap should now exit overview mode. | 1631 // Tap should now exit overview mode. |
1634 generator.GestureTapAt(point_in_background_page); | 1632 generator.GestureTapAt(point_in_background_page); |
1635 EXPECT_FALSE(IsSelecting()); | 1633 EXPECT_FALSE(IsSelecting()); |
1636 } | 1634 } |
1637 | 1635 |
1638 } // namespace ash | 1636 } // namespace ash |
OLD | NEW |