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

Unified Diff: ui/events/event_processor_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_processor_unittest.cc
diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc
index f3a617defb1509ca25963f479c07d4f7709f2a82..36d48f908302a5791e7def5eb6f98a8ecf1cc2ab 100644
--- a/ui/events/event_processor_unittest.cc
+++ b/ui/events/event_processor_unittest.cc
@@ -67,8 +67,10 @@ TEST_F(EventProcessorTest, Basic) {
SetTarget(child.get());
root()->AddChild(std::move(child));
- MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -148,8 +150,10 @@ TEST_F(EventProcessorTest, NestedEventProcessing) {
// Dispatch a mouse event to the tree of event targets owned by the first
// event processor, checking in ReDispatchEventHandler that the phase and
// target information of the event is correct.
- MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
// Verify also that |mouse| was seen by the child nodes contained in both
@@ -165,8 +169,10 @@ TEST_F(EventProcessorTest, NestedEventProcessing) {
// Indicate that the child of the second root should handle events, and
// dispatch another mouse event to verify that it is marked as handled.
second_root->child_at(0)->set_mark_events_as_handled(true);
- MouseEvent mouse2(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse2(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse2);
EXPECT_EQ(1, target_handler->num_mouse_events());
EXPECT_TRUE(second_root->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -183,8 +189,10 @@ TEST_F(EventProcessorTest, OnEventProcessingFinished) {
// Dispatch a mouse event. We expect the event to be seen by the target,
// handled, and we expect OnEventProcessingFinished() to be invoked once.
- MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -205,8 +213,10 @@ TEST_F(EventProcessorTest, OnEventProcessingStarted) {
// OnEventProcessingStarted() should be called once, and
// OnEventProcessingFinished() should be called once. The event should
// remain unhandled.
- MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -222,8 +232,10 @@ TEST_F(EventProcessorTest, OnEventProcessingStarted) {
// seen by the target this time, but OnEventProcessingStarted() and
// OnEventProcessingFinished() should both still be called once.
processor()->set_should_processing_occur(false);
- MouseEvent mouse2(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse2(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse2);
EXPECT_FALSE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -363,8 +375,10 @@ TEST_F(EventProcessorTest, HandlerSequence) {
post_grandchild.set_recorder(&recorder);
grandchild_r->AddPostTargetHandler(&post_grandchild);
- MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
- EventTimeForNow(), EF_NONE, EF_NONE);
+ MouseEvent mouse(
+ ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), EventTimeForNow(),
+ EF_NONE, EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
std::string expected[] = { "PreR", "PreC", "PreG", "G", "PostG", "PostC",

Powered by Google App Engine
This is Rietveld 408576698