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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/test_window_delegate.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/test/test_window_delegate.h" 5 #include "ui/aura/test/test_window_delegate.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/base/events/event.h" 9 #include "ui/base/events/event.h"
10 #include "ui/base/hit_test.h" 10 #include "ui/base/hit_test.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/path.h" 12 #include "ui/gfx/path.h"
13 #include "ui/gfx/skia_util.h" 13 #include "ui/gfx/skia_util.h"
14 14
15 namespace aura { 15 namespace aura {
16 namespace test { 16 namespace test {
17 17
18 //////////////////////////////////////////////////////////////////////////////// 18 ////////////////////////////////////////////////////////////////////////////////
19 // TestWindowDelegate 19 // TestWindowDelegate
20 20
21 TestWindowDelegate::TestWindowDelegate() : window_component_(HTCLIENT) { 21 TestWindowDelegate::TestWindowDelegate()
22 : window_component_(HTCLIENT),
23 delete_on_destroyed_(false) {
22 } 24 }
23 25
24 TestWindowDelegate::~TestWindowDelegate() { 26 TestWindowDelegate::~TestWindowDelegate() {
25 } 27 }
26 28
29 // static
30 TestWindowDelegate* TestWindowDelegate::CreateSelfDestroyingDelegate() {
31 TestWindowDelegate* delegate = new TestWindowDelegate;
32 delegate->delete_on_destroyed_ = true;
33 return delegate;
34 }
35
27 gfx::Size TestWindowDelegate::GetMinimumSize() const { 36 gfx::Size TestWindowDelegate::GetMinimumSize() const {
28 return gfx::Size(); 37 return gfx::Size();
29 } 38 }
30 39
31 void TestWindowDelegate::OnBoundsChanged(const gfx::Rect& old_bounds, 40 void TestWindowDelegate::OnBoundsChanged(const gfx::Rect& old_bounds,
32 const gfx::Rect& new_bounds) { 41 const gfx::Rect& new_bounds) {
33 } 42 }
34 43
35 void TestWindowDelegate::OnFocus(Window* old_focused_window) { 44 void TestWindowDelegate::OnFocus(Window* old_focused_window) {
36 } 45 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 89 }
81 90
82 void TestWindowDelegate::OnDeviceScaleFactorChanged( 91 void TestWindowDelegate::OnDeviceScaleFactorChanged(
83 float device_scale_factor) { 92 float device_scale_factor) {
84 } 93 }
85 94
86 void TestWindowDelegate::OnWindowDestroying() { 95 void TestWindowDelegate::OnWindowDestroying() {
87 } 96 }
88 97
89 void TestWindowDelegate::OnWindowDestroyed() { 98 void TestWindowDelegate::OnWindowDestroyed() {
99 if (delete_on_destroyed_)
100 delete this;
90 } 101 }
91 102
92 void TestWindowDelegate::OnWindowTargetVisibilityChanged(bool visible) { 103 void TestWindowDelegate::OnWindowTargetVisibilityChanged(bool visible) {
93 } 104 }
94 105
95 bool TestWindowDelegate::HasHitTestMask() const { 106 bool TestWindowDelegate::HasHitTestMask() const {
96 return false; 107 return false;
97 } 108 }
98 109
99 void TestWindowDelegate::GetHitTestMask(gfx::Path* mask) const { 110 void TestWindowDelegate::GetHitTestMask(gfx::Path* mask) const {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 std::string result = StringPrintf("%d %d", 220 std::string result = StringPrintf("%d %d",
210 key_press_count_, 221 key_press_count_,
211 key_release_count_); 222 key_release_count_);
212 key_press_count_ = 0; 223 key_press_count_ = 0;
213 key_release_count_ = 0; 224 key_release_count_ = 0;
214 return result; 225 return result;
215 } 226 }
216 227
217 } // namespace test 228 } // namespace test
218 } // namespace aura 229 } // namespace aura
OLDNEW
« 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