| Index: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
|
| diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
|
| index 17a5f97f0da61f26291a48eb5bdf74ac381b10df..61dde12d40bd30d422f0feb15fcea137bce9d3ea 100644
|
| --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
|
| +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "ui/aura/client/cursor_client.h"
|
| #include "ui/aura/root_window.h"
|
| +#include "ui/aura/test/test_window_delegate.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/views/test/views_test_base.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -159,4 +160,30 @@ TEST_F(DesktopNativeWidgetAuraTest, GlobalCursorState) {
|
| EXPECT_TRUE(cursor_client_b->IsCursorVisible());
|
| }
|
|
|
| +// Verifies FocusController doesn't attempt to access |content_window_| during
|
| +// destruction. Previously the FocusController was destroyed after the window.
|
| +// This could be problematic as FocusController references |content_window_| and
|
| +// could attempt to use it after |content_window_| was destroyed. This test
|
| +// verifies this doesn't happen. Note that this test only failed under ASAN.
|
| +TEST_F(DesktopNativeWidgetAuraTest, DontAccessContentWindowDuringDestruction) {
|
| + aura::test::TestWindowDelegate delegate;
|
| + {
|
| + Widget widget;
|
| + Widget::InitParams init_params =
|
| + CreateParams(Widget::InitParams::TYPE_WINDOW);
|
| + init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + DesktopNativeWidgetAura* desktop_native_widget_aura =
|
| + new DesktopNativeWidgetAura(&widget);
|
| + init_params.native_widget = desktop_native_widget_aura;
|
| + widget.Init(init_params);
|
| +
|
| + // Owned by |widget|.
|
| + aura::Window* window = new aura::Window(&delegate);
|
| + window->Show();
|
| + widget.GetNativeWindow()->parent()->AddChild(window);
|
| +
|
| + widget.Show();
|
| + }
|
| +}
|
| +
|
| } // namespace views
|
|
|