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

Unified Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 552503003: Introduce EventProcessor::OnEventProcessingStarted() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sadrul comments addressed Created 6 years, 3 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
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | ui/events/event_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6d846455f213517edb572a6695aa135e14c014ea..94c9abaeda5cb25e69cfde230b7e1ded331ecaa6 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -674,12 +674,18 @@ TEST_F(WindowEventDispatcherTest, MouseMovesHeld) {
EventTypesToString(recorder.events()));
recorder.Reset();
- // Check that we coalesce held MOUSE_DRAGGED events.
+ // 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), 0, 0);
ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10),
gfx::Point(10, 10), 0, 0);
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), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
EventTypesToString(recorder.events()));
@@ -687,6 +693,8 @@ 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), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_dragged_event);
host()->dispatcher()->ReleasePointerMoves();
EXPECT_TRUE(recorder.events().empty());
@@ -697,8 +705,12 @@ 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), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_dragged_event);
host()->dispatcher()->ReleasePointerMoves();
+ mouse_pressed_event = ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
EventTypesToString(recorder.events()));
@@ -709,8 +721,12 @@ 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), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_dragged_event);
host()->dispatcher()->ReleasePointerMoves();
+ mouse_dragged_event2 = ui::MouseEvent(
+ ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), gfx::Point(10, 10), 0, 0);
DispatchEventUsingWindowDispatcher(&mouse_dragged_event2);
EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(recorder.events()));
recorder.Reset();
@@ -719,6 +735,10 @@ 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), 0, 0);
+ mouse_dragged_event2 = ui::MouseEvent(
+ ui::ET_MOUSE_DRAGGED, gfx::Point(10, 10), gfx::Point(10, 10), 0, 0);
ui::MouseEvent mouse_dragged_event3(ui::ET_MOUSE_DRAGGED, gfx::Point(28, 28),
gfx::Point(28, 28), 0, 0);
host()->dispatcher()->HoldPointerMoves();
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | ui/events/event_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698