diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 07:41:36 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 07:41:36 +0000 |
commit | 41cc5e2513ca191dae63192949141c0831c5d285 (patch) | |
tree | 0149d1c406dc5c0c8ce828b6683ce63a47bc8688 /ui/aura/root_window_unittest.cc | |
parent | dbe49fd6f4b76daea8dd8ea8fbbbad782ac3cad1 (diff) | |
download | chromium_src-41cc5e2513ca191dae63192949141c0831c5d285.zip chromium_src-41cc5e2513ca191dae63192949141c0831c5d285.tar.gz chromium_src-41cc5e2513ca191dae63192949141c0831c5d285.tar.bz2 |
Fix leaks in aura_unittests
Suppress leaks that are in X and header to fix.
BUG=144990,146464,146465
Review URL: https://chromiumcodereview.appspot.com/10916095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window_unittest.cc')
-rw-r--r-- | ui/aura/root_window_unittest.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index a2fb633..e580426 100644 --- a/ui/aura/root_window_unittest.cc +++ b/ui/aura/root_window_unittest.cc @@ -126,8 +126,9 @@ class EventCountFilter : public EventFilter { }; Window* CreateWindow(int id, Window* parent, WindowDelegate* delegate) { - Window* window = - new Window(delegate ? delegate : new test::TestWindowDelegate); + Window* window = new Window( + delegate ? delegate : + test::TestWindowDelegate::CreateSelfDestroyingDelegate()); window->set_id(id); window->Init(ui::LAYER_TEXTURED); window->SetParent(parent); @@ -706,8 +707,8 @@ TEST_F(RootWindowTest, DeleteWindowDuringDispatch) { // Deleting the window should not cause a crash, only prevent further // processing from occurring. scoped_ptr<Window> w1(CreateWindow(1, root_window(), NULL)); - DeletingWindowDelegate* d11 = new DeletingWindowDelegate; - Window* w11 = CreateWindow(11, w1.get(), d11); + DeletingWindowDelegate d11; + Window* w11 = CreateWindow(11, w1.get(), &d11); WindowTracker tracker; DeletingEventFilter* w1_filter = new DeletingEventFilter; w1->SetEventFilter(w1_filter); @@ -717,28 +718,28 @@ TEST_F(RootWindowTest, DeleteWindowDuringDispatch) { // First up, no one deletes anything. tracker.Add(w11); - d11->Reset(w11, false); + d11.Reset(w11, false); generator.PressLeftButton(); EXPECT_TRUE(tracker.Contains(w11)); - EXPECT_TRUE(d11->got_event()); + EXPECT_TRUE(d11.got_event()); generator.ReleaseLeftButton(); // Delegate deletes w11. This will prevent the post-handle step from applying. w1_filter->Reset(false); - d11->Reset(w11, true); + d11.Reset(w11, true); generator.PressKey(ui::VKEY_A, 0); EXPECT_FALSE(tracker.Contains(w11)); - EXPECT_TRUE(d11->got_event()); + EXPECT_TRUE(d11.got_event()); // Pre-handle step deletes w11. This will prevent the delegate and the post- // handle steps from applying. - w11 = CreateWindow(11, w1.get(), d11); + w11 = CreateWindow(11, w1.get(), &d11); w1_filter->Reset(true); - d11->Reset(w11, false); + d11.Reset(w11, false); generator.PressLeftButton(); EXPECT_FALSE(tracker.Contains(w11)); - EXPECT_FALSE(d11->got_event()); + EXPECT_FALSE(d11.got_event()); } } // namespace aura |