Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 EXPECT_FALSE(wm::IsActiveWindow(window2.get())); 710 EXPECT_FALSE(wm::IsActiveWindow(window2.get()));
711 event_generator.ReleaseTouchId(kTouchId); 711 event_generator.ReleaseTouchId(kTouchId);
712 } 712 }
713 713
714 // Tests that a window does not receive located events when in overview mode. 714 // Tests that a window does not receive located events when in overview mode.
715 TEST_F(WindowSelectorTest, WindowDoesNotReceiveEvents) { 715 TEST_F(WindowSelectorTest, WindowDoesNotReceiveEvents) {
716 gfx::Rect window_bounds(20, 10, 200, 300); 716 gfx::Rect window_bounds(20, 10, 200, 300);
717 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 717 aura::Window* root_window = Shell::GetPrimaryRootWindow();
718 scoped_ptr<aura::Window> window(CreateWindow(window_bounds)); 718 scoped_ptr<aura::Window> window(CreateWindow(window_bounds));
719 719
720 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10); 720 auto point1 =
721 gfx::PointF(window_bounds.origin()) + gfx::Vector2dF(10.f, 10.f);
721 722
722 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1, 723 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1,
723 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 724 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
724 725
725 ui::EventTarget* root_target = root_window; 726 ui::EventTarget* root_target = root_window;
726 ui::EventTargeter* targeter = root_target->GetEventTargeter(); 727 ui::EventTargeter* targeter = root_target->GetEventTargeter();
727 728
728 // The event should target the window because we are still not in overview 729 // The event should target the window because we are still not in overview
729 // mode. 730 // mode.
730 EXPECT_EQ(window, static_cast<aura::Window*>( 731 EXPECT_EQ(window, static_cast<aura::Window*>(
731 targeter->FindTargetForEvent(root_target, &event1))); 732 targeter->FindTargetForEvent(root_target, &event1)));
732 733
733 ToggleOverview(); 734 ToggleOverview();
734 735
735 // The bounds have changed, take that into account. 736 // The bounds have changed, take that into account.
736 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get()); 737 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get());
737 gfx::Point point2(bounds.x() + 10, bounds.y() + 10); 738 gfx::PointF point2(bounds.x() + 10.f, bounds.y() + 10.f);
738 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2, 739 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2,
739 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 740 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
740 741
741 // Now the transparent window should be intercepting this event. 742 // Now the transparent window should be intercepting this event.
742 EXPECT_NE(window, static_cast<aura::Window*>( 743 EXPECT_NE(window, static_cast<aura::Window*>(
743 targeter->FindTargetForEvent(root_target, &event2))); 744 targeter->FindTargetForEvent(root_target, &event2)));
744 } 745 }
745 746
746 // Tests that clicking on the close button effectively closes the window. 747 // Tests that clicking on the close button effectively closes the window.
747 TEST_F(WindowSelectorTest, CloseButton) { 748 TEST_F(WindowSelectorTest, CloseButton) {
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 // Switch to overview mode. 1618 // Switch to overview mode.
1618 ToggleOverview(); 1619 ToggleOverview();
1619 ASSERT_TRUE(IsSelecting()); 1620 ASSERT_TRUE(IsSelecting());
1620 1621
1621 // Tap should now exit overview mode. 1622 // Tap should now exit overview mode.
1622 generator.GestureTapAt(point_in_background_page); 1623 generator.GestureTapAt(point_in_background_page);
1623 EXPECT_FALSE(IsSelecting()); 1624 EXPECT_FALSE(IsSelecting());
1624 } 1625 }
1625 1626
1626 } // namespace ash 1627 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698