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

Unified Diff: ui/views/widget/native_widget_aura_unittest.cc

Issue 2859333003: cros: Fix bubble dialog shows on desktop when parent window is invisible (Closed)
Patch Set: just create widget on stack Created 3 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 | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura_unittest.cc
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index 8583f051b95103e525894c9e382dff4ca0571c53..d338942fe35f4a85edc803b54283a8429d084e21 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -27,6 +27,7 @@
#include "ui/wm/core/base_focus_rules.h"
#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/focus_controller.h"
+#include "ui/wm/core/transient_window_manager.h"
namespace views {
namespace {
@@ -651,5 +652,39 @@ TEST_F(NativeWidgetAuraTest, PreventFocusOnNonActivableWindow) {
EXPECT_TRUE(delegate2.view()->HasFocus());
}
+// Tests that the transient child bubble window is only visible if the parent is
+// visible.
+TEST_F(NativeWidgetAuraTest, VisibilityOfChildBubbleWindow) {
+ // Create a parent window.
+ Widget parent;
+ Widget::InitParams parent_params(Widget::InitParams::TYPE_WINDOW);
+ parent_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ parent_params.context = root_window();
+ parent.Init(parent_params);
+ parent.SetBounds(gfx::Rect(0, 0, 480, 320));
+
+ // Add a child bubble window to the above parent window and show it.
+ Widget child;
+ Widget::InitParams child_params(Widget::InitParams::TYPE_BUBBLE);
+ child_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ child_params.parent = parent.GetNativeWindow();
+ child.Init(child_params);
+ child.SetBounds(gfx::Rect(0, 0, 200, 200));
+ child.Show();
+
+ // Check that the bubble window is added as the transient child and it is
+ // hidden because parent window is hidden.
+ wm::TransientWindowManager* manager =
+ wm::TransientWindowManager::Get(child.GetNativeWindow());
+ EXPECT_EQ(parent.GetNativeWindow(), manager->transient_parent());
+ EXPECT_FALSE(parent.IsVisible());
+ EXPECT_FALSE(child.IsVisible());
+
+ // Show the parent window should make the transient child bubble visible.
+ parent.Show();
+ EXPECT_TRUE(parent.IsVisible());
+ EXPECT_TRUE(child.IsVisible());
+}
+
} // namespace
} // namespace views
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698