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

Unified Diff: ui/aura/window_targeter_unittest.cc

Issue 423503002: Make ScopedWindowTargeter add itself as a WindowObserver for real (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/aura/scoped_window_targeter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_targeter_unittest.cc
diff --git a/ui/aura/window_targeter_unittest.cc b/ui/aura/window_targeter_unittest.cc
index f14d3379ea3d1113305578e1cd2b06330b8a96b3..86bd8d804da87ba7fddcd8fe1499db1175801425 100644
--- a/ui/aura/window_targeter_unittest.cc
+++ b/ui/aura/window_targeter_unittest.cc
@@ -118,6 +118,21 @@ TEST_F(WindowTargeterTest, ScopedWindowTargeter) {
}
}
+// Test that ScopedWindowTargeter does not crash if the window for which it
+// replaces the targeter gets destroyed before it does.
+TEST_F(WindowTargeterTest, ScopedWindowTargeterWindowDestroyed) {
+ test::TestWindowDelegate delegate;
+ scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), &delegate));
+ scoped_ptr<ScopedWindowTargeter> scoped_targeter(
+ new ScopedWindowTargeter(window.get(), scoped_ptr<ui::EventTargeter>(
+ new StaticWindowTargeter(window.get()))));
+
+ window.reset();
+ scoped_targeter.reset();
+
+ // We did not crash!
+}
+
TEST_F(WindowTargeterTest, TargetTransformedWindow) {
root_window()->Show();
« no previous file with comments | « ui/aura/scoped_window_targeter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698