| Index: ui/aura/window_targeter_unittest.cc
|
| diff --git a/ui/aura/window_targeter_unittest.cc b/ui/aura/window_targeter_unittest.cc
|
| index 14dea716769c018e75f30205b558fb0a53a6df72..271d9eb60eed60be162d5ad562e2211a36049fe8 100644
|
| --- a/ui/aura/window_targeter_unittest.cc
|
| +++ b/ui/aura/window_targeter_unittest.cc
|
| @@ -67,9 +67,10 @@ TEST_F(WindowTargeterTest, Basic) {
|
| ui::test::TestEventHandler handler;
|
| one->AddPreTargetHandler(&handler);
|
|
|
| - ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(20, 20),
|
| - gfx::Point(20, 20), ui::EventTimeForNow(), ui::EF_NONE,
|
| - ui::EF_NONE);
|
| + ui::MouseEvent press(
|
| + ui::ET_MOUSE_PRESSED, gfx::Point(20, 20), gfx::Point(20, 20),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| DispatchEventUsingWindowDispatcher(&press);
|
| EXPECT_EQ(1, handler.num_mouse_events());
|
|
|
| @@ -94,8 +95,10 @@ TEST_F(WindowTargeterTest, ScopedWindowTargeter) {
|
|
|
| gfx::Point event_location(60, 60);
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(child, targeter->FindTargetForEvent(root, &mouse));
|
| }
|
|
|
| @@ -104,14 +107,18 @@ TEST_F(WindowTargeterTest, ScopedWindowTargeter) {
|
| new ScopedWindowTargeter(window.get(), scoped_ptr<ui::EventTargeter>(
|
| new StaticWindowTargeter(window.get()))));
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root, &mouse));
|
| }
|
| scoped_targeter.reset();
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(child, targeter->FindTargetForEvent(root, &mouse));
|
| }
|
| }
|
| @@ -144,8 +151,10 @@ TEST_F(WindowTargeterTest, TargetTransformedWindow) {
|
| ui::EventTargeter* targeter = root_target->GetEventTargeter();
|
| gfx::Point event_location(490, 50);
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse));
|
| }
|
|
|
| @@ -157,8 +166,10 @@ TEST_F(WindowTargeterTest, TargetTransformedWindow) {
|
| EXPECT_EQ(gfx::RectF(100, 20, 200, 40).ToString(),
|
| GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString());
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(root_window(), targeter->FindTargetForEvent(root_target, &mouse));
|
| }
|
|
|
| @@ -169,8 +180,10 @@ TEST_F(WindowTargeterTest, TargetTransformedWindow) {
|
| EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(),
|
| GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString());
|
| {
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, event_location, event_location,
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse));
|
| }
|
| }
|
| @@ -216,16 +229,20 @@ TEST_F(WindowTargeterTest, Bounds) {
|
| // Dispatch a mouse event that falls on the parent, but not on the child. When
|
| // the default event-targeter used, the event will still reach |grandchild|,
|
| // because the default targeter does not look at the bounds.
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(1, 1), gfx::Point(1, 1),
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(1, 1), gfx::Point(1, 1),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(parent_r, targeter->FindTargetForEvent(root_target, &mouse));
|
|
|
| // Install a targeter on the |child| that looks at the window id as well
|
| // as the bounds and makes sure the event reaches the target only if the id of
|
| // the window is equal to 2 (incorrect). This causes the event to get handled
|
| // by |parent|.
|
| - ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse2(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| scoped_ptr<ui::EventTargeter> original_targeter = child_r->SetEventTargeter(
|
| scoped_ptr<ui::EventTargeter>(new IdCheckingEventTargeter(2)));
|
| EXPECT_EQ(parent_r, targeter->FindTargetForEvent(root_target, &mouse2));
|
| @@ -233,8 +250,10 @@ TEST_F(WindowTargeterTest, Bounds) {
|
| // Now install a targeter on the |child| that looks at the window id as well
|
| // as the bounds and makes sure the event reaches the target only if the id of
|
| // the window is equal to 1 (correct).
|
| - ui::MouseEvent mouse3(ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent mouse3(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| child_r->SetEventTargeter(
|
| scoped_ptr<ui::EventTargeter>(new IdCheckingEventTargeter(1)));
|
| EXPECT_EQ(child_r, targeter->FindTargetForEvent(root_target, &mouse3));
|
| @@ -243,14 +262,17 @@ TEST_F(WindowTargeterTest, Bounds) {
|
| child_r->SetEventTargeter(original_targeter.Pass());
|
|
|
| // Target |grandchild| location.
|
| - ui::MouseEvent second(ui::ET_MOUSE_MOVED, gfx::Point(12, 12),
|
| - gfx::Point(12, 12), ui::EventTimeForNow(), ui::EF_NONE,
|
| - ui::EF_NONE);
|
| + ui::MouseEvent second(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(12, 12), gfx::Point(12, 12),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(grandchild_r, targeter->FindTargetForEvent(root_target, &second));
|
|
|
| // Target |child| location.
|
| - ui::MouseEvent third(ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| - ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
|
| + ui::MouseEvent third(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(8, 8), gfx::Point(8, 8),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(child_r, targeter->FindTargetForEvent(root_target, &third));
|
| }
|
|
|
| @@ -276,9 +298,10 @@ TEST_F(WindowTargeterTest, TargeterChecksOwningEventTarget) {
|
| ui::EventTarget* root_target = root_window();
|
| ui::EventTargeter* targeter = root_target->GetEventTargeter();
|
|
|
| - ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
|
| - gfx::Point(10, 10), ui::EventTimeForNow(), ui::EF_NONE,
|
| - ui::EF_NONE);
|
| + ui::MouseEvent mouse(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(child.get(), targeter->FindTargetForEvent(root_target, &mouse));
|
|
|
| // Install an event targeter on |child| which always prevents the target from
|
| @@ -286,9 +309,10 @@ TEST_F(WindowTargeterTest, TargeterChecksOwningEventTarget) {
|
| child->SetEventTargeter(
|
| scoped_ptr<ui::EventTargeter>(new IgnoreWindowTargeter()));
|
|
|
| - ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
|
| - gfx::Point(10, 10), ui::EventTimeForNow(), ui::EF_NONE,
|
| - ui::EF_NONE);
|
| + ui::MouseEvent mouse2(
|
| + ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
|
| + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
|
| + ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
|
| EXPECT_EQ(root_window(), targeter->FindTargetForEvent(root_target, &mouse2));
|
| }
|
|
|
|
|