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

Unified Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 387863003: aura: Do not synthesize a mouse-move event during a drag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 6 years, 5 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') | no next file » | 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 4fad0f7c71b639d4f3ec115f21f53868aa6da759..c7618fbe0735e954d3841970995a1f42784d932e 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -916,6 +916,34 @@ TEST_F(WindowEventDispatcherTest, DispatchSyntheticMouseEvents) {
root_window()->RemovePreTargetHandler(&recorder);
}
+// Tests that a mouse-move event is not synthesized when a mouse-button is down.
+TEST_F(WindowEventDispatcherTest, DoNotSynthesizeWhileButtonDown) {
+ EventFilterRecorder recorder;
+ test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ &delegate, 1234, gfx::Rect(5, 5, 100, 100), root_window()));
+ window->Show();
+
+ 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::EF_LEFT_MOUSE_BUTTON,
+ ui::EF_LEFT_MOUSE_BUTTON);
+ DispatchEventUsingWindowDispatcher(&mouse1);
+ ASSERT_EQ(1u, recorder.events().size());
+ EXPECT_EQ(ui::ET_MOUSE_PRESSED, recorder.events()[0]);
+ window->RemovePreTargetHandler(&recorder);
+ recorder.Reset();
+
+ // Move |window| away from underneath the cursor.
+ root_window()->AddPreTargetHandler(&recorder);
+ window->SetBounds(gfx::Rect(30, 30, 100, 100));
+ EXPECT_TRUE(recorder.events().empty());
+ RunAllPendingInMessageLoop();
+ EXPECT_TRUE(recorder.events().empty());
+ root_window()->RemovePreTargetHandler(&recorder);
+}
+
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
#define MAYBE(x) DISABLED_##x
#else
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698