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

Unified Diff: ui/events/event_processor_unittest.cc

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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 a0ab5b63f9088412978cd78d284262e34fbd909e..e3b32d9413e88bb06da0f98e5370091f13fe4006 100644
--- a/ui/events/event_processor_unittest.cc
+++ b/ui/events/event_processor_unittest.cc
@@ -64,8 +64,10 @@ TEST_F(EventProcessorTest, Basic) {
SetTarget(child.get());
root()->AddChild(child.Pass());
- 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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -144,8 +146,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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
// Verify also that |mouse| was seen by the child nodes contained in both
@@ -159,8 +163,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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse2);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_TRUE(second_root->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -177,8 +183,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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -199,8 +207,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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse);
EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -216,8 +226,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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
DispatchEvent(&mouse2);
EXPECT_FALSE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
@@ -357,8 +369,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::PointerEventDetails(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