| 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
|
|
|