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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
index 6321b2b3e4f1a6bbf8e0314d3c4a38d70b6233d5..cda193c7a3712581517ce392ba81e486212ba3ee 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -466,9 +466,10 @@ TEST_F(DesktopAuraWidgetTest, TopLevelOwnedPopupRepositionTest) {
// and release stopping at |last_event_type|.
void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) {
const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen());
- ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(),
- screen_bounds.CenterPoint(), ui::EventTimeForNow(),
- 0, 0);
+ ui::MouseEvent move_event(
+ ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(),
+ screen_bounds.CenterPoint(), ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventSink* sink = WidgetTest::GetEventSink(widget);
ui::EventDispatchDetails details = sink->OnEventFromSource(&move_event);
if (last_event_type == ui::ET_MOUSE_ENTERED || details.dispatcher_destroyed)
@@ -477,23 +478,26 @@ void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) {
if (last_event_type == ui::ET_MOUSE_MOVED || details.dispatcher_destroyed)
return;
- ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, screen_bounds.CenterPoint(),
- screen_bounds.CenterPoint(), ui::EventTimeForNow(),
- 0, 0);
+ ui::MouseEvent press_event(
+ ui::ET_MOUSE_PRESSED, screen_bounds.CenterPoint(),
+ screen_bounds.CenterPoint(), ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details = sink->OnEventFromSource(&press_event);
if (last_event_type == ui::ET_MOUSE_PRESSED || details.dispatcher_destroyed)
return;
gfx::Point end_point(screen_bounds.CenterPoint());
end_point.Offset(1, 1);
- ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, end_point, end_point,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent drag_event(
+ ui::ET_MOUSE_DRAGGED, end_point, end_point, ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details = sink->OnEventFromSource(&drag_event);
if (last_event_type == ui::ET_MOUSE_DRAGGED || details.dispatcher_destroyed)
return;
- ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, end_point, end_point,
- ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent release_event(
+ ui::ET_MOUSE_RELEASED, end_point, end_point, ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details = sink->OnEventFromSource(&release_event);
if (details.dispatcher_destroyed)
return;
@@ -565,9 +569,10 @@ TEST_F(WidgetTest, WindowMouseModalityTest) {
top_level_widget.GetRootView()->AddChildView(widget_view);
gfx::Point cursor_location_main(5, 5);
- ui::MouseEvent move_main(ui::ET_MOUSE_MOVED, cursor_location_main,
- cursor_location_main, ui::EventTimeForNow(),
- ui::EF_NONE, ui::EF_NONE);
+ ui::MouseEvent move_main(
+ ui::ET_MOUSE_MOVED, cursor_location_main, cursor_location_main,
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details =
GetEventSink(&top_level_widget)->OnEventFromSource(&move_main);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -593,7 +598,8 @@ TEST_F(WidgetTest, WindowMouseModalityTest) {
gfx::Point cursor_location_dialog(100, 100);
ui::MouseEvent mouse_down_dialog(
ui::ET_MOUSE_PRESSED, cursor_location_dialog, cursor_location_dialog,
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details =
GetEventSink(&top_level_widget)->OnEventFromSource(&mouse_down_dialog);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -602,9 +608,10 @@ TEST_F(WidgetTest, WindowMouseModalityTest) {
// Send a mouse move message to the main window. It should not be received by
// the main window as the modal dialog is still active.
gfx::Point cursor_location_main2(6, 6);
- ui::MouseEvent mouse_down_main(ui::ET_MOUSE_MOVED, cursor_location_main2,
- cursor_location_main2, ui::EventTimeForNow(),
- ui::EF_NONE, ui::EF_NONE);
+ ui::MouseEvent mouse_down_main(
+ ui::ET_MOUSE_MOVED, cursor_location_main2, cursor_location_main2,
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details =
GetEventSink(&top_level_widget)->OnEventFromSource(&mouse_down_main);
ASSERT_FALSE(details.dispatcher_destroyed);
« ui/events/event.h ('K') | « ui/views/view_unittest.cc ('k') | ui/views/widget/root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698