| Index: ui/views/widget/widget_interactive_uitest.cc
|
| diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
|
| index e1e0e49a0719ed3c28713410e4c504017be1d567..4dc024d9e583dc7b92e220055c766309a24ebb1b 100644
|
| --- a/ui/views/widget/widget_interactive_uitest.cc
|
| +++ b/ui/views/widget/widget_interactive_uitest.cc
|
| @@ -367,9 +367,10 @@ TEST_F(WidgetTestInteractive, CaptureAutoReset) {
|
|
|
| // By default, mouse release removes capture.
|
| gfx::Point click_location(45, 15);
|
| - ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| - ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent release(
|
| + ui::ET_MOUSE_RELEASED, click_location, click_location,
|
| + ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&release);
|
| EXPECT_FALSE(toplevel->HasCapture());
|
|
|
| @@ -419,12 +420,14 @@ TEST_F(WidgetTestInteractive, ResetCaptureOnGestureEnd) {
|
| // will not receive the event.
|
| gfx::Point click_location(45, 15);
|
|
|
| - ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| - ui::EF_LEFT_MOUSE_BUTTON);
|
| - ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| - ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent press(
|
| + ui::ET_MOUSE_PRESSED, click_location, click_location,
|
| + ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| + ui::MouseEvent release(
|
| + ui::ET_MOUSE_RELEASED, click_location, click_location,
|
| + ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
|
|
| EXPECT_TRUE(toplevel->HasCapture());
|
|
|
| @@ -470,14 +473,18 @@ TEST_F(WidgetTestInteractive, DisableCaptureWidgetFromMousePress) {
|
|
|
| gfx::Point location(20, 20);
|
| base::MessageLoop::current()->PostTask(
|
| - FROM_HERE, base::Bind(&Widget::OnMouseEvent, base::Unretained(second),
|
| - base::Owned(new ui::MouseEvent(
|
| - ui::ET_MOUSE_RELEASED, location, location,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| - ui::EF_LEFT_MOUSE_BUTTON))));
|
| - ui::MouseEvent press(ui::ET_MOUSE_PRESSED, location, location,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| - ui::EF_LEFT_MOUSE_BUTTON);
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &Widget::OnMouseEvent, base::Unretained(second),
|
| + base::Owned(new ui::MouseEvent(
|
| + ui::ET_MOUSE_RELEASED, location, location, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(
|
| + ui::EventPointerType::POINTER_TYPE_MOUSE)))));
|
| + ui::MouseEvent press(
|
| + ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| first->OnMouseEvent(&press);
|
| EXPECT_FALSE(first->HasCapture());
|
| first->Close();
|
| @@ -508,16 +515,20 @@ TEST_F(WidgetTestInteractive, DISABLED_GrabUngrab) {
|
|
|
| // Click on child1
|
| gfx::Point p1(45, 45);
|
| - ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(),
|
| - ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent pressed(
|
| + ui::ET_MOUSE_PRESSED, p1, p1, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&pressed);
|
|
|
| EXPECT_TRUE(toplevel->HasCapture());
|
| EXPECT_TRUE(child1->HasCapture());
|
| EXPECT_FALSE(child2->HasCapture());
|
|
|
| - ui::MouseEvent released(ui::ET_MOUSE_RELEASED, p1, p1, ui::EventTimeForNow(),
|
| - ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent released(
|
| + ui::ET_MOUSE_RELEASED, p1, p1, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&released);
|
|
|
| EXPECT_FALSE(toplevel->HasCapture());
|
| @@ -528,16 +539,20 @@ TEST_F(WidgetTestInteractive, DISABLED_GrabUngrab) {
|
|
|
| // Click on child2
|
| gfx::Point p2(315, 45);
|
| - ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, p2, p2, ui::EventTimeForNow(),
|
| - ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent pressed2(
|
| + ui::ET_MOUSE_PRESSED, p2, p2, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&pressed2);
|
| EXPECT_TRUE(pressed2.handled());
|
| EXPECT_TRUE(toplevel->HasCapture());
|
| EXPECT_TRUE(child2->HasCapture());
|
| EXPECT_FALSE(child1->HasCapture());
|
|
|
| - ui::MouseEvent released2(ui::ET_MOUSE_RELEASED, p2, p2, ui::EventTimeForNow(),
|
| - ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| + ui::MouseEvent released2(
|
| + ui::ET_MOUSE_RELEASED, p2, p2, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&released2);
|
| EXPECT_FALSE(toplevel->HasCapture());
|
| EXPECT_FALSE(child1->HasCapture());
|
| @@ -562,24 +577,30 @@ TEST_F(WidgetTestInteractive, CheckResizeControllerEvents) {
|
|
|
| // Move to an outside position.
|
| gfx::Point p1(200, 200);
|
| - ui::MouseEvent moved_out(ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(),
|
| - ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent moved_out(
|
| + ui::ET_MOUSE_MOVED, p1, p1, ui::EventTimeForNow(), ui::EF_NONE,
|
| + ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&moved_out);
|
| EXPECT_EQ(0, view->EnteredCalls());
|
| EXPECT_EQ(0, view->ExitedCalls());
|
|
|
| // Move onto the active view.
|
| gfx::Point p2(95, 95);
|
| - ui::MouseEvent moved_over(ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(),
|
| - ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent moved_over(
|
| + ui::ET_MOUSE_MOVED, p2, p2, ui::EventTimeForNow(), ui::EF_NONE,
|
| + ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&moved_over);
|
| EXPECT_EQ(1, view->EnteredCalls());
|
| EXPECT_EQ(0, view->ExitedCalls());
|
|
|
| // Move onto the outer resizing border.
|
| gfx::Point p3(102, 95);
|
| - ui::MouseEvent moved_resizer(ui::ET_MOUSE_MOVED, p3, p3,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent moved_resizer(
|
| + ui::ET_MOUSE_MOVED, p3, p3, ui::EventTimeForNow(), ui::EF_NONE,
|
| + ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| toplevel->OnMouseEvent(&moved_resizer);
|
| EXPECT_EQ(0, view->EnteredCalls());
|
| EXPECT_EQ(1, view->ExitedCalls());
|
| @@ -1415,8 +1436,10 @@ TEST_F(WidgetCaptureTest, MouseEventDispatchedToRightWindow) {
|
| widget2.GetAndClearGotMouseEvent();
|
| // Send a mouse event to the RootWindow associated with |widget1|. Even though
|
| // |widget2| has capture, |widget1| should still get the event.
|
| - ui::MouseEvent mouse_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(),
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse_event(
|
| + ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
|
| + ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| ui::EventDispatchDetails details = widget1.GetNativeWindow()->
|
| GetHost()->event_processor()->OnEventFromSource(&mouse_event);
|
| ASSERT_FALSE(details.dispatcher_destroyed);
|
|
|