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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 574583002: Do not release capture when clicking to open select box (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 32e14b7aa761b3badfdac7bfbed41487a78d22fb..ac98178e7826202255340235cbb4ab05cb8e6132 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -757,6 +757,31 @@ TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupTapOutsidePopup) {
view_ = NULL;
}
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+
+// On Desktop Linux, select boxes need mouse capture in order to work. Test that
+// when a select box is opened via a mouse press that it retains mouse capture
+// after the mouse is released.
+TEST_F(RenderWidgetHostViewAuraTest, PopupRetainsCaptureAfterMouseRelease) {
+ parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
+ parent_view_->Focus();
+ EXPECT_TRUE(parent_view_->HasFocus());
+
+ ui::test::EventGenerator generator(
+ parent_view_->GetNativeView()->GetRootWindow(), gfx::Point(300, 300));
+ generator.PressLeftButton();
+
+ view_->SetPopupType(blink::WebPopupTypeSelect);
+ view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
+ ASSERT_TRUE(view_->NeedsMouseCapture());
+ aura::Window* window = view_->GetNativeView();
+ EXPECT_TRUE(window->HasCapture());
+
+ generator.ReleaseLeftButton();
+ EXPECT_TRUE(window->HasCapture());
+}
+#endif
+
// Checks that IME-composition-event state is maintained correctly.
TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
view_->InitAsChild(NULL);

Powered by Google App Engine
This is Rietveld 408576698