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

Unified Diff: trunk/src/ash/root_window_controller_unittest.cc

Issue 25659002: Revert 226347 "Fixes use after free caused by delete in RootWind..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/ash/root_window_controller.cc ('k') | trunk/src/ash/wm/frame_painter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ash/root_window_controller_unittest.cc
===================================================================
--- trunk/src/ash/root_window_controller_unittest.cc (revision 226376)
+++ trunk/src/ash/root_window_controller_unittest.cc (working copy)
@@ -51,7 +51,6 @@
private:
bool system_modal_;
-
DISALLOW_COPY_AND_ASSIGN(TestDelegate);
};
@@ -529,69 +528,6 @@
}
}
-// Tracks whether OnWindowDestroying() has been invoked.
-class DestroyedWindowObserver : public aura::WindowObserver {
- public:
- DestroyedWindowObserver() : destroyed_(false), window_(NULL) {}
- virtual ~DestroyedWindowObserver() {
- Shutdown();
- }
-
- void SetWindow(Window* window) {
- window_ = window;
- window->AddObserver(this);
- }
-
- bool destroyed() const { return destroyed_; }
-
- // WindowObserver overrides:
- virtual void OnWindowDestroying(Window* window) OVERRIDE {
- destroyed_ = true;
- window->RemoveObserver(this);
- }
-
- private:
- void Shutdown() {
- if (!window_)
- return;
- window_->RemoveObserver(this);
- window_ = NULL;
- }
-
- bool destroyed_;
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(DestroyedWindowObserver);
-};
-
-// Verifies shutdown doesn't delete windows that are not owned by the parent.
-TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) {
- DestroyedWindowObserver observer1;
- aura::test::TestWindowDelegate delegate1;
- aura::Window* window1 = new aura::Window(&delegate1);
- window1->SetType(aura::client::WINDOW_TYPE_CONTROL);
- window1->set_owned_by_parent(false);
- observer1.SetWindow(window1);
- window1->Init(ui::LAYER_NOT_DRAWN);
- window1->SetDefaultParentByRootWindow(
- Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect());
-
- DestroyedWindowObserver observer2;
- aura::Window* window2 = new aura::Window(NULL);
- window2->set_owned_by_parent(false);
- observer2.SetWindow(window2);
- window2->Init(ui::LAYER_NOT_DRAWN);
- Shell::GetInstance()->GetPrimaryRootWindow()->AddChild(window2);
-
- Shell::GetInstance()->GetPrimaryRootWindowController()->CloseChildWindows();
-
- ASSERT_FALSE(observer1.destroyed());
- delete window1;
-
- ASSERT_FALSE(observer2.destroyed());
- delete window2;
-}
-
typedef test::NoSessionAshTestBase NoSessionRootWindowControllerTest;
// Make sure that an event handler exists for entire display area.
« no previous file with comments | « trunk/src/ash/root_window_controller.cc ('k') | trunk/src/ash/wm/frame_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698