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

Side by Side Diff: components/exo/shell_surface_unittest.cc

Issue 2066493004: exo: Remove TextureLayer implementation of Surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add todo, format Created 4 years, 6 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
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/sub_surface_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "components/exo/buffer.h" 7 #include "components/exo/buffer.h"
8 #include "components/exo/shell_surface.h" 8 #include "components/exo/shell_surface.h"
9 #include "components/exo/surface.h" 9 #include "components/exo/surface.h"
10 #include "components/exo/test/exo_test_base.h" 10 #include "components/exo/test/exo_test_base.h"
11 #include "components/exo/test/exo_test_helper.h" 11 #include "components/exo/test/exo_test_helper.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/base/hit_test.h" 14 #include "ui/base/hit_test.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 #include "ui/wm/core/window_util.h" 16 #include "ui/wm/core/window_util.h"
17 17
18 namespace exo { 18 namespace exo {
19 namespace { 19 namespace {
20 20
21 class ShellSurfaceTest : public test::ExoTestBase, 21 using ShellSurfaceTest = test::ExoTestBase;
22 public ::testing::WithParamInterface<bool> {
23 void SetUp() override {
24 Surface::SetUseSurfaceLayer(GetParam());
25 test::ExoTestBase::SetUp();
26 }
27 };
28 22
29 uint32_t ConfigureFullscreen(uint32_t serial, 23 uint32_t ConfigureFullscreen(uint32_t serial,
30 const gfx::Size& size, 24 const gfx::Size& size,
31 ash::wm::WindowStateType state_type, 25 ash::wm::WindowStateType state_type,
32 bool resizing, 26 bool resizing,
33 bool activated) { 27 bool activated) {
34 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type); 28 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type);
35 return serial; 29 return serial;
36 } 30 }
37 31
38 TEST_P(ShellSurfaceTest, AcknowledgeConfigure) { 32 TEST_F(ShellSurfaceTest, AcknowledgeConfigure) {
39 gfx::Size buffer_size(32, 32); 33 gfx::Size buffer_size(32, 32);
40 std::unique_ptr<Buffer> buffer( 34 std::unique_ptr<Buffer> buffer(
41 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 35 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
42 std::unique_ptr<Surface> surface(new Surface); 36 std::unique_ptr<Surface> surface(new Surface);
43 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 37 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
44 38
45 surface->Attach(buffer.get()); 39 surface->Attach(buffer.get());
46 surface->Commit(); 40 surface->Commit();
47 41
48 gfx::Point origin(100, 100); 42 gfx::Point origin(100, 100);
(...skipping 14 matching lines...) Expand all
63 std::unique_ptr<Buffer> fullscreen_buffer( 57 std::unique_ptr<Buffer> fullscreen_buffer(
64 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer( 58 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(
65 CurrentContext()->bounds().size()))); 59 CurrentContext()->bounds().size())));
66 surface->Attach(fullscreen_buffer.get()); 60 surface->Attach(fullscreen_buffer.get());
67 surface->Commit(); 61 surface->Commit();
68 62
69 EXPECT_EQ(gfx::Point().ToString(), 63 EXPECT_EQ(gfx::Point().ToString(),
70 surface->window()->GetBoundsInRootWindow().origin().ToString()); 64 surface->window()->GetBoundsInRootWindow().origin().ToString());
71 } 65 }
72 66
73 TEST_P(ShellSurfaceTest, SetParent) { 67 TEST_F(ShellSurfaceTest, SetParent) {
74 gfx::Size buffer_size(256, 256); 68 gfx::Size buffer_size(256, 256);
75 std::unique_ptr<Buffer> parent_buffer( 69 std::unique_ptr<Buffer> parent_buffer(
76 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 70 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
77 std::unique_ptr<Surface> parent_surface(new Surface); 71 std::unique_ptr<Surface> parent_surface(new Surface);
78 std::unique_ptr<ShellSurface> parent_shell_surface( 72 std::unique_ptr<ShellSurface> parent_shell_surface(
79 new ShellSurface(parent_surface.get())); 73 new ShellSurface(parent_surface.get()));
80 74
81 parent_surface->Attach(parent_buffer.get()); 75 parent_surface->Attach(parent_buffer.get());
82 parent_surface->Commit(); 76 parent_surface->Commit();
83 77
84 std::unique_ptr<Buffer> buffer( 78 std::unique_ptr<Buffer> buffer(
85 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 79 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
86 std::unique_ptr<Surface> surface(new Surface); 80 std::unique_ptr<Surface> surface(new Surface);
87 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 81 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
88 shell_surface->SetParent(parent_shell_surface.get()); 82 shell_surface->SetParent(parent_shell_surface.get());
89 83
90 surface->Attach(buffer.get()); 84 surface->Attach(buffer.get());
91 surface->Commit(); 85 surface->Commit();
92 EXPECT_EQ( 86 EXPECT_EQ(
93 parent_shell_surface->GetWidget()->GetNativeWindow(), 87 parent_shell_surface->GetWidget()->GetNativeWindow(),
94 wm::GetTransientParent(shell_surface->GetWidget()->GetNativeWindow())); 88 wm::GetTransientParent(shell_surface->GetWidget()->GetNativeWindow()));
95 } 89 }
96 90
97 TEST_P(ShellSurfaceTest, Maximize) { 91 TEST_F(ShellSurfaceTest, Maximize) {
98 gfx::Size buffer_size(256, 256); 92 gfx::Size buffer_size(256, 256);
99 std::unique_ptr<Buffer> buffer( 93 std::unique_ptr<Buffer> buffer(
100 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 94 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
101 std::unique_ptr<Surface> surface(new Surface); 95 std::unique_ptr<Surface> surface(new Surface);
102 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 96 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
103 97
104 surface->Attach(buffer.get()); 98 surface->Attach(buffer.get());
105 shell_surface->Maximize(); 99 shell_surface->Maximize();
106 surface->Commit(); 100 surface->Commit();
107 EXPECT_EQ(CurrentContext()->bounds().width(), 101 EXPECT_EQ(CurrentContext()->bounds().width(),
108 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); 102 shell_surface->GetWidget()->GetWindowBoundsInScreen().width());
109 } 103 }
110 104
111 TEST_P(ShellSurfaceTest, Minimize) { 105 TEST_F(ShellSurfaceTest, Minimize) {
112 gfx::Size buffer_size(256, 256); 106 gfx::Size buffer_size(256, 256);
113 std::unique_ptr<Buffer> buffer( 107 std::unique_ptr<Buffer> buffer(
114 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 108 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
115 std::unique_ptr<Surface> surface(new Surface); 109 std::unique_ptr<Surface> surface(new Surface);
116 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 110 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
117 111
118 surface->Attach(buffer.get()); 112 surface->Attach(buffer.get());
119 surface->Commit(); 113 surface->Commit();
120 shell_surface->Minimize(); 114 shell_surface->Minimize();
121 EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized()); 115 EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized());
122 } 116 }
123 117
124 TEST_P(ShellSurfaceTest, Restore) { 118 TEST_F(ShellSurfaceTest, Restore) {
125 gfx::Size buffer_size(256, 256); 119 gfx::Size buffer_size(256, 256);
126 std::unique_ptr<Buffer> buffer( 120 std::unique_ptr<Buffer> buffer(
127 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 121 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
128 std::unique_ptr<Surface> surface(new Surface); 122 std::unique_ptr<Surface> surface(new Surface);
129 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 123 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
130 124
131 surface->Attach(buffer.get()); 125 surface->Attach(buffer.get());
132 surface->Commit(); 126 surface->Commit();
133 // Note: Remove contents to avoid issues with maximize animations in tests. 127 // Note: Remove contents to avoid issues with maximize animations in tests.
134 if (!GetParam()) {
135 surface->Attach(nullptr);
136 surface->Commit();
137 }
138 shell_surface->Maximize(); 128 shell_surface->Maximize();
139 shell_surface->Restore(); 129 shell_surface->Restore();
140 EXPECT_EQ( 130 EXPECT_EQ(
141 buffer_size.ToString(), 131 buffer_size.ToString(),
142 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); 132 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString());
143 } 133 }
144 134
145 TEST_P(ShellSurfaceTest, SetFullscreen) { 135 TEST_F(ShellSurfaceTest, SetFullscreen) {
146 gfx::Size buffer_size(256, 256); 136 gfx::Size buffer_size(256, 256);
147 std::unique_ptr<Buffer> buffer( 137 std::unique_ptr<Buffer> buffer(
148 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 138 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
149 std::unique_ptr<Surface> surface(new Surface); 139 std::unique_ptr<Surface> surface(new Surface);
150 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 140 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
151 141
152 shell_surface->SetFullscreen(true); 142 shell_surface->SetFullscreen(true);
153 surface->Attach(buffer.get()); 143 surface->Attach(buffer.get());
154 surface->Commit(); 144 surface->Commit();
155 EXPECT_EQ(CurrentContext()->bounds().ToString(), 145 EXPECT_EQ(CurrentContext()->bounds().ToString(),
156 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); 146 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString());
157 } 147 }
158 148
159 TEST_P(ShellSurfaceTest, SetPinned) { 149 TEST_F(ShellSurfaceTest, SetPinned) {
160 gfx::Size buffer_size(256, 256); 150 gfx::Size buffer_size(256, 256);
161 std::unique_ptr<Buffer> buffer( 151 std::unique_ptr<Buffer> buffer(
162 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 152 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
163 std::unique_ptr<Surface> surface(new Surface); 153 std::unique_ptr<Surface> surface(new Surface);
164 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 154 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
165 155
166 shell_surface->SetPinned(true); 156 shell_surface->SetPinned(true);
167 EXPECT_TRUE(shell_surface->GetWidget()->IsAlwaysOnTop()); 157 EXPECT_TRUE(shell_surface->GetWidget()->IsAlwaysOnTop());
168 } 158 }
169 159
170 TEST_P(ShellSurfaceTest, SetTitle) { 160 TEST_F(ShellSurfaceTest, SetTitle) {
171 std::unique_ptr<Surface> surface(new Surface); 161 std::unique_ptr<Surface> surface(new Surface);
172 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 162 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
173 163
174 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test"))); 164 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test")));
175 surface->Commit(); 165 surface->Commit();
176 } 166 }
177 167
178 TEST_P(ShellSurfaceTest, SetApplicationId) { 168 TEST_F(ShellSurfaceTest, SetApplicationId) {
179 std::unique_ptr<Surface> surface(new Surface); 169 std::unique_ptr<Surface> surface(new Surface);
180 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 170 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
181 171
182 surface->Commit(); 172 surface->Commit();
183 EXPECT_EQ("", ShellSurface::GetApplicationId( 173 EXPECT_EQ("", ShellSurface::GetApplicationId(
184 shell_surface->GetWidget()->GetNativeWindow())); 174 shell_surface->GetWidget()->GetNativeWindow()));
185 shell_surface->SetApplicationId("test"); 175 shell_surface->SetApplicationId("test");
186 EXPECT_EQ("test", ShellSurface::GetApplicationId( 176 EXPECT_EQ("test", ShellSurface::GetApplicationId(
187 shell_surface->GetWidget()->GetNativeWindow())); 177 shell_surface->GetWidget()->GetNativeWindow()));
188 } 178 }
189 179
190 TEST_P(ShellSurfaceTest, Move) { 180 TEST_F(ShellSurfaceTest, Move) {
191 std::unique_ptr<Surface> surface(new Surface); 181 std::unique_ptr<Surface> surface(new Surface);
192 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 182 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
193 183
194 // Map shell surface. 184 // Map shell surface.
195 surface->Commit(); 185 surface->Commit();
196 186
197 // The interactive move should end when surface is destroyed. 187 // The interactive move should end when surface is destroyed.
198 shell_surface->Move(); 188 shell_surface->Move();
199 189
200 // Test that destroying the shell surface before move ends is OK. 190 // Test that destroying the shell surface before move ends is OK.
201 shell_surface.reset(); 191 shell_surface.reset();
202 } 192 }
203 193
204 TEST_P(ShellSurfaceTest, Resize) { 194 TEST_F(ShellSurfaceTest, Resize) {
205 std::unique_ptr<Surface> surface(new Surface); 195 std::unique_ptr<Surface> surface(new Surface);
206 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 196 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
207 197
208 // Map shell surface. 198 // Map shell surface.
209 surface->Commit(); 199 surface->Commit();
210 200
211 // The interactive resize should end when surface is destroyed. 201 // The interactive resize should end when surface is destroyed.
212 shell_surface->Resize(HTBOTTOMRIGHT); 202 shell_surface->Resize(HTBOTTOMRIGHT);
213 203
214 // Test that destroying the surface before resize ends is OK. 204 // Test that destroying the surface before resize ends is OK.
215 surface.reset(); 205 surface.reset();
216 } 206 }
217 207
218 TEST_P(ShellSurfaceTest, SetGeometry) { 208 TEST_F(ShellSurfaceTest, SetGeometry) {
219 gfx::Size buffer_size(64, 64); 209 gfx::Size buffer_size(64, 64);
220 std::unique_ptr<Buffer> buffer( 210 std::unique_ptr<Buffer> buffer(
221 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 211 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
222 std::unique_ptr<Surface> surface(new Surface); 212 std::unique_ptr<Surface> surface(new Surface);
223 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 213 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
224 214
225 gfx::Rect geometry(16, 16, 32, 32); 215 gfx::Rect geometry(16, 16, 32, 32);
226 shell_surface->SetGeometry(geometry); 216 shell_surface->SetGeometry(geometry);
227 surface->Attach(buffer.get()); 217 surface->Attach(buffer.get());
228 surface->Commit(); 218 surface->Commit();
229 EXPECT_EQ( 219 EXPECT_EQ(
230 geometry.size().ToString(), 220 geometry.size().ToString(),
231 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); 221 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString());
232 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size) 222 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size)
233 .ToString(), 223 .ToString(),
234 surface->window()->bounds().ToString()); 224 surface->window()->bounds().ToString());
235 } 225 }
236 226
237 TEST_P(ShellSurfaceTest, SetScale) { 227 TEST_F(ShellSurfaceTest, SetScale) {
238 gfx::Size buffer_size(64, 64); 228 gfx::Size buffer_size(64, 64);
239 std::unique_ptr<Buffer> buffer( 229 std::unique_ptr<Buffer> buffer(
240 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 230 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
241 std::unique_ptr<Surface> surface(new Surface); 231 std::unique_ptr<Surface> surface(new Surface);
242 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 232 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
243 233
244 double scale = 1.5; 234 double scale = 1.5;
245 shell_surface->SetScale(scale); 235 shell_surface->SetScale(scale);
246 surface->Attach(buffer.get()); 236 surface->Attach(buffer.get());
247 surface->Commit(); 237 surface->Commit();
248 238
249 gfx::Transform transform; 239 gfx::Transform transform;
250 transform.Scale(1.0 / scale, 1.0 / scale); 240 transform.Scale(1.0 / scale, 1.0 / scale);
251 EXPECT_EQ(transform.ToString(), 241 EXPECT_EQ(transform.ToString(),
252 surface->window()->layer()->GetTargetTransform().ToString()); 242 surface->window()->layer()->GetTargetTransform().ToString());
253 } 243 }
254 244
255 void Close(int* close_call_count) { 245 void Close(int* close_call_count) {
256 (*close_call_count)++; 246 (*close_call_count)++;
257 } 247 }
258 248
259 TEST_P(ShellSurfaceTest, CloseCallback) { 249 TEST_F(ShellSurfaceTest, CloseCallback) {
260 std::unique_ptr<Surface> surface(new Surface); 250 std::unique_ptr<Surface> surface(new Surface);
261 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 251 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
262 252
263 int close_call_count = 0; 253 int close_call_count = 0;
264 shell_surface->set_close_callback( 254 shell_surface->set_close_callback(
265 base::Bind(&Close, base::Unretained(&close_call_count))); 255 base::Bind(&Close, base::Unretained(&close_call_count)));
266 256
267 surface->Commit(); 257 surface->Commit();
268 258
269 EXPECT_EQ(0, close_call_count); 259 EXPECT_EQ(0, close_call_count);
270 shell_surface->GetWidget()->Close(); 260 shell_surface->GetWidget()->Close();
271 EXPECT_EQ(1, close_call_count); 261 EXPECT_EQ(1, close_call_count);
272 } 262 }
273 263
274 void DestroyShellSurface(std::unique_ptr<ShellSurface>* shell_surface) { 264 void DestroyShellSurface(std::unique_ptr<ShellSurface>* shell_surface) {
275 shell_surface->reset(); 265 shell_surface->reset();
276 } 266 }
277 267
278 TEST_P(ShellSurfaceTest, SurfaceDestroyedCallback) { 268 TEST_F(ShellSurfaceTest, SurfaceDestroyedCallback) {
279 std::unique_ptr<Surface> surface(new Surface); 269 std::unique_ptr<Surface> surface(new Surface);
280 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 270 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
281 271
282 shell_surface->set_surface_destroyed_callback( 272 shell_surface->set_surface_destroyed_callback(
283 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); 273 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface)));
284 274
285 surface->Commit(); 275 surface->Commit();
286 276
287 EXPECT_TRUE(shell_surface.get()); 277 EXPECT_TRUE(shell_surface.get());
288 surface.reset(); 278 surface.reset();
289 EXPECT_FALSE(shell_surface.get()); 279 EXPECT_FALSE(shell_surface.get());
290 } 280 }
291 281
292 uint32_t Configure(gfx::Size* suggested_size, 282 uint32_t Configure(gfx::Size* suggested_size,
293 ash::wm::WindowStateType* has_state_type, 283 ash::wm::WindowStateType* has_state_type,
294 bool* is_resizing, 284 bool* is_resizing,
295 bool* is_active, 285 bool* is_active,
296 const gfx::Size& size, 286 const gfx::Size& size,
297 ash::wm::WindowStateType state_type, 287 ash::wm::WindowStateType state_type,
298 bool resizing, 288 bool resizing,
299 bool activated) { 289 bool activated) {
300 *suggested_size = size; 290 *suggested_size = size;
301 *has_state_type = state_type; 291 *has_state_type = state_type;
302 *is_resizing = resizing; 292 *is_resizing = resizing;
303 *is_active = activated; 293 *is_active = activated;
304 return 0; 294 return 0;
305 } 295 }
306 296
307 TEST_P(ShellSurfaceTest, ConfigureCallback) { 297 TEST_F(ShellSurfaceTest, ConfigureCallback) {
308 std::unique_ptr<Surface> surface(new Surface); 298 std::unique_ptr<Surface> surface(new Surface);
309 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 299 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
310 300
311 gfx::Size suggested_size; 301 gfx::Size suggested_size;
312 ash::wm::WindowStateType has_state_type = ash::wm::WINDOW_STATE_TYPE_NORMAL; 302 ash::wm::WindowStateType has_state_type = ash::wm::WINDOW_STATE_TYPE_NORMAL;
313 bool is_resizing = false; 303 bool is_resizing = false;
314 bool is_active = false; 304 bool is_active = false;
315 shell_surface->set_configure_callback( 305 shell_surface->set_configure_callback(
316 base::Bind(&Configure, base::Unretained(&suggested_size), 306 base::Bind(&Configure, base::Unretained(&suggested_size),
317 base::Unretained(&has_state_type), 307 base::Unretained(&has_state_type),
(...skipping 24 matching lines...) Expand all
342 shell_surface->GetWidget()->Deactivate(); 332 shell_surface->GetWidget()->Deactivate();
343 shell_surface->AcknowledgeConfigure(0); 333 shell_surface->AcknowledgeConfigure(0);
344 EXPECT_FALSE(is_active); 334 EXPECT_FALSE(is_active);
345 335
346 EXPECT_FALSE(is_resizing); 336 EXPECT_FALSE(is_resizing);
347 shell_surface->Resize(HTBOTTOMRIGHT); 337 shell_surface->Resize(HTBOTTOMRIGHT);
348 shell_surface->AcknowledgeConfigure(0); 338 shell_surface->AcknowledgeConfigure(0);
349 EXPECT_TRUE(is_resizing); 339 EXPECT_TRUE(is_resizing);
350 } 340 }
351 341
352 INSTANTIATE_TEST_CASE_P(, ShellSurfaceTest, ::testing::Bool());
353
354 } // namespace 342 } // namespace
355 } // namespace exo 343 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/sub_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698