summaryrefslogtreecommitdiffstats
path: root/ash/shell_unittest.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-27 17:02:28 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-27 17:02:28 +0000
commit5924a0b4c58a2f889752a6c76256895a62b31eb0 (patch)
tree9e597fb8be9901436a2ab2a85006e2c321e34572 /ash/shell_unittest.cc
parentf7359809aea977080efbbdcc91b6136d4a0c9de6 (diff)
downloadchromium_src-5924a0b4c58a2f889752a6c76256895a62b31eb0.zip
chromium_src-5924a0b4c58a2f889752a6c76256895a62b31eb0.tar.gz
chromium_src-5924a0b4c58a2f889752a6c76256895a62b31eb0.tar.bz2
Cleans up a couple of places that were installing WindowObservers but
never removing them. This is problematic as it is possible for a Window to be destroyed after the shell. ScopedObserver is pretty generic, but I'll leave it here for now. BUG=124860 TEST=covered by unit test R=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10206027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell_unittest.cc')
-rw-r--r--ash/shell_unittest.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index d4dd7ea..88e8fd9 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -317,4 +317,28 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) {
widget->Close();
}
+// This verifies WindowObservers are removed when a window is destroyed after
+// the Shell is destroyed. This scenario (aura::Windows being deleted after the
+// Shell) occurs if someone is holding a reference to an unparented Window, as
+// is the case with a RenderWidgetHostViewAura that isn't on screen. As long as
+// everything is ok, we won't crash. If there is a bug, window's destructor will
+// notify some deleted object (say VideoDetector or ActivationController) and
+// this will crash.
+class ShellTest2 : public test::AshTestBase {
+ public:
+ ShellTest2() {}
+ virtual ~ShellTest2() {}
+
+ protected:
+ scoped_ptr<aura::Window> window_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShellTest2);
+};
+
+TEST_F(ShellTest2, DontCrashWhenWindowDeleted) {
+ window_.reset(new aura::Window(NULL));
+ window_->Init(ui::LAYER_NOT_DRAWN);
+}
+
} // namespace ash