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

Unified Diff: ui/views/widget/widget_unittest.cc

Issue 703643004: Revert of Do not interchange MOUSE_MOVED and MOUSE_DRAGGED events in Widget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget_unittest.cc
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 60607acb8819348e7e93a33994a9474134ac6780..e006e068aae4f74568a33c440149b9647211d1df 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -3193,84 +3193,6 @@
widget->CloseNow();
}
-// Tests that a view does not receive entered, dragged, or moved events if
-// a mouse cursor is moved into it while the left mouse button is pressed.
-TEST_F(WidgetTest, DragIntoView) {
- EventCountView* container = new EventCountView;
- container->SetBounds(0, 0, 100, 80);
-
- EventCountView* consume_view = new EventCountView;
- consume_view->set_handle_mode(EventCountView::CONSUME_EVENTS);
- consume_view->SetBounds(10, 10, 50, 40);
-
- Widget* widget = CreateTopLevelFramelessPlatformWidget();
- widget->SetBounds(gfx::Rect(0, 0, 100, 80));
- widget->SetContentsView(container);
- container->AddChildView(consume_view);
-
- widget->Show();
-
- ui::test::EventGenerator generator(GetContext(), widget->GetNativeWindow());
- generator.set_current_location(gfx::Point(75, 15));
-
- generator.PressLeftButton();
- generator.MoveMouseTo(gfx::Point(20, 20));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_ENTERED));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_DRAGGED));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_MOVED));
-
- widget->CloseNow();
-}
-
-// Tests that a view receives the correct mouse events if a mouse cursor
-// is moved out of its bounds while the left mouse button is pressed.
-TEST_F(WidgetTest, DragOutOfView) {
- EventCountView* container = new EventCountView;
- container->SetBounds(0, 0, 100, 80);
-
- EventCountView* consume_view = new EventCountView;
- consume_view->set_handle_mode(EventCountView::CONSUME_EVENTS);
- consume_view->SetBounds(10, 10, 50, 40);
-
- Widget* widget = CreateTopLevelFramelessPlatformWidget();
- widget->SetBounds(gfx::Rect(0, 0, 100, 80));
- widget->SetContentsView(container);
- container->AddChildView(consume_view);
-
- widget->Show();
-
- ui::test::EventGenerator generator(GetContext(), widget->GetNativeWindow());
- generator.set_current_location(gfx::Point(20, 20));
-
- generator.PressLeftButton();
- EXPECT_EQ(1, consume_view->GetEventCount(ui::ET_MOUSE_PRESSED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_PRESSED));
- consume_view->ResetCounts();
-
- generator.MoveMouseTo(gfx::Point(70, 70));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_EXITED));
- EXPECT_EQ(1, consume_view->GetEventCount(ui::ET_MOUSE_DRAGGED));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_MOVED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_ENTERED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_DRAGGED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_MOVED));
- consume_view->ResetCounts();
-
- generator.MoveMouseTo(gfx::Point(71, 71));
- EXPECT_EQ(1, consume_view->GetEventCount(ui::ET_MOUSE_DRAGGED));
- EXPECT_EQ(0, consume_view->GetEventCount(ui::ET_MOUSE_MOVED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_DRAGGED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_MOVED));
- consume_view->ResetCounts();
-
- generator.ReleaseLeftButton();
- EXPECT_EQ(1, consume_view->GetEventCount(ui::ET_MOUSE_RELEASED));
- EXPECT_EQ(0, container->GetEventCount(ui::ET_MOUSE_RELEASED));
- consume_view->ResetCounts();
-
- widget->CloseNow();
-}
-
// Tests that the root view is correctly set up for Widget types that do not
// require a non-client view, before any other views are added to the widget.
// That is, before Widget::ReorderNativeViews() is called which, if called with
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698