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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 148883003: Change destruction order of FocusController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « ui/views/widget/desktop_aura/desktop_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/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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698