Index: ui/aura/window_event_dispatcher_unittest.cc |
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc |
index f0b7e00c2a9481003bfc32d556e04da717c77fce..fce66edea7afa71b66432717835d2ab1327e66fb 100644 |
--- a/ui/aura/window_event_dispatcher_unittest.cc |
+++ b/ui/aura/window_event_dispatcher_unittest.cc |
@@ -117,9 +117,10 @@ TEST_F(WindowEventDispatcherTest, OnHostMouseEvent) { |
// Send a mouse event to window1. |
gfx::Point point(101, 201); |
- ui::MouseEvent event1(ui::ET_MOUSE_PRESSED, point, point, |
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
- ui::EF_LEFT_MOUSE_BUTTON); |
+ ui::MouseEvent event1( |
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&event1); |
// Event was tested for non-client area for the target window. |
@@ -140,9 +141,10 @@ TEST_F(WindowEventDispatcherTest, RepostEvent) { |
// Test RepostEvent in RootWindow. It only works for Mouse Press. |
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); |
gfx::Point point(10, 10); |
- ui::MouseEvent event(ui::ET_MOUSE_PRESSED, point, point, |
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
- ui::EF_LEFT_MOUSE_BUTTON); |
+ ui::MouseEvent event( |
+ ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
host()->dispatcher()->RepostEvent(event); |
RunAllPendingInMessageLoop(); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
@@ -159,7 +161,8 @@ TEST_F(WindowEventDispatcherTest, MouseButtonState) { |
// Press the left button. |
event.reset(new ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(), |
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
DispatchEventUsingWindowDispatcher(event.get()); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
@@ -167,28 +170,32 @@ TEST_F(WindowEventDispatcherTest, MouseButtonState) { |
event.reset(new ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(), |
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, |
- ui::EF_RIGHT_MOUSE_BUTTON)); |
+ ui::EF_RIGHT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
DispatchEventUsingWindowDispatcher(event.get()); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
// Release the left button. |
event.reset(new ui::MouseEvent( |
ui::ET_MOUSE_RELEASED, location, location, ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
+ ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
DispatchEventUsingWindowDispatcher(event.get()); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
// Release the right button. We should ignore the Shift-is-down flag. |
- event.reset(new ui::MouseEvent(ui::ET_MOUSE_RELEASED, location, location, |
- ui::EventTimeForNow(), ui::EF_SHIFT_DOWN, |
- ui::EF_RIGHT_MOUSE_BUTTON)); |
+ event.reset(new ui::MouseEvent( |
+ ui::ET_MOUSE_RELEASED, location, location, ui::EventTimeForNow(), |
+ ui::EF_SHIFT_DOWN, ui::EF_RIGHT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
DispatchEventUsingWindowDispatcher(event.get()); |
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); |
// Press the middle button. |
event.reset(new ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(), |
- ui::EF_MIDDLE_MOUSE_BUTTON, ui::EF_MIDDLE_MOUSE_BUTTON)); |
+ ui::EF_MIDDLE_MOUSE_BUTTON, ui::EF_MIDDLE_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
DispatchEventUsingWindowDispatcher(event.get()); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
} |
@@ -198,8 +205,9 @@ TEST_F(WindowEventDispatcherTest, TranslatedEvent) { |
gfx::Rect(50, 50, 100, 100), root_window())); |
gfx::Point origin(100, 100); |
- ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, |
- ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent root( |
+ ui::ET_MOUSE_PRESSED, origin, origin, ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
EXPECT_EQ("100,100", root.location().ToString()); |
EXPECT_EQ("100,100", root.root_location().ToString()); |
@@ -626,7 +634,8 @@ TEST_F(WindowEventDispatcherTest, MAYBE(RepostTargetsCaptureWindow)) { |
window->SetCapture(); |
const ui::MouseEvent press_event( |
ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
host()->dispatcher()->RepostEvent(press_event); |
RunAllPendingInMessageLoop(); // Necessitated by RepostEvent(). |
// Mouse moves/enters may be generated. We only care about a pressed. |
@@ -642,9 +651,10 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
&delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
- ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), |
- gfx::Point(0, 0), ui::EventTimeForNow(), 0, |
- 0); |
+ ui::MouseEvent mouse_move_event( |
+ ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_move_event); |
// Discard MOUSE_ENTER. |
recorder.Reset(); |
@@ -652,17 +662,19 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
host()->dispatcher()->HoldPointerMoves(); |
// Check that we don't immediately dispatch the MOUSE_DRAGGED event. |
- ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), |
- gfx::Point(0, 0), ui::EventTimeForNow(), 0, |
- 0); |
+ ui::MouseEvent mouse_dragged_event( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
EXPECT_TRUE(recorder.events().empty()); |
// Check that we do dispatch the held MOUSE_DRAGGED event before another type |
// of event. |
- ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), |
- gfx::Point(0, 0), ui::EventTimeForNow(), 0, |
- 0); |
+ ui::MouseEvent mouse_pressed_event( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
EventTypesToString(recorder.events())); |
@@ -671,18 +683,21 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
// Check that we coalesce held MOUSE_DRAGGED events. Note that here (and |
// elsewhere in this test) we re-define each event prior to dispatch so that |
// it has the correct state (phase, handled, target, etc.). |
- mouse_dragged_event = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
- ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- 0, 0); |
+ mouse_dragged_event = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
+ ui::MouseEvent mouse_dragged_event2( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
EXPECT_TRUE(recorder.events().empty()); |
- mouse_pressed_event = |
- ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
+ mouse_pressed_event = ui::MouseEvent( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
EventTypesToString(recorder.events())); |
@@ -690,9 +705,10 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
// Check that on ReleasePointerMoves, held events are not dispatched |
// immediately, but posted instead. |
- mouse_dragged_event = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
+ mouse_dragged_event = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
host()->dispatcher()->ReleasePointerMoves(); |
EXPECT_TRUE(recorder.events().empty()); |
@@ -703,14 +719,16 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
// However if another message comes in before the dispatch of the posted |
// event, check that the posted event is dispatched before this new event. |
host()->dispatcher()->HoldPointerMoves(); |
- mouse_dragged_event = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
+ mouse_dragged_event = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
host()->dispatcher()->ReleasePointerMoves(); |
- mouse_pressed_event = |
- ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
+ mouse_pressed_event = ui::MouseEvent( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_pressed_event); |
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", |
EventTypesToString(recorder.events())); |
@@ -721,14 +739,16 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
// Check that if the other message is another MOUSE_DRAGGED, we still coalesce |
// them. |
host()->dispatcher()->HoldPointerMoves(); |
- mouse_dragged_event = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
+ mouse_dragged_event = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
host()->dispatcher()->ReleasePointerMoves(); |
- mouse_dragged_event2 = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
+ mouse_dragged_event2 = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(recorder.events())); |
recorder.Reset(); |
@@ -737,15 +757,18 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) { |
// Check that synthetic mouse move event has a right location when issued |
// while holding pointer moves. |
- mouse_dragged_event = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
- ui::EventTimeForNow(), 0, 0); |
- mouse_dragged_event2 = |
- ui::MouseEvent(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
- ui::MouseEvent mouse_dragged_event3(ui::ET_MOUSE_DRAGGED, gfx::Point(28, 28), |
- gfx::Point(28, 28), ui::EventTimeForNow(), |
- 0, 0); |
+ mouse_dragged_event = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), gfx::Point(0, 0), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
+ mouse_dragged_event2 = ui::MouseEvent( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
+ ui::MouseEvent mouse_dragged_event3( |
+ ui::ET_MOUSE_DRAGGED, gfx::Point(28, 28), gfx::Point(28, 28), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
host()->dispatcher()->HoldPointerMoves(); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event); |
DispatchEventUsingWindowDispatcher(&mouse_dragged_event2); |
@@ -835,8 +858,9 @@ TEST_F(WindowEventDispatcherTest, MouseEventWithoutTargetWindow) { |
window_second->AddPreTargetHandler(&recorder_second); |
const gfx::Point event_location(22, 33); |
- ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
- ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse( |
+ ui::ET_MOUSE_MOVED, event_location, event_location, ui::EventTimeForNow(), |
+ 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse); |
EXPECT_TRUE(recorder_first.events().empty()); |
@@ -860,8 +884,9 @@ TEST_F(WindowEventDispatcherTest, DispatchMouseExitWhenHidingWindow) { |
// Dispatch a mouse move event into the window. |
const gfx::Point event_location(22, 33); |
- ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
- ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse( |
+ ui::ET_MOUSE_MOVED, event_location, event_location, ui::EventTimeForNow(), |
+ 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse); |
EXPECT_FALSE(recorder.events().empty()); |
recorder.Reset(); |
@@ -997,16 +1022,19 @@ TEST_F(WindowEventDispatcherTest, DispatchSyntheticMouseEvents) { |
test::TestCursorClient cursor_client(root_window()); |
// Dispatch a non-synthetic mouse event when mouse events are enabled. |
- ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse1( |
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse1); |
EXPECT_FALSE(recorder.events().empty()); |
recorder.Reset(); |
// Dispatch a synthetic mouse event when mouse events are enabled. |
- ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_IS_SYNTHESIZED, 0); |
+ ui::MouseEvent mouse2( |
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_IS_SYNTHESIZED, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse2); |
EXPECT_FALSE(recorder.events().empty()); |
recorder.Reset(); |
@@ -1028,9 +1056,10 @@ TEST_F(WindowEventDispatcherTest, DoNotSynthesizeWhileButtonDown) { |
window->AddPreTargetHandler(&recorder); |
// Dispatch a non-synthetic mouse event when mouse events are enabled. |
- ui::MouseEvent mouse1(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
+ ui::MouseEvent mouse1( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse1); |
ASSERT_EQ(1u, recorder.events().size()); |
EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder.events()[0]); |
@@ -1068,8 +1097,10 @@ TEST_F(WindowEventDispatcherTest, |
window->AddPreTargetHandler(&recorder); |
// Dispatch a non-synthetic mouse event to place cursor inside window bounds. |
- ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse( |
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse); |
EXPECT_FALSE(recorder.events().empty()); |
recorder.Reset(); |
@@ -1123,8 +1154,9 @@ TEST_F(WindowEventDispatcherTest, DispatchMouseExitWhenCursorHidden) { |
// Dispatch a mouse move event into the window. |
gfx::Point mouse_location(gfx::Point(15, 25)); |
- ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, mouse_location, |
- ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse1( |
+ ui::ET_MOUSE_MOVED, mouse_location, mouse_location, ui::EventTimeForNow(), |
+ 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
EXPECT_TRUE(recorder.events().empty()); |
DispatchEventUsingWindowDispatcher(&mouse1); |
EXPECT_FALSE(recorder.events().empty()); |
@@ -1160,8 +1192,9 @@ TEST_F(WindowEventDispatcherTest, |
// Dispatch a mouse move event into the window. |
gfx::Point mouse_location(gfx::Point(15, 25)); |
- ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, mouse_location, |
- ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent mouse1( |
+ ui::ET_MOUSE_MOVED, mouse_location, mouse_location, ui::EventTimeForNow(), |
+ 0, 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
EXPECT_TRUE(recorder.events().empty()); |
DispatchEventUsingWindowDispatcher(&mouse1); |
EXPECT_FALSE(recorder.events().empty()); |
@@ -1171,9 +1204,10 @@ TEST_F(WindowEventDispatcherTest, |
cursor_client.DisableMouseEvents(); |
gfx::Point mouse_exit_location(gfx::Point(150, 150)); |
- ui::MouseEvent mouse2(ui::ET_MOUSE_EXITED, gfx::Point(150, 150), |
- gfx::Point(150, 150), ui::EventTimeForNow(), |
- ui::EF_IS_SYNTHESIZED, 0); |
+ ui::MouseEvent mouse2( |
+ ui::ET_MOUSE_EXITED, gfx::Point(150, 150), gfx::Point(150, 150), |
+ ui::EventTimeForNow(), ui::EF_IS_SYNTHESIZED, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse2); |
EXPECT_FALSE(recorder.events().empty()); |
@@ -1656,9 +1690,10 @@ class DontResetHeldEventWindowDelegate : public test::TestWindowDelegate { |
void OnMouseEvent(ui::MouseEvent* event) override { |
if ((event->flags() & ui::EF_SHIFT_DOWN) != 0 && |
mouse_event_count_++ == 0) { |
- ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_SHIFT_DOWN, 0); |
+ ui::MouseEvent mouse_event( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_SHIFT_DOWN, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
root_->GetHost()->dispatcher()->RepostEvent(mouse_event); |
} |
} |
@@ -1681,12 +1716,15 @@ TEST_F(WindowEventDispatcherTest, DontResetHeldEvent) { |
DontResetHeldEventWindowDelegate delegate(root_window()); |
scoped_ptr<Window> w1(CreateNormalWindow(1, root_window(), &delegate)); |
w1->SetBounds(gfx::Rect(0, 0, 40, 40)); |
- ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_SHIFT_DOWN, 0); |
+ ui::MouseEvent pressed( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_SHIFT_DOWN, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
root_window()->GetHost()->dispatcher()->RepostEvent(pressed); |
- ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
+ ui::MouseEvent pressed2( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), 0, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
// Dispatch an event to flush event scheduled by way of RepostEvent(). |
DispatchEventUsingWindowDispatcher(&pressed2); |
// Delegate should have seen reposted event (identified by way of |
@@ -1742,9 +1780,10 @@ TEST_F(WindowEventDispatcherTest, DeleteHostFromHeldMouseEvent) { |
// Owned by |h2|. |
Window* w1 = CreateNormalWindow(1, h2->window(), &delegate); |
w1->SetBounds(gfx::Rect(0, 0, 40, 40)); |
- ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_SHIFT_DOWN, 0); |
+ ui::MouseEvent pressed( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_SHIFT_DOWN, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
h2->dispatcher()->RepostEvent(pressed); |
// RunAllPendingInMessageLoop() to make sure the |pressed| is run. |
RunAllPendingInMessageLoop(); |
@@ -1948,7 +1987,8 @@ class WindowEventDispatcherTestWithMessageLoop |
// the reposted event should not have fired. |
scoped_ptr<ui::MouseEvent> mouse(new ui::MouseEvent( |
ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE)); |
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
message_loop()->PostTask( |
FROM_HERE, |
base::Bind(&WindowEventDispatcherTestWithMessageLoop::RepostEventHelper, |
@@ -2033,18 +2073,20 @@ TEST_F(WindowEventDispatcherTestInHighDPI, EventLocationTransform) { |
child->AddPreTargetHandler(&handler_child); |
{ |
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(30, 30), |
- gfx::Point(30, 30), ui::EventTimeForNow(), ui::EF_NONE, |
- ui::EF_NONE); |
+ ui::MouseEvent move( |
+ ui::ET_MOUSE_MOVED, gfx::Point(30, 30), gfx::Point(30, 30), |
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&move); |
EXPECT_EQ(0, handler_child.num_mouse_events()); |
EXPECT_EQ(1, handler_root.num_mouse_events()); |
} |
{ |
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(50, 50), |
- gfx::Point(50, 50), ui::EventTimeForNow(), ui::EF_NONE, |
- ui::EF_NONE); |
+ ui::MouseEvent move( |
+ ui::ET_MOUSE_MOVED, gfx::Point(50, 50), gfx::Point(50, 50), |
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&move); |
// The child receives an ENTER, and a MOVED event. |
EXPECT_EQ(2, handler_child.num_mouse_events()); |
@@ -2132,19 +2174,21 @@ TEST_F(WindowEventDispatcherTestInHighDPI, |
// Make sure the window is visible. |
RunAllPendingInMessageLoop(); |
- ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, gfx::Point(80, 80), |
- gfx::Point(80, 80), ui::EventTimeForNow(), |
- ui::EF_NONE, ui::EF_NONE); |
+ ui::MouseEvent mouse_move( |
+ ui::ET_MOUSE_MOVED, gfx::Point(80, 80), gfx::Point(80, 80), |
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
const base::Closure callback_on_right_click = base::Bind( |
base::IgnoreResult(&WindowEventDispatcherTestInHighDPI::DispatchEvent), |
base::Unretained(this), base::Unretained(&mouse_move)); |
TriggerNestedLoopOnRightMousePress handler(callback_on_right_click); |
window->AddPreTargetHandler(&handler); |
- scoped_ptr<ui::MouseEvent> mouse( |
- new ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EventTimeForNow(), |
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
+ scoped_ptr<ui::MouseEvent> mouse(new ui::MouseEvent( |
+ ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), |
+ ui::EventTimeForNow(), ui::EF_RIGHT_MOUSE_BUTTON, |
+ ui::EF_RIGHT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
host()->dispatcher()->RepostEvent(*mouse); |
EXPECT_EQ(0, handler.num_mouse_events()); |
@@ -2185,8 +2229,10 @@ TEST_F(WindowEventDispatcherTest, SynthesizedLocatedEvent) { |
Env::GetInstance()->last_mouse_location().ToString()); |
// Synthesized event should not update the mouse location. |
- ui::MouseEvent mouseev(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), |
- ui::EventTimeForNow(), ui::EF_IS_SYNTHESIZED, 0); |
+ ui::MouseEvent mouseev( |
+ ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
+ ui::EF_IS_SYNTHESIZED, 0, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
generator.Dispatch(&mouseev); |
EXPECT_EQ("10,10", |
Env::GetInstance()->last_mouse_location().ToString()); |
@@ -2280,9 +2326,11 @@ class DispatchEventHandler : public ui::EventHandler { |
// ui::EventHandler: |
void OnMouseEvent(ui::MouseEvent* mouse) override { |
if (mouse->type() == ui::ET_MOUSE_MOVED) { |
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, target_->bounds().CenterPoint(), |
- target_->bounds().CenterPoint(), |
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
+ ui::MouseEvent move( |
+ ui::ET_MOUSE_MOVED, target_->bounds().CenterPoint(), |
+ target_->bounds().CenterPoint(), ui::EventTimeForNow(), ui::EF_NONE, |
+ ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
ui::EventDispatchDetails details = |
target_->GetHost()->dispatcher()->OnEventFromSource(&move); |
ASSERT_FALSE(details.dispatcher_destroyed); |
@@ -2354,9 +2402,11 @@ TEST_F(WindowEventDispatcherTest, NestedEventDispatchTargetMoved) { |
EXPECT_NE(root_window(), second_root); |
// Dispatch an event to |first|. |
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, first->bounds().CenterPoint(), |
- first->bounds().CenterPoint(), ui::EventTimeForNow(), |
- ui::EF_NONE, ui::EF_NONE); |
+ ui::MouseEvent move( |
+ ui::ET_MOUSE_MOVED, first->bounds().CenterPoint(), |
+ first->bounds().CenterPoint(), ui::EventTimeForNow(), ui::EF_NONE, |
+ ui::EF_NONE, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
ui::EventDispatchDetails details = |
host()->dispatcher()->OnEventFromSource(&move); |
ASSERT_FALSE(details.dispatcher_destroyed); |
@@ -2453,9 +2503,10 @@ TEST_F(WindowEventDispatcherTest, |
EventFilterRecorder recorder_second; |
window_second->AddPreTargetHandler(&recorder_second); |
const gfx::Point event_location(25, 15); |
- ui::MouseEvent mouse(ui::ET_MOUSE_PRESSED, event_location, event_location, |
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
- ui::EF_LEFT_MOUSE_BUTTON); |
+ ui::MouseEvent mouse( |
+ ui::ET_MOUSE_PRESSED, event_location, event_location, |
+ ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
+ ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
DispatchEventUsingWindowDispatcher(&mouse); |
EXPECT_TRUE(recorder_first.events().empty()); |
ASSERT_EQ(1u, recorder_second.events().size()); |