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

Unified Diff: ui/aura/test/test_window_delegate.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/test/test_window_delegate.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/test_window_delegate.cc
diff --git a/ui/aura/test/test_window_delegate.cc b/ui/aura/test/test_window_delegate.cc
index 0c11ba4a7eb1bd6c5cf2d4c56decff1931dfd94d..5ff1599263e9f0144e41a01a82038964a8b78279 100644
--- a/ui/aura/test/test_window_delegate.cc
+++ b/ui/aura/test/test_window_delegate.cc
@@ -18,12 +18,21 @@ namespace test {
////////////////////////////////////////////////////////////////////////////////
// TestWindowDelegate
-TestWindowDelegate::TestWindowDelegate() : window_component_(HTCLIENT) {
+TestWindowDelegate::TestWindowDelegate()
+ : window_component_(HTCLIENT),
+ delete_on_destroyed_(false) {
}
TestWindowDelegate::~TestWindowDelegate() {
}
+// static
+TestWindowDelegate* TestWindowDelegate::CreateSelfDestroyingDelegate() {
+ TestWindowDelegate* delegate = new TestWindowDelegate;
+ delegate->delete_on_destroyed_ = true;
+ return delegate;
+}
+
gfx::Size TestWindowDelegate::GetMinimumSize() const {
return gfx::Size();
}
@@ -87,6 +96,8 @@ void TestWindowDelegate::OnWindowDestroying() {
}
void TestWindowDelegate::OnWindowDestroyed() {
+ if (delete_on_destroyed_)
+ delete this;
}
void TestWindowDelegate::OnWindowTargetVisibilityChanged(bool visible) {
« no previous file with comments | « ui/aura/test/test_window_delegate.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698