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

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

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 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/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/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 } 727 }
728 728
729 // Tests that a window does not receive located events when in overview mode. 729 // Tests that a window does not receive located events when in overview mode.
730 TEST_F(WindowSelectorTest, WindowDoesNotReceiveEvents) { 730 TEST_F(WindowSelectorTest, WindowDoesNotReceiveEvents) {
731 gfx::Rect window_bounds(20, 10, 200, 300); 731 gfx::Rect window_bounds(20, 10, 200, 300);
732 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 732 aura::Window* root_window = Shell::GetPrimaryRootWindow();
733 std::unique_ptr<aura::Window> window(CreateWindow(window_bounds)); 733 std::unique_ptr<aura::Window> window(CreateWindow(window_bounds));
734 734
735 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10); 735 gfx::Point point1(window_bounds.x() + 10, window_bounds.y() + 10);
736 736
737 ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point1, point1, 737 ui::MouseEvent event1(
738 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 738 ui::ET_MOUSE_PRESSED, point1, point1, ui::EventTimeForNow(), ui::EF_NONE,
739 ui::EF_NONE,
740 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
739 741
740 ui::EventTarget* root_target = root_window; 742 ui::EventTarget* root_target = root_window;
741 ui::EventTargeter* targeter = 743 ui::EventTargeter* targeter =
742 root_window->GetHost()->dispatcher()->GetDefaultEventTargeter(); 744 root_window->GetHost()->dispatcher()->GetDefaultEventTargeter();
743 745
744 // The event should target the window because we are still not in overview 746 // The event should target the window because we are still not in overview
745 // mode. 747 // mode.
746 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &event1)); 748 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &event1));
747 749
748 ToggleOverview(); 750 ToggleOverview();
749 751
750 // The bounds have changed, take that into account. 752 // The bounds have changed, take that into account.
751 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window.get()); 753 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window.get());
752 gfx::Point point2(bounds.x() + 10, bounds.y() + 10); 754 gfx::Point point2(bounds.x() + 10, bounds.y() + 10);
753 ui::MouseEvent event2(ui::ET_MOUSE_PRESSED, point2, point2, 755 ui::MouseEvent event2(
754 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 756 ui::ET_MOUSE_PRESSED, point2, point2, ui::EventTimeForNow(), ui::EF_NONE,
757 ui::EF_NONE,
758 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
755 759
756 // Now the transparent window should be intercepting this event. 760 // Now the transparent window should be intercepting this event.
757 EXPECT_NE(window.get(), targeter->FindTargetForEvent(root_target, &event2)); 761 EXPECT_NE(window.get(), targeter->FindTargetForEvent(root_target, &event2));
758 } 762 }
759 763
760 // Tests that clicking on the close button effectively closes the window. 764 // Tests that clicking on the close button effectively closes the window.
761 TEST_F(WindowSelectorTest, CloseButton) { 765 TEST_F(WindowSelectorTest, CloseButton) {
762 std::unique_ptr<views::Widget> widget = 766 std::unique_ptr<views::Widget> widget =
763 CreateWindowWidget(gfx::Rect(0, 0, 400, 400)); 767 CreateWindowWidget(gfx::Rect(0, 0, 400, 400));
764 768
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 1863 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
1860 ASSERT_TRUE(resizer.get()); 1864 ASSERT_TRUE(resizer.get());
1861 gfx::Point location = resizer->GetInitialLocation(); 1865 gfx::Point location = resizer->GetInitialLocation();
1862 location.Offset(20, 20); 1866 location.Offset(20, 20);
1863 resizer->Drag(location, 0); 1867 resizer->Drag(location, 0);
1864 ToggleOverview(); 1868 ToggleOverview();
1865 resizer->RevertDrag(); 1869 resizer->RevertDrag();
1866 } 1870 }
1867 1871
1868 } // namespace ash 1872 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698