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

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

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10);
721 721
722 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1, 722 ui::MouseEvent event1(
723 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 723 ui::ET_MOUSE_PRESSED, point1, point1, ui::EventTimeForNow(), ui::EF_NONE,
724 ui::EF_NONE,
725 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
724 726
725 ui::EventTarget* root_target = root_window; 727 ui::EventTarget* root_target = root_window;
726 ui::EventTargeter* targeter = root_target->GetEventTargeter(); 728 ui::EventTargeter* targeter = root_target->GetEventTargeter();
727 729
728 // The event should target the window because we are still not in overview 730 // The event should target the window because we are still not in overview
729 // mode. 731 // mode.
730 EXPECT_EQ(window, static_cast<aura::Window*>( 732 EXPECT_EQ(window, static_cast<aura::Window*>(
731 targeter->FindTargetForEvent(root_target, &event1))); 733 targeter->FindTargetForEvent(root_target, &event1)));
732 734
733 ToggleOverview(); 735 ToggleOverview();
734 736
735 // The bounds have changed, take that into account. 737 // The bounds have changed, take that into account.
736 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get()); 738 gfx::RectF bounds = GetTransformedBoundsInRootWindow(window.get());
737 gfx::Point point2(bounds.x() + 10, bounds.y() + 10); 739 gfx::Point point2(bounds.x() + 10, bounds.y() + 10);
738 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2, 740 ui::MouseEvent event2(
739 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 741 ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), ui::EF_NONE,
742 ui::EF_NONE,
743 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
740 744
741 // Now the transparent window should be intercepting this event. 745 // Now the transparent window should be intercepting this event.
742 EXPECT_NE(window, static_cast<aura::Window*>( 746 EXPECT_NE(window, static_cast<aura::Window*>(
743 targeter->FindTargetForEvent(root_target, &event2))); 747 targeter->FindTargetForEvent(root_target, &event2)));
744 } 748 }
745 749
746 // Tests that clicking on the close button effectively closes the window. 750 // Tests that clicking on the close button effectively closes the window.
747 TEST_F(WindowSelectorTest, CloseButton) { 751 TEST_F(WindowSelectorTest, CloseButton) {
748 scoped_ptr<views::Widget> widget = 752 scoped_ptr<views::Widget> widget =
749 CreateWindowWidget(gfx::Rect(0, 0, 400, 400)); 753 CreateWindowWidget(gfx::Rect(0, 0, 400, 400));
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 // Switch to overview mode. 1621 // Switch to overview mode.
1618 ToggleOverview(); 1622 ToggleOverview();
1619 ASSERT_TRUE(IsSelecting()); 1623 ASSERT_TRUE(IsSelecting());
1620 1624
1621 // Tap should now exit overview mode. 1625 // Tap should now exit overview mode.
1622 generator.GestureTapAt(point_in_background_page); 1626 generator.GestureTapAt(point_in_background_page);
1623 EXPECT_FALSE(IsSelecting()); 1627 EXPECT_FALSE(IsSelecting());
1624 } 1628 }
1625 1629
1626 } // namespace ash 1630 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698