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

Unified Diff: ui/aura/root_window_unittest.cc

Issue 10916095: Fix leaks in aura_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/shared/compound_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_unittest.cc
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index a2fb633095132ba56d6b8111be46ba27304ee654..e580426945540c0129e66fc5e3447963129120a6 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
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/shared/compound_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698