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

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

Issue 652793003: Close the select box when the parent RWHVA loses focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2153b2e733f6d9d79dd161569e08d20fa1e5a216..12ad69478ef18ab5fcb6d5b11b25dc5c7c2d69fa 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
@@ -56,6 +56,7 @@
#include "ui/events/gestures/gesture_configuration.h"
#include "ui/events/test/event_generator.h"
#include "ui/wm/core/default_activation_client.h"
+#include "ui/wm/core/window_util.h"
using testing::_;
@@ -845,6 +846,35 @@ TEST_F(RenderWidgetHostViewAuraTest, PopupRetainsCaptureAfterMouseRelease) {
}
#endif
+// Test that select boxes close when their parent window loses focus (e.g. due
+// to an alert or system modal dialog).
+TEST_F(RenderWidgetHostViewAuraTest, PopupClosesWhenParentLosesFocus) {
+ 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));
+
+ aura::Window* popup_window = view_->GetNativeView();
+ TestWindowObserver observer(popup_window);
+
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> dialog_window(new aura::Window(&delegate));
+ dialog_window->Init(aura::WINDOW_LAYER_TEXTURED);
+ aura::client::ParentWindowWithContext(
+ dialog_window.get(), popup_window, gfx::Rect());
+ dialog_window->Show();
+ wm::ActivateWindow(dialog_window.get());
+
+ ASSERT_TRUE(wm::IsActiveWindow(dialog_window.get()));
+ EXPECT_TRUE(observer.destroyed());
+}
+
// Checks that IME-composition-event state is maintained correctly.
TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
view_->InitAsChild(NULL);
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698