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

Unified Diff: ui/events/event_dispatcher_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/events/event_dispatcher_unittest.cc
diff --git a/ui/events/event_dispatcher_unittest.cc b/ui/events/event_dispatcher_unittest.cc
index 8443dda83e74ed965a9877720fa2f366c0fe926d..e85cb992ea18f24a20dff03f3588821428328a92 100644
--- a/ui/events/event_dispatcher_unittest.cc
+++ b/ui/events/event_dispatcher_unittest.cc
@@ -240,8 +240,10 @@ TEST(EventDispatcherTest, EventDispatchOrder) {
h7.set_expect_post_target(true);
h8.set_expect_post_target(true);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
Event::DispatcherApi event_mod(&mouse);
dispatcher.ProcessEvent(&child, &mouse);
EXPECT_FALSE(mouse.stopped_propagation());
@@ -314,8 +316,10 @@ TEST(EventDispatcherTest, EventDispatchPhase) {
handler.set_expect_pre_target(true);
handler.set_expect_post_target(true);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
Event::DispatcherApi event_mod(&mouse);
dispatcher.ProcessEvent(&target, &mouse);
EXPECT_EQ(ER_UNHANDLED, mouse.result());
@@ -346,8 +350,10 @@ TEST(EventDispatcherTest, EventDispatcherDestroyedDuringDispatch) {
// destroyed the dispatcher.
h2.set_expect_pre_target(false);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
EventDispatchDetails details = dispatcher->ProcessEvent(&target, &mouse);
EXPECT_TRUE(details.dispatcher_destroyed);
EXPECT_EQ(ER_CONSUMED, mouse.result());
@@ -398,8 +404,10 @@ TEST(EventDispatcherTest, EventDispatcherDestroyedDuringDispatch) {
// destroyed the dispatcher.
h2.set_expect_post_target(false);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
EventDispatchDetails details = dispatcher->ProcessEvent(&target, &mouse);
EXPECT_TRUE(details.dispatcher_destroyed);
EXPECT_EQ(ER_CONSUMED, mouse.result());
@@ -452,8 +460,10 @@ TEST(EventDispatcherTest, EventDispatcherInvalidateTarget) {
// |h3| should not receive events as the target will be invalidated.
h3.set_expect_pre_target(false);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
EventDispatchDetails details = dispatcher.ProcessEvent(&target, &mouse);
EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_TRUE(details.target_destroyed);
@@ -495,8 +505,10 @@ TEST(EventDispatcherTest, EventHandlerDestroyedDuringDispatch) {
// destroyed it.
h3->set_expect_pre_target(false);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
EventDispatchDetails details = dispatcher.ProcessEvent(&target, &mouse);
EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_FALSE(details.target_destroyed);
@@ -553,8 +565,10 @@ TEST(EventDispatcherTest, EventHandlerAndDispatcherDestroyedDuringDispatch) {
// it.
h3->set_expect_pre_target(false);
- MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
- ui::EventTimeForNow(), 0, 0);
+ MouseEvent mouse(
+ ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4),
+ ui::EventTimeForNow(), 0, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
EventDispatchDetails details = dispatcher->ProcessEvent(&target, &mouse);
EXPECT_TRUE(details.dispatcher_destroyed);
EXPECT_TRUE(mouse.stopped_propagation());

Powered by Google App Engine
This is Rietveld 408576698