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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc

Issue 678073003: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <vector> 5 #include <vector>
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Get rid of X11 macros which conflict with gtest. 10 // Get rid of X11 macros which conflict with gtest.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 hint_(hint), 42 hint_(hint),
43 wait_till_set_(wait_till_set) { 43 wait_till_set_(wait_till_set) {
44 44
45 const char* kAtomsToCache[] = { 45 const char* kAtomsToCache[] = {
46 hint, 46 hint,
47 NULL 47 NULL
48 }; 48 };
49 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache)); 49 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache));
50 } 50 }
51 51
52 virtual ~WMStateWaiter() { 52 ~WMStateWaiter() override {}
53 }
54 53
55 private: 54 private:
56 // X11PropertyChangeWaiter: 55 // X11PropertyChangeWaiter:
57 virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { 56 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override {
58 std::vector<Atom> hints; 57 std::vector<Atom> hints;
59 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) { 58 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) {
60 std::vector<Atom>::iterator it = std::find( 59 std::vector<Atom>::iterator it = std::find(
61 hints.begin(), 60 hints.begin(),
62 hints.end(), 61 hints.end(),
63 atom_cache_->GetAtom(hint_)); 62 atom_cache_->GetAtom(hint_));
64 bool hint_set = (it != hints.end()); 63 bool hint_set = (it != hints.end());
65 return hint_set != wait_till_set_; 64 return hint_set != wait_till_set_;
66 } 65 }
67 return true; 66 return true;
68 } 67 }
69 68
70 scoped_ptr<ui::X11AtomCache> atom_cache_; 69 scoped_ptr<ui::X11AtomCache> atom_cache_;
71 70
72 // The name of the hint to wait to get set or unset. 71 // The name of the hint to wait to get set or unset.
73 const char* hint_; 72 const char* hint_;
74 73
75 // Whether we are waiting for |hint| to be set or unset. 74 // Whether we are waiting for |hint| to be set or unset.
76 bool wait_till_set_; 75 bool wait_till_set_;
77 76
78 DISALLOW_COPY_AND_ASSIGN(WMStateWaiter); 77 DISALLOW_COPY_AND_ASSIGN(WMStateWaiter);
79 }; 78 };
80 79
81 // A NonClientFrameView with a window mask with the bottom right corner cut out. 80 // A NonClientFrameView with a window mask with the bottom right corner cut out.
82 class ShapedNonClientFrameView : public NonClientFrameView { 81 class ShapedNonClientFrameView : public NonClientFrameView {
83 public: 82 public:
84 explicit ShapedNonClientFrameView() { 83 explicit ShapedNonClientFrameView() {
85 } 84 }
86 85
87 virtual ~ShapedNonClientFrameView() { 86 ~ShapedNonClientFrameView() override {}
88 }
89 87
90 // NonClientFrameView: 88 // NonClientFrameView:
91 virtual gfx::Rect GetBoundsForClientView() const override { 89 gfx::Rect GetBoundsForClientView() const override { return bounds(); }
92 return bounds(); 90 gfx::Rect GetWindowBoundsForClientBounds(
93 }
94 virtual gfx::Rect GetWindowBoundsForClientBounds(
95 const gfx::Rect& client_bounds) const override { 91 const gfx::Rect& client_bounds) const override {
96 return client_bounds; 92 return client_bounds;
97 } 93 }
98 virtual int NonClientHitTest(const gfx::Point& point) override { 94 int NonClientHitTest(const gfx::Point& point) override { return HTNOWHERE; }
99 return HTNOWHERE; 95 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {
100 }
101 virtual void GetWindowMask(const gfx::Size& size,
102 gfx::Path* window_mask) override {
103 int right = size.width(); 96 int right = size.width();
104 int bottom = size.height(); 97 int bottom = size.height();
105 98
106 window_mask->moveTo(0, 0); 99 window_mask->moveTo(0, 0);
107 window_mask->lineTo(0, bottom); 100 window_mask->lineTo(0, bottom);
108 window_mask->lineTo(right, bottom); 101 window_mask->lineTo(right, bottom);
109 window_mask->lineTo(right, 10); 102 window_mask->lineTo(right, 10);
110 window_mask->lineTo(right - 10, 10); 103 window_mask->lineTo(right - 10, 10);
111 window_mask->lineTo(right - 10, 0); 104 window_mask->lineTo(right - 10, 0);
112 window_mask->close(); 105 window_mask->close();
113 } 106 }
114 virtual void ResetWindowControls() override { 107 void ResetWindowControls() override {}
115 } 108 void UpdateWindowIcon() override {}
116 virtual void UpdateWindowIcon() override { 109 void UpdateWindowTitle() override {}
117 } 110 void SizeConstraintsChanged() override {}
118 virtual void UpdateWindowTitle() override {
119 }
120 virtual void SizeConstraintsChanged() override {
121 }
122 111
123 private: 112 private:
124 DISALLOW_COPY_AND_ASSIGN(ShapedNonClientFrameView); 113 DISALLOW_COPY_AND_ASSIGN(ShapedNonClientFrameView);
125 }; 114 };
126 115
127 class ShapedWidgetDelegate : public WidgetDelegateView { 116 class ShapedWidgetDelegate : public WidgetDelegateView {
128 public: 117 public:
129 ShapedWidgetDelegate() { 118 ShapedWidgetDelegate() {
130 } 119 }
131 120
132 virtual ~ShapedWidgetDelegate() { 121 ~ShapedWidgetDelegate() override {}
133 }
134 122
135 // WidgetDelegateView: 123 // WidgetDelegateView:
136 virtual NonClientFrameView* CreateNonClientFrameView( 124 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override {
137 Widget* widget) override {
138 return new ShapedNonClientFrameView; 125 return new ShapedNonClientFrameView;
139 } 126 }
140 127
141 private: 128 private:
142 DISALLOW_COPY_AND_ASSIGN(ShapedWidgetDelegate); 129 DISALLOW_COPY_AND_ASSIGN(ShapedWidgetDelegate);
143 }; 130 };
144 131
145 // Creates a widget of size 100x100. 132 // Creates a widget of size 100x100.
146 scoped_ptr<Widget> CreateWidget(WidgetDelegate* delegate) { 133 scoped_ptr<Widget> CreateWidget(WidgetDelegate* delegate) {
147 scoped_ptr<Widget> widget(new Widget); 134 scoped_ptr<Widget> widget(new Widget);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 base::RunLoop run_loop; 182 base::RunLoop run_loop;
196 run_loop.RunUntilIdle(); 183 run_loop.RunUntilIdle();
197 } 184 }
198 185
199 } // namespace 186 } // namespace
200 187
201 class DesktopWindowTreeHostX11Test : public ViewsTestBase { 188 class DesktopWindowTreeHostX11Test : public ViewsTestBase {
202 public: 189 public:
203 DesktopWindowTreeHostX11Test() { 190 DesktopWindowTreeHostX11Test() {
204 } 191 }
205 virtual ~DesktopWindowTreeHostX11Test() { 192 ~DesktopWindowTreeHostX11Test() override {}
206 }
207 193
208 virtual void SetUp() override { 194 void SetUp() override {
209 ViewsTestBase::SetUp(); 195 ViewsTestBase::SetUp();
210 196
211 // Make X11 synchronous for our display connection. This does not force the 197 // Make X11 synchronous for our display connection. This does not force the
212 // window manager to behave synchronously. 198 // window manager to behave synchronously.
213 XSynchronize(gfx::GetXDisplay(), True); 199 XSynchronize(gfx::GetXDisplay(), True);
214 } 200 }
215 201
216 virtual void TearDown() override { 202 void TearDown() override {
217 XSynchronize(gfx::GetXDisplay(), False); 203 XSynchronize(gfx::GetXDisplay(), False);
218 ViewsTestBase::TearDown(); 204 ViewsTestBase::TearDown();
219 } 205 }
220 206
221 private: 207 private:
222 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11Test); 208 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11Test);
223 }; 209 };
224 210
225 // Tests that the shape is properly set on the x window. 211 // Tests that the shape is properly set on the x window.
226 TEST_F(DesktopWindowTreeHostX11Test, Shape) { 212 TEST_F(DesktopWindowTreeHostX11Test, Shape) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 SubstructureRedirectMask | SubstructureNotifyMask, 448 SubstructureRedirectMask | SubstructureNotifyMask,
463 &xevent); 449 &xevent);
464 450
465 WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true); 451 WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true);
466 waiter.Wait(); 452 waiter.Wait();
467 } 453 }
468 EXPECT_TRUE(widget.GetNativeWindow()->IsVisible()); 454 EXPECT_TRUE(widget.GetNativeWindow()->IsVisible());
469 } 455 }
470 456
471 } // namespace views 457 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698