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

Unified Diff: components/mus/ws/event_dispatcher_unittest.cc

Issue 1998323002: EventDispatcher shouldn't always cancel on a hierarchy change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 7 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 | « components/mus/ws/event_dispatcher.cc ('k') | components/mus/ws/server_window_surface_manager_test_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/event_dispatcher_unittest.cc
diff --git a/components/mus/ws/event_dispatcher_unittest.cc b/components/mus/ws/event_dispatcher_unittest.cc
index 9f72d8fc44439c84b24ca5d6be360ba0bd8b026f..bf244e1da344e1ed275c7bd8995172ae42cf49ec 100644
--- a/components/mus/ws/event_dispatcher_unittest.cc
+++ b/components/mus/ws/event_dispatcher_unittest.cc
@@ -1505,6 +1505,40 @@ TEST_F(EventDispatcherTest, ModalWindowMultipleSystemModals) {
EXPECT_EQ(nullptr, GetActiveSystemModalWindow());
}
+TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
+ std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
+ DisableHitTest(w1.get());
+ std::unique_ptr<ServerWindow> w11 =
+ CreateChildWindowWithParent(WindowId(1, 4), w1.get());
+ std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
+ DisableHitTest(w2.get());
+
+ root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
+ w1->SetBounds(gfx::Rect(0, 0, 100, 100));
+ w11->SetBounds(gfx::Rect(10, 10, 10, 10));
+ w2->SetBounds(gfx::Rect(0, 0, 100, 100));
+
+ // Send event that is over |w11|.
+ const ui::PointerEvent mouse_pressed(ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
+ base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ event_dispatcher()->ProcessEvent(mouse_pressed);
+ event_dispatcher()->SetCaptureWindow(w11.get(), false);
+
+ std::unique_ptr<DispatchedEventDetails> details =
+ test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
+ ASSERT_TRUE(details);
+ EXPECT_EQ(w11.get(), details->window);
+ EXPECT_FALSE(details->in_nonclient_area);
+
+ // Move |w11| to |w2| and verify the mouse is still down, and |w11| has
+ // capture.
+ w2->Add(w11.get());
+ EXPECT_TRUE(IsMouseButtonDown());
+ EXPECT_EQ(w11.get(),
+ EventDispatcherTestApi(event_dispatcher()).capture_window());
+}
+
} // namespace test
} // namespace ws
} // namespace mus
« no previous file with comments | « components/mus/ws/event_dispatcher.cc ('k') | components/mus/ws/server_window_surface_manager_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698