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

Side by Side Diff: ui/aura/test/test_window_delegate.h

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
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 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ 5 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_
6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ 6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/aura/window_delegate.h" 12 #include "ui/aura/window_delegate.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 14
15 namespace aura { 15 namespace aura {
16 namespace test { 16 namespace test {
17 17
18 // WindowDelegate implementation with all methods stubbed out. 18 // WindowDelegate implementation with all methods stubbed out.
19 class TestWindowDelegate : public WindowDelegate { 19 class TestWindowDelegate : public WindowDelegate {
20 public: 20 public:
21 TestWindowDelegate(); 21 TestWindowDelegate();
22 virtual ~TestWindowDelegate(); 22 virtual ~TestWindowDelegate();
23 23
24 // Returns a TestWindowDelegate that delete itself when
25 // the associated window is destroyed.
26 static TestWindowDelegate* CreateSelfDestroyingDelegate();
27
24 void set_window_component(int window_component) { 28 void set_window_component(int window_component) {
25 window_component_ = window_component; 29 window_component_ = window_component;
26 } 30 }
27 31
28 // Overridden from WindowDelegate: 32 // Overridden from WindowDelegate:
29 virtual gfx::Size GetMinimumSize() const OVERRIDE; 33 virtual gfx::Size GetMinimumSize() const OVERRIDE;
30 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, 34 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
31 const gfx::Rect& new_bounds) OVERRIDE; 35 const gfx::Rect& new_bounds) OVERRIDE;
32 virtual void OnFocus(Window* old_focused_window) OVERRIDE; 36 virtual void OnFocus(Window* old_focused_window) OVERRIDE;
33 virtual void OnBlur() OVERRIDE; 37 virtual void OnBlur() OVERRIDE;
(...skipping 12 matching lines...) Expand all
46 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 50 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
47 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; 51 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
48 virtual void OnWindowDestroying() OVERRIDE; 52 virtual void OnWindowDestroying() OVERRIDE;
49 virtual void OnWindowDestroyed() OVERRIDE; 53 virtual void OnWindowDestroyed() OVERRIDE;
50 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; 54 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
51 virtual bool HasHitTestMask() const OVERRIDE; 55 virtual bool HasHitTestMask() const OVERRIDE;
52 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; 56 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
53 57
54 private: 58 private:
55 int window_component_; 59 int window_component_;
60 bool delete_on_destroyed_;
56 61
57 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); 62 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate);
58 }; 63 };
59 64
60 // A simple WindowDelegate implementation for these tests. It owns itself 65 // A simple WindowDelegate implementation for these tests. It owns itself
61 // (deletes itself when the Window it is attached to is destroyed). 66 // (deletes itself when the Window it is attached to is destroyed).
62 class ColorTestWindowDelegate : public TestWindowDelegate { 67 class ColorTestWindowDelegate : public TestWindowDelegate {
63 public: 68 public:
64 explicit ColorTestWindowDelegate(SkColor color); 69 explicit ColorTestWindowDelegate(SkColor color);
65 virtual ~ColorTestWindowDelegate(); 70 virtual ~ColorTestWindowDelegate();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 int key_press_count_; 128 int key_press_count_;
124 int key_release_count_; 129 int key_release_count_;
125 130
126 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); 131 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate);
127 }; 132 };
128 133
129 } // namespace test 134 } // namespace test
130 } // namespace aura 135 } // namespace aura
131 136
132 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ 137 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/aura/shared/input_method_event_filter_unittest.cc ('k') | ui/aura/test/test_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698