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

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

Issue 149213005: Dismiss <select> popup when the user taps the desktop background on CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added test Created 6 years, 11 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 e0b6d74cf951bbe812439a2ee1ce79b987bbb8db..6911f280af418e8603273583f65ce2c0d6ef1fa7 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
@@ -417,7 +417,7 @@ TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupClickOutsidePopup) {
EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(click_point));
TestWindowObserver observer(window);
- aura::test::EventGenerator generator(window->GetRootWindow(), gfx::Point());
+ aura::test::EventGenerator generator(window->GetRootWindow(), click_point);
generator.ClickLeftButton();
ASSERT_TRUE(parent_view_->HasFocus());
ASSERT_TRUE(observer.destroyed());
@@ -426,6 +426,33 @@ TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupClickOutsidePopup) {
view_ = NULL;
}
+// Checks that a popup view is destroyed when a user taps outside of the popup
+// view and focus does not change. This is the case when the user taps the
+// desktop background on Chrome OS.
+TEST_F(RenderWidgetHostViewAuraTest, DestroyPopupTapOutsidePopup) {
+ parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
+ parent_view_->Focus();
+ EXPECT_TRUE(parent_view_->HasFocus());
+
+ view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
+ aura::Window* window = view_->GetNativeView();
+ ASSERT_TRUE(window != NULL);
+
+ gfx::Point tap_point;
+ EXPECT_FALSE(window->GetBoundsInRootWindow().Contains(tap_point));
+ aura::Window* parent_window = parent_view_->GetNativeView();
+ EXPECT_FALSE(parent_window->GetBoundsInRootWindow().Contains(tap_point));
+
+ TestWindowObserver observer(window);
+ aura::test::EventGenerator generator(window->GetRootWindow(), tap_point);
+ generator.GestureTapAt(tap_point);
+ ASSERT_TRUE(parent_view_->HasFocus());
+ ASSERT_TRUE(observer.destroyed());
+
+ widget_host_ = NULL;
+ view_ = NULL;
+}
+
// 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