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

Side by Side Diff: ash/wm/workspace/workspace_manager_unittest.cc

Issue 16093036: Do not create a workspace for a maximized window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test cases Created 7 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 | 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 #include "ash/wm/workspace/workspace_manager.h" 5 #include "ash/wm/workspace/workspace_manager.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 bool GetWindowOverlapsShelf() { 143 bool GetWindowOverlapsShelf() {
144 return shelf_layout_manager()->window_overlaps_shelf(); 144 return shelf_layout_manager()->window_overlaps_shelf();
145 } 145 }
146 146
147 Workspace* FindBy(aura::Window* window) const { 147 Workspace* FindBy(aura::Window* window) const {
148 return manager_->FindBy(window); 148 return manager_->FindBy(window);
149 } 149 }
150 150
151 std::string WorkspaceStateString(Workspace* workspace) { 151 std::string WorkspaceStateString(Workspace* workspace) {
152 return (workspace->is_maximized() ? "M" : "") + 152 return (workspace->is_fullscreen() ? "F" : "") +
153 base::IntToString(static_cast<int>( 153 base::IntToString(static_cast<int>(
154 workspace->window()->children().size())); 154 workspace->window()->children().size()));
155 } 155 }
156 156
157 int active_index() { 157 int active_index() {
158 return static_cast<int>( 158 return static_cast<int>(
159 manager_->FindWorkspace(manager_->active_workspace_) - 159 manager_->FindWorkspace(manager_->active_workspace_) -
160 manager_->workspaces_.begin()); 160 manager_->workspaces_.begin());
161 } 161 }
162 162
163 // Returns a string description of the current state. The string has the 163 // Returns a string description of the current state. The string has the
164 // following format: 164 // following format:
165 // W* P=W* active=N 165 // W* P=W* active=N
166 // Each W corresponds to a workspace. Each workspace is prefixed with an 'M' 166 // Each W corresponds to a workspace. Each workspace is prefixed with an 'F'
167 // if the workspace is maximized and is followed by the number of windows in 167 // if the workspace is fullscreen and is followed by the number of windows in
168 // the workspace. 168 // the workspace.
169 // 'P=' is used for the pending workspaces (see 169 // 'P=' is used for the pending workspaces (see
170 // WorkspaceManager::pending_workspaces_ for details on pending workspaces). 170 // WorkspaceManager::pending_workspaces_ for details on pending workspaces).
171 // N is the index of the active workspace (index into 171 // N is the index of the active workspace (index into
172 // WorkspaceManager::workspaces_). 172 // WorkspaceManager::workspaces_).
173 // For example, '2 M1 P=M1 active=1' means the first workspace (the desktop) 173 // For example, '2 F1 P=F1 active=1' means the first workspace (the desktop)
174 // has 2 windows, the second workspace is a maximized workspace with 1 window, 174 // has 2 windows, the second workspace is a maximized workspace with 1 window,
175 // there is a pending maximized workspace with 1 window and the second 175 // there is a pending maximized workspace with 1 window and the second
176 // workspace is active. 176 // workspace is active.
177 std::string StateString() { 177 std::string StateString() {
178 std::string result; 178 std::string result;
179 for (size_t i = 0; i < manager_->workspaces_.size(); ++i) { 179 for (size_t i = 0; i < manager_->workspaces_.size(); ++i) {
180 if (i > 0) 180 if (i > 0)
181 result += " "; 181 result += " ";
182 result += WorkspaceStateString(manager_->workspaces_[i]); 182 result += WorkspaceStateString(manager_->workspaces_[i]);
183 } 183 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ASSERT_TRUE(w1->layer() != NULL); 233 ASSERT_TRUE(w1->layer() != NULL);
234 EXPECT_TRUE(w1->layer()->visible()); 234 EXPECT_TRUE(w1->layer()->visible());
235 235
236 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); 236 EXPECT_EQ("0,0 250x251", w1->bounds().ToString());
237 237
238 // Should be 1 workspace for the desktop, not maximized. 238 // Should be 1 workspace for the desktop, not maximized.
239 ASSERT_EQ("1 active=0", StateString()); 239 ASSERT_EQ("1 active=0", StateString());
240 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 240 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
241 } 241 }
242 242
243
sky 2013/06/10 15:28:53 nit: remove this.
Jun Mukai 2013/06/10 20:10:49 Done.
243 // Assertions around maximizing/unmaximizing. 244 // Assertions around maximizing/unmaximizing.
244 TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) { 245 TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) {
245 scoped_ptr<Window> w1(CreateTestWindow()); 246 scoped_ptr<Window> w1(CreateTestWindow());
246 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 247 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
247 248
248 w1->Show(); 249 w1->Show();
249 wm::ActivateWindow(w1.get()); 250 wm::ActivateWindow(w1.get());
250 251
251 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 252 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
252 253
253 ASSERT_TRUE(w1->layer() != NULL); 254 ASSERT_TRUE(w1->layer() != NULL);
254 EXPECT_TRUE(w1->layer()->visible()); 255 EXPECT_TRUE(w1->layer()->visible());
255 256
256 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); 257 EXPECT_EQ("0,0 250x251", w1->bounds().ToString());
257 258
258 // Maximize the window. 259 // Maximize the window.
259 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 260 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
260 261
261 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 262 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
262 263
263 // Should be 2 workspaces, the second maximized with w1. 264 // Should be 1 workspace, maximized window doesn't create its own workspace.
264 ASSERT_EQ("0 M1 active=1", StateString()); 265 ASSERT_EQ("1 active=0", StateString());
265 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 266 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
266 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).width(), 267 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).width(),
267 w1->bounds().width()); 268 w1->bounds().width());
268 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).height(), 269 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).height(),
269 w1->bounds().height()); 270 w1->bounds().height());
270 271
271 // Restore the window. 272 // Restore the window.
272 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 273 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
273 274
274 // Should be 1 workspace for the desktop.
275 ASSERT_EQ("1 active=0", StateString());
276 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 275 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
277 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); 276 EXPECT_EQ("0,0 250x251", w1->bounds().ToString());
278 } 277 }
279 278
280 // Assertions around closing the last window in a workspace. 279 // Assertions around closing the last window in a workspace.
281 TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) { 280 TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) {
282 scoped_ptr<Window> w1(CreateTestWindow()); 281 scoped_ptr<Window> w1(CreateTestWindow());
283 scoped_ptr<Window> w2(CreateTestWindow()); 282 scoped_ptr<Window> w2(CreateTestWindow());
284 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 283 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
285 w1->Show(); 284 w1->Show();
286 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 285 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
287 w2->Show(); 286 w2->Show();
288 wm::ActivateWindow(w1.get()); 287 wm::ActivateWindow(w1.get());
289 288
290 // Should be 1 workspace and 1 pending, !maximized and maximized. The second 289 // Should be 1 workspace and 1 pending, !fullscreen and fullsceen. The second
291 // workspace is pending since the window wasn't active. 290 // workspace is pending since the window wasn't active.
292 ASSERT_EQ("1 P=M1 active=0", StateString()); 291 ASSERT_EQ("1 P=F1 active=0", StateString());
293 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 292 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
294 293
295 // Close w2. 294 // Close w2.
296 w2.reset(); 295 w2.reset();
297 296
298 // Should have one workspace. 297 // Should have one workspace.
299 ASSERT_EQ("1 active=0", StateString()); 298 ASSERT_EQ("1 active=0", StateString());
300 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 299 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
301 EXPECT_TRUE(w1->IsVisible()); 300 EXPECT_TRUE(w1->IsVisible());
302 } 301 }
303 302
304 // Assertions around adding a maximized window when empty. 303 // Assertions around adding a fullscreen window when empty.
305 TEST_F(WorkspaceManagerTest, AddMaximizedWindowWhenEmpty) { 304 TEST_F(WorkspaceManagerTest, AddFullscreenWindowWhenEmpty) {
306 scoped_ptr<Window> w1(CreateTestWindow()); 305 scoped_ptr<Window> w1(CreateTestWindow());
307 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 306 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
308 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 307 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
309 w1->Show(); 308 w1->Show();
310 wm::ActivateWindow(w1.get()); 309 wm::ActivateWindow(w1.get());
311 310
312 ASSERT_TRUE(w1->layer() != NULL); 311 ASSERT_TRUE(w1->layer() != NULL);
313 EXPECT_TRUE(w1->layer()->visible()); 312 EXPECT_TRUE(w1->layer()->visible());
314 gfx::Rect work_area( 313 gfx::Rect fullscreen_area = w1->GetRootWindow()->bounds();
315 ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); 314 EXPECT_EQ(fullscreen_area.width(), w1->bounds().width());
316 EXPECT_EQ(work_area.width(), w1->bounds().width()); 315 EXPECT_EQ(fullscreen_area.height(), w1->bounds().height());
317 EXPECT_EQ(work_area.height(), w1->bounds().height());
318 316
319 // Should be 2 workspaces (since we always keep the desktop). 317 // Should be 2 workspaces (since we always keep the desktop).
320 ASSERT_EQ("0 M1 active=1", StateString()); 318 ASSERT_EQ("0 F1 active=1", StateString());
321 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 319 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
322 } 320 }
323 321
324 // Assertions around two windows and toggling one to be maximized. 322 // Assertions around two windows and toggling one to be fullscreen.
325 TEST_F(WorkspaceManagerTest, MaximizeWithNormalWindow) { 323 TEST_F(WorkspaceManagerTest, FullscreenWithNormalWindow) {
326 scoped_ptr<Window> w1(CreateTestWindow()); 324 scoped_ptr<Window> w1(CreateTestWindow());
327 scoped_ptr<Window> w2(CreateTestWindow()); 325 scoped_ptr<Window> w2(CreateTestWindow());
328 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 326 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
329 w1->Show(); 327 w1->Show();
330 328
331 ASSERT_TRUE(w1->layer() != NULL); 329 ASSERT_TRUE(w1->layer() != NULL);
332 EXPECT_TRUE(w1->layer()->visible()); 330 EXPECT_TRUE(w1->layer()->visible());
333 331
334 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); 332 w2->SetBounds(gfx::Rect(0, 0, 50, 51));
335 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 333 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
336 w2->Show(); 334 w2->Show();
337 wm::ActivateWindow(w2.get()); 335 wm::ActivateWindow(w2.get());
338 336
339 // Should now be two workspaces. 337 // Should now be two workspaces.
340 ASSERT_EQ("1 M1 active=1", StateString()); 338 ASSERT_EQ("1 F1 active=1", StateString());
341 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 339 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
342 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[0]); 340 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[0]);
343 341
344 gfx::Rect work_area(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); 342 gfx::Rect fullscreen_area = w1->GetRootWindow()->bounds();
345 EXPECT_EQ(work_area.width(), w2->bounds().width()); 343 EXPECT_EQ(fullscreen_area.width(), w2->bounds().width());
346 EXPECT_EQ(work_area.height(), w2->bounds().height()); 344 EXPECT_EQ(fullscreen_area.height(), w2->bounds().height());
347 345
348 // Restore w2, which should then go back to one workspace. 346 // Restore w2, which should then go back to one workspace.
349 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 347 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
350 ASSERT_EQ("2 active=0", StateString()); 348 ASSERT_EQ("2 active=0", StateString());
351 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 349 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
352 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]); 350 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]);
353 EXPECT_EQ(50, w2->bounds().width()); 351 EXPECT_EQ(50, w2->bounds().width());
354 EXPECT_EQ(51, w2->bounds().height()); 352 EXPECT_EQ(51, w2->bounds().height());
355 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 353 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
356 } 354 }
357 355
358 // Assertions around two maximized windows. 356 // Assertions around two fullscreen windows.
359 TEST_F(WorkspaceManagerTest, TwoMaximized) { 357 TEST_F(WorkspaceManagerTest, TwoFullscreen) {
360 scoped_ptr<Window> w1(CreateTestWindow()); 358 scoped_ptr<Window> w1(CreateTestWindow());
361 scoped_ptr<Window> w2(CreateTestWindow()); 359 scoped_ptr<Window> w2(CreateTestWindow());
362 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 360 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
363 w1->Show(); 361 w1->Show();
364 wm::ActivateWindow(w1.get()); 362 wm::ActivateWindow(w1.get());
365 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 363 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
366 ASSERT_EQ("1 M1 active=1", StateString()); 364 ASSERT_EQ("1 F1 active=1", StateString());
367 365
368 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); 366 w2->SetBounds(gfx::Rect(0, 0, 50, 51));
369 w2->Show(); 367 w2->Show();
370 wm::ActivateWindow(w2.get()); 368 wm::ActivateWindow(w2.get());
371 ASSERT_EQ("1 M1 active=0", StateString()); 369 ASSERT_EQ("1 F1 active=0", StateString());
372 370
373 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 371 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
374 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 372 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
375 ASSERT_EQ("0 M1 M1 active=2", StateString()); 373 ASSERT_EQ("0 F1 F1 active=2", StateString());
376 374
377 // The last stacked window (|w2|) should be last since it was maximized last. 375 // The last stacked window (|w2|) should be last since it was fullscreen last.
378 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 376 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
379 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]); 377 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]);
380 } 378 }
381 379
382 // Get the index of the layer inside its parent. This index can be used to 380 // Get the index of the layer inside its parent. This index can be used to
383 // determine the z-order / draw-order of objects in the render tree. 381 // determine the z-order / draw-order of objects in the render tree.
384 size_t IndexOfLayerInParent(ui::Layer* layer) { 382 size_t IndexOfLayerInParent(ui::Layer* layer) {
385 ui::Layer* parent = layer->parent(); 383 ui::Layer* parent = layer->parent();
386 for (size_t i = 0; i < parent->children().size(); i++) { 384 for (size_t i = 0; i < parent->children().size(); i++) {
387 if (layer == parent->children()[i]) 385 if (layer == parent->children()[i])
388 return i; 386 return i;
389 } 387 }
390 // This should never be reached. 388 // This should never be reached.
391 NOTREACHED(); 389 NOTREACHED();
392 return 0; 390 return 0;
393 } 391 }
394 392
395 // Make sure that the layer z-order is correct for the time of the animation 393 // Make sure that the layer z-order is correct for the time of the animation
396 // when in a workspace with a normal and a maximized window the normal window 394 // when in a workspace with a normal and a fullscreen window the normal window
397 // gets maximized. See crbug.com/232399. 395 // gets fullscreen. See crbug.com/232399.
398 TEST_F(WorkspaceManagerTest, MaximizeSecondInWorkspace) { 396 TEST_F(WorkspaceManagerTest, FullscreenSecondInWorkspace) {
399 // Create a maximized window. 397 // Create a fullscreen window.
400 scoped_ptr<Window> w1(CreateTestWindow()); 398 scoped_ptr<Window> w1(CreateTestWindow());
401 ASSERT_EQ(1U, w1->layer()->parent()->children().size()); 399 ASSERT_EQ(1U, w1->layer()->parent()->children().size());
402 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 400 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
403 w1->Show(); 401 w1->Show();
404 wm::ActivateWindow(w1.get()); 402 wm::ActivateWindow(w1.get());
405 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 403 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
406 wm::ActivateWindow(w1.get()); 404 wm::ActivateWindow(w1.get());
407 // There are two workspaces: A normal and a maximized one. 405 // There are two workspaces: A normal and a fullscreen one.
408 ASSERT_EQ("0 M1 active=1", StateString()); 406 ASSERT_EQ("0 F1 active=1", StateString());
409 407
410 // Create a second window and make it part of the maximized workspace. 408 // Create a second window and make it part of the fullscreen workspace.
411 scoped_ptr<Window> w2(CreateAppTestWindow(w1->parent())); 409 scoped_ptr<Window> w2(CreateAppTestWindow(w1->parent()));
412 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); 410 w2->SetBounds(gfx::Rect(0, 0, 50, 51));
413 w2->Show(); 411 w2->Show();
414 wm::ActivateWindow(w2.get()); 412 wm::ActivateWindow(w2.get());
415 // There are still two workspaces and two windows in the (maximized) 413 // There are still two workspaces and two windows in the (fullscreen)
416 // workspace. 414 // workspace.
417 ASSERT_EQ("0 M2 active=1", StateString()); 415 ASSERT_EQ("0 F2 active=1", StateString());
418 ASSERT_EQ(w1->layer()->parent()->children()[0], w1->layer()); 416 ASSERT_EQ(w1->layer()->parent()->children()[0], w1->layer());
419 ASSERT_EQ(w1->layer()->parent()->children()[1], w2->layer()); 417 ASSERT_EQ(w1->layer()->parent()->children()[1], w2->layer());
420 418
421 // Now we need to enable all animations since the incorrect layer ordering we 419 // Now we need to enable all animations since the incorrect layer ordering we
422 // want to test against happens only while the animation is going on. 420 // want to test against happens only while the animation is going on.
423 scoped_ptr<ui::ScopedAnimationDurationScaleMode> animation_duration( 421 scoped_ptr<ui::ScopedAnimationDurationScaleMode> animation_duration(
424 new ui::ScopedAnimationDurationScaleMode( 422 new ui::ScopedAnimationDurationScaleMode(
425 ui::ScopedAnimationDurationScaleMode::FAST_DURATION)); 423 ui::ScopedAnimationDurationScaleMode::FAST_DURATION));
426 424
427 ui::Layer* old_w2_layer = w2->layer(); 425 ui::Layer* old_w2_layer = w2->layer();
428 426
429 // Maximize the second window and make sure that the workspace changes. 427 // Maximize the second window and make sure that the workspace changes.
430 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 428 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
431 429
432 // Check the correct window hierarchy - (|w2|) should be last since it was 430 // Check the correct window hierarchy - (|w2|) should be last since it got
433 // maximized last. 431 // fullscreen last.
434 ASSERT_EQ("0 M1 M1 active=2", StateString()); 432 ASSERT_EQ("0 F1 F1 active=2", StateString());
435 EXPECT_EQ(3U, workspaces().size()); 433 EXPECT_EQ(3U, workspaces().size());
436 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 434 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
437 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]); 435 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]);
438 436
439 // Check the workspace layer visibility. 437 // Check the workspace layer visibility.
440 EXPECT_EQ(1, workspaces()[1]->window()->layer()->opacity()); 438 EXPECT_EQ(1, workspaces()[1]->window()->layer()->opacity());
441 EXPECT_EQ(1, workspaces()[2]->window()->layer()->opacity()); 439 EXPECT_EQ(1, workspaces()[2]->window()->layer()->opacity());
442 440
443 // Check that |w2| got a new layer and that the old layer is still visible, 441 // Check that |w2| got a new layer and that the old layer is still visible,
444 // while the new one is not. Further and foremost the old layer should be a 442 // while the new one is not. Further and foremost the old layer should be a
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 485
488 // Assertions around a fullscreen window. 486 // Assertions around a fullscreen window.
489 TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) { 487 TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) {
490 scoped_ptr<Window> w1(CreateTestWindow()); 488 scoped_ptr<Window> w1(CreateTestWindow());
491 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 489 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
492 // Make the window fullscreen. 490 // Make the window fullscreen.
493 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 491 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
494 w1->Show(); 492 w1->Show();
495 wm::ActivateWindow(w1.get()); 493 wm::ActivateWindow(w1.get());
496 494
497 // Should be 2 workspaces, normal and maximized. 495 // Should be 2 workspaces, normal and fullscreen.
498 ASSERT_EQ("0 M1 active=1", StateString()); 496 ASSERT_EQ("0 F1 active=1", StateString());
499 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 497 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
500 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width()); 498 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width());
501 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height()); 499 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height());
502 500
503 // Restore the window. Use SHOW_STATE_DEFAULT as that is what we'll end up 501 // Restore the window. Use SHOW_STATE_DEFAULT as that is what we'll end up
504 // with when using views::Widget. 502 // with when using views::Widget.
505 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DEFAULT); 503 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DEFAULT);
506 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); 504 EXPECT_EQ("0,0 250x251", w1->bounds().ToString());
507 505
508 // Should be 1 workspace for the desktop. 506 // Should be 1 workspace for the desktop.
509 ASSERT_EQ("1 active=0", StateString()); 507 ASSERT_EQ("1 active=0", StateString());
510 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); 508 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
511 EXPECT_EQ(250, w1->bounds().width()); 509 EXPECT_EQ(250, w1->bounds().width());
512 EXPECT_EQ(251, w1->bounds().height()); 510 EXPECT_EQ(251, w1->bounds().height());
513 511
514 // Back to fullscreen. 512 // Back to fullscreen.
515 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 513 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
516 ASSERT_EQ("0 M1 active=1", StateString()); 514 ASSERT_EQ("0 F1 active=1", StateString());
517 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 515 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
518 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width()); 516 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width());
519 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height()); 517 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height());
520 ASSERT_TRUE(GetRestoreBoundsInScreen(w1.get())); 518 ASSERT_TRUE(GetRestoreBoundsInScreen(w1.get()));
521 EXPECT_EQ("0,0 250x251", GetRestoreBoundsInScreen(w1.get())->ToString()); 519 EXPECT_EQ("0,0 250x251", GetRestoreBoundsInScreen(w1.get())->ToString());
522 } 520 }
523 521
524 // Makes sure switching workspaces doesn't show transient windows. 522 // Makes sure switching workspaces doesn't show transient windows.
525 TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) { 523 TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) {
526 scoped_ptr<Window> w1(CreateTestWindow()); 524 scoped_ptr<Window> w1(CreateTestWindow());
527 scoped_ptr<Window> w2(CreateTestWindow()); 525 scoped_ptr<Window> w2(CreateTestWindow());
528 526
529 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); 527 w1->SetBounds(gfx::Rect(0, 0, 250, 251));
530 w2->SetBounds(gfx::Rect(0, 0, 250, 251)); 528 w2->SetBounds(gfx::Rect(0, 0, 250, 251));
531 w1->AddTransientChild(w2.get()); 529 w1->AddTransientChild(w2.get());
532 530
533 w1->Show(); 531 w1->Show();
534 532
535 scoped_ptr<Window> w3(CreateTestWindow()); 533 scoped_ptr<Window> w3(CreateTestWindow());
536 w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 534 w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
537 w3->Show(); 535 w3->Show();
538 wm::ActivateWindow(w3.get()); 536 wm::ActivateWindow(w3.get());
539 537
540 EXPECT_FALSE(w1->layer()->IsDrawn()); 538 EXPECT_FALSE(w1->layer()->IsDrawn());
541 EXPECT_FALSE(w2->layer()->IsDrawn()); 539 EXPECT_FALSE(w2->layer()->IsDrawn());
542 EXPECT_TRUE(w3->layer()->IsDrawn()); 540 EXPECT_TRUE(w3->layer()->IsDrawn());
543 541
544 wm::ActivateWindow(w1.get()); 542 wm::ActivateWindow(w1.get());
545 EXPECT_TRUE(w1->layer()->IsDrawn()); 543 EXPECT_TRUE(w1->layer()->IsDrawn());
546 EXPECT_FALSE(w2->layer()->IsDrawn()); 544 EXPECT_FALSE(w2->layer()->IsDrawn());
547 EXPECT_FALSE(w3->layer()->IsDrawn()); 545 EXPECT_FALSE(w3->layer()->IsDrawn());
548 } 546 }
549 547
550 // Persists-across-all-workspace flag should not cause a transient child 548 // Persists-across-all-workspace flag should not cause a transient child
551 // to be activated at desktop workspace. 549 // to be activated at desktop workspace.
552 TEST_F(WorkspaceManagerTest, PersistsTransientChildStayInSameWorkspace) { 550 TEST_F(WorkspaceManagerTest, PersistsTransientChildStayInSameWorkspace) {
553 scoped_ptr<Window> w1(CreateTestWindow()); 551 scoped_ptr<Window> w1(CreateTestWindow());
554 SetPersistsAcrossAllWorkspaces( 552 SetPersistsAcrossAllWorkspaces(
555 w1.get(), 553 w1.get(),
556 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 554 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
557 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 555 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
558 w1->Show(); 556 w1->Show();
559 wm::ActivateWindow(w1.get()); 557 wm::ActivateWindow(w1.get());
560 ASSERT_EQ("0 M1 active=1", StateString()); 558 ASSERT_EQ("0 F1 active=1", StateString());
561 559
562 scoped_ptr<Window> w2(CreateTestWindowUnparented()); 560 scoped_ptr<Window> w2(CreateTestWindowUnparented());
563 w1->AddTransientChild(w2.get()); 561 w1->AddTransientChild(w2.get());
564 SetPersistsAcrossAllWorkspaces( 562 SetPersistsAcrossAllWorkspaces(
565 w2.get(), 563 w2.get(),
566 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 564 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
567 SetDefaultParentByPrimaryRootWindow(w2.get()); 565 SetDefaultParentByPrimaryRootWindow(w2.get());
568 w2->Show(); 566 w2->Show();
569 wm::ActivateWindow(w2.get()); 567 wm::ActivateWindow(w2.get());
570 568
571 ASSERT_EQ("0 M2 active=1", StateString()); 569 ASSERT_EQ("0 F2 active=1", StateString());
572 } 570 }
573 571
574 // Assertions around minimizing a single window. 572 // Assertions around minimizing a single window.
575 TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) { 573 TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) {
576 scoped_ptr<Window> w1(CreateTestWindow()); 574 scoped_ptr<Window> w1(CreateTestWindow());
577 575
578 w1->Show(); 576 w1->Show();
579 ASSERT_EQ("1 active=0", StateString()); 577 ASSERT_EQ("1 active=0", StateString());
580 578
581 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 579 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
582 ASSERT_EQ("1 active=0", StateString()); 580 ASSERT_EQ("1 active=0", StateString());
583 EXPECT_FALSE(w1->layer()->IsDrawn()); 581 EXPECT_FALSE(w1->layer()->IsDrawn());
584 582
585 // Show the window. 583 // Show the window.
586 w1->Show(); 584 w1->Show();
587 EXPECT_TRUE(wm::IsWindowNormal(w1.get())); 585 EXPECT_TRUE(wm::IsWindowNormal(w1.get()));
588 ASSERT_EQ("1 active=0", StateString()); 586 ASSERT_EQ("1 active=0", StateString());
589 EXPECT_TRUE(w1->layer()->IsDrawn()); 587 EXPECT_TRUE(w1->layer()->IsDrawn());
590 } 588 }
591 589
592 // Assertions around minimizing a maximized window. 590 // Assertions around minimizing a fullscreen window.
593 TEST_F(WorkspaceManagerTest, MinimizeMaximizedWindow) { 591 TEST_F(WorkspaceManagerTest, MinimizeFullscreenWindow) {
594 // Two windows, w1 normal, w2 maximized. 592 // Two windows, w1 normal, w2 fullscreen.
595 scoped_ptr<Window> w1(CreateTestWindow()); 593 scoped_ptr<Window> w1(CreateTestWindow());
596 scoped_ptr<Window> w2(CreateTestWindow()); 594 scoped_ptr<Window> w2(CreateTestWindow());
597 w1->Show(); 595 w1->Show();
598 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 596 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
599 w2->Show(); 597 w2->Show();
600 wm::ActivateWindow(w2.get()); 598 wm::ActivateWindow(w2.get());
601 ASSERT_EQ("1 M1 active=1", StateString()); 599 ASSERT_EQ("1 F1 active=1", StateString());
602 600
603 // Minimize w2. 601 // Minimize w2.
604 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 602 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
605 ASSERT_EQ("1 P=M1 active=0", StateString()); 603 ASSERT_EQ("1 P=F1 active=0", StateString());
606 EXPECT_TRUE(w1->layer()->IsDrawn()); 604 EXPECT_TRUE(w1->layer()->IsDrawn());
607 EXPECT_FALSE(w2->layer()->IsDrawn()); 605 EXPECT_FALSE(w2->layer()->IsDrawn());
608 606
609 // Show the window, which should trigger unminimizing. 607 // Show the window, which should trigger unminimizing.
610 w2->Show(); 608 w2->Show();
611 ASSERT_EQ("1 P=M1 active=0", StateString()); 609 ASSERT_EQ("1 P=F1 active=0", StateString());
612 610
613 wm::ActivateWindow(w2.get()); 611 wm::ActivateWindow(w2.get());
614 ASSERT_EQ("1 M1 active=1", StateString()); 612 ASSERT_EQ("1 F1 active=1", StateString());
615 613
616 EXPECT_TRUE(wm::IsWindowMaximized(w2.get())); 614 EXPECT_TRUE(wm::IsWindowFullscreen(w2.get()));
617 EXPECT_FALSE(w1->layer()->IsDrawn()); 615 EXPECT_FALSE(w1->layer()->IsDrawn());
618 EXPECT_TRUE(w2->layer()->IsDrawn()); 616 EXPECT_TRUE(w2->layer()->IsDrawn());
619 617
620 // Minimize the window, which should hide the window and activate another. 618 // Minimize the window, which should hide the window and activate another.
621 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 619 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
622 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 620 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
623 EXPECT_FALSE(wm::IsActiveWindow(w2.get())); 621 EXPECT_FALSE(wm::IsActiveWindow(w2.get()));
624 EXPECT_FALSE(w2->layer()->IsDrawn()); 622 EXPECT_FALSE(w2->layer()->IsDrawn());
625 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 623 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
626 624
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 717 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
720 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 718 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
721 EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); 719 EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
722 720
723 // Create another window, maximized. 721 // Create another window, maximized.
724 scoped_ptr<Window> w2(CreateTestWindow()); 722 scoped_ptr<Window> w2(CreateTestWindow());
725 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); 723 w2->SetBounds(gfx::Rect(10, 11, 250, 251));
726 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 724 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
727 w2->Show(); 725 w2->Show();
728 wm::ActivateWindow(w2.get()); 726 wm::ActivateWindow(w2.get());
729 EXPECT_EQ(1, active_index()); 727 EXPECT_EQ(0, active_index());
730 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 728 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
731 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 729 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
732 EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); 730 EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
733 731
734 // Switch to w1. 732 // Switch to w1.
735 wm::ActivateWindow(w1.get()); 733 wm::ActivateWindow(w1.get());
736 EXPECT_EQ(0, active_index()); 734 EXPECT_EQ(0, active_index());
737 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 735 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
738 EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); 736 EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
739 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent( 737 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(
740 w2->parent()).ToString(), 738 w2->parent()).ToString(),
741 w2->bounds().ToString()); 739 w2->bounds().ToString());
742 740
743 // Switch to w2. 741 // Switch to w2.
744 wm::ActivateWindow(w2.get()); 742 wm::ActivateWindow(w2.get());
745 EXPECT_EQ(1, active_index()); 743 EXPECT_EQ(0, active_index());
746 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 744 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
747 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 745 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
748 EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); 746 EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
749 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(), 747 EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
750 w2->bounds().ToString()); 748 w2->bounds().ToString());
751 749
752 // Turn off auto-hide, switch back to w2 (maximized) and verify overlap. 750 // Turn off auto-hide, switch back to w2 (maximized) and verify overlap.
753 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 751 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
754 wm::ActivateWindow(w2.get()); 752 wm::ActivateWindow(w2.get());
755 EXPECT_FALSE(GetWindowOverlapsShelf()); 753 EXPECT_FALSE(GetWindowOverlapsShelf());
756 754
757 // Move w1 to overlap shelf, it shouldn't change window overlaps shelf since 755 // Move w1 to overlap shelf, it shouldn't change window overlaps shelf since
758 // the window isn't in the visible workspace. 756 // the window isn't in the visible workspace.
759 w1->SetBounds(touches_shelf_bounds); 757 w1->SetBounds(touches_shelf_bounds);
760 EXPECT_FALSE(GetWindowOverlapsShelf()); 758 EXPECT_FALSE(GetWindowOverlapsShelf());
761 759
762 // Activate w1. Since w1 is visible the overlap state should be true. 760 // Activate w1. Although w1 is visible, the overlap state is still false since
761 // w2 is maximized.
763 wm::ActivateWindow(w1.get()); 762 wm::ActivateWindow(w1.get());
763 EXPECT_FALSE(GetWindowOverlapsShelf());
764
765 // Restore w2.
766 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
764 EXPECT_TRUE(GetWindowOverlapsShelf()); 767 EXPECT_TRUE(GetWindowOverlapsShelf());
765 } 768 }
766 769
767 // Verifies persist across all workspaces. 770 // Verifies persist across all workspaces.
768 TEST_F(WorkspaceManagerTest, PersistAcrossAllWorkspaces) { 771 TEST_F(WorkspaceManagerTest, PersistAcrossAllWorkspaces) {
769 // Create a maximized window. 772 // Create a fullscreen window.
770 scoped_ptr<Window> w1(CreateTestWindow()); 773 scoped_ptr<Window> w1(CreateTestWindow());
771 w1->Show(); 774 w1->Show();
772 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 775 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
773 wm::ActivateWindow(w1.get()); 776 wm::ActivateWindow(w1.get());
774 ASSERT_EQ("0 M1 active=1", StateString()); 777 ASSERT_EQ("0 F1 active=1", StateString());
775 778
776 // Create a window that persists across all workspaces. It should be placed in 779 // Create a window that persists across all workspaces. It should be placed in
777 // the current maximized workspace. 780 // the current fullscreen workspace.
778 scoped_ptr<Window> w2(CreateTestWindow()); 781 scoped_ptr<Window> w2(CreateTestWindow());
779 SetPersistsAcrossAllWorkspaces( 782 SetPersistsAcrossAllWorkspaces(
780 w2.get(), 783 w2.get(),
781 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 784 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
782 w2->Show(); 785 w2->Show();
783 ASSERT_EQ("1 M1 active=1", StateString()); 786 ASSERT_EQ("1 F1 active=1", StateString());
784 787
785 // Activate w2, which should move it to the 2nd workspace. 788 // Activate w2, which should move it to the 2nd workspace.
786 wm::ActivateWindow(w2.get()); 789 wm::ActivateWindow(w2.get());
787 ASSERT_EQ("0 M2 active=1", StateString()); 790 ASSERT_EQ("0 F2 active=1", StateString());
788 791
789 // Restoring w2 should drop the persists window back to the desktop, and drop 792 // Restoring w2 should drop the persists window back to the desktop, and drop
790 // it to the bottom of the stack. 793 // it to the bottom of the stack.
791 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 794 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
792 ASSERT_EQ("2 active=0", StateString()); 795 ASSERT_EQ("2 active=0", StateString());
793 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]); 796 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]);
794 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[1]); 797 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[1]);
795 798
796 // Repeat, but this time minimize. The minimized window should end up in 799 // Repeat, but this time minimize. The minimized window should end up in
797 // pending. 800 // pending.
798 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 801 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
799 ASSERT_EQ("1 P=M1 active=0", StateString()); 802 ASSERT_EQ("1 P=F1 active=0", StateString());
800 w2.reset(CreateTestWindow()); 803 w2.reset(CreateTestWindow());
801 SetPersistsAcrossAllWorkspaces( 804 SetPersistsAcrossAllWorkspaces(
802 w2.get(), 805 w2.get(),
803 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 806 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
804 w2->Show(); 807 w2->Show();
805 ASSERT_EQ("1 P=M1 active=0", StateString()); 808 ASSERT_EQ("1 P=F1 active=0", StateString());
806 wm::ActivateWindow(w2.get()); 809 wm::ActivateWindow(w2.get());
807 ASSERT_EQ("1 P=M1 active=0", StateString()); 810 ASSERT_EQ("1 P=F1 active=0", StateString());
808 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 811 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
809 ASSERT_EQ("1 P=M1 active=0", StateString()); 812 ASSERT_EQ("1 P=F1 active=0", StateString());
810 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]); 813 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]);
811 } 814 }
812 815
813 // Verifies that when a window persists across all workpaces is activated that 816 // Verifies that when a window persists across all workpaces is activated that
814 // it moves to the current workspace. 817 // it moves to the current workspace.
815 TEST_F(WorkspaceManagerTest, ActivatePersistAcrossAllWorkspacesWhenNotActive) { 818 TEST_F(WorkspaceManagerTest, ActivatePersistAcrossAllWorkspacesWhenNotActive) {
816 // Create a window that persists across all workspaces. 819 // Create a window that persists across all workspaces.
817 scoped_ptr<Window> w2(CreateTestWindow()); 820 scoped_ptr<Window> w2(CreateTestWindow());
818 SetPersistsAcrossAllWorkspaces( 821 SetPersistsAcrossAllWorkspaces(
819 w2.get(), 822 w2.get(),
820 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 823 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
821 w2->Show(); 824 w2->Show();
822 ASSERT_EQ("1 active=0", StateString()); 825 ASSERT_EQ("1 active=0", StateString());
823 826
824 // Create a maximized window. 827 // Create a maximized window.
825 scoped_ptr<Window> w1(CreateTestWindow()); 828 scoped_ptr<Window> w1(CreateTestWindow());
826 w1->Show(); 829 w1->Show();
827 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 830 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
828 wm::ActivateWindow(w1.get()); 831 wm::ActivateWindow(w1.get());
829 ASSERT_EQ("1 M1 active=1", StateString()); 832 ASSERT_EQ("1 F1 active=1", StateString());
830 833
831 // Activate the persists across all workspace window. It should move to the 834 // Activate the persists across all workspace window. It should move to the
832 // current workspace. 835 // current workspace.
833 wm::ActivateWindow(w2.get()); 836 wm::ActivateWindow(w2.get());
834 ASSERT_EQ("0 M2 active=1", StateString()); 837 ASSERT_EQ("0 F2 active=1", StateString());
835 // The window that persists across all workspaces should be moved to the top 838 // The window that persists across all workspaces should be moved to the top
836 // of the stacking order. 839 // of the stacking order.
837 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); 840 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
838 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[1]); 841 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[1]);
839 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 842 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
840 } 843 }
841 844
842 // Verifies Show()ing a minimized window that persists across all workspaces 845 // Verifies Show()ing a minimized window that persists across all workspaces
843 // unminimizes the window. 846 // unminimizes the window.
844 TEST_F(WorkspaceManagerTest, ShowMinimizedPersistWindow) { 847 TEST_F(WorkspaceManagerTest, ShowMinimizedPersistWindow) {
845 // Create a window that persists across all workspaces. 848 // Create a window that persists across all workspaces.
846 scoped_ptr<Window> w1(CreateTestWindow()); 849 scoped_ptr<Window> w1(CreateTestWindow());
847 SetPersistsAcrossAllWorkspaces( 850 SetPersistsAcrossAllWorkspaces(
848 w1.get(), 851 w1.get(),
849 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 852 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
850 w1->Show(); 853 w1->Show();
851 wm::ActivateWindow(w1.get()); 854 wm::ActivateWindow(w1.get());
852 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 855 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
853 EXPECT_FALSE(w1->IsVisible()); 856 EXPECT_FALSE(w1->IsVisible());
854 w1->Show(); 857 w1->Show();
855 EXPECT_TRUE(w1->IsVisible()); 858 EXPECT_TRUE(w1->IsVisible());
856 } 859 }
857 860
858 // Test that a persistent window across all workspaces which was first 861 // Test that a persistent window across all workspaces which got fullscreen
859 // maximized, then got minimized and finally got restored does not crash the 862 // first, then got minimized and finally got restored does not crash the
860 // system (see http://crbug.com/151698) and restores its maximized workspace 863 // system (see http://crbug.com/151698) and restores its fullscreen workspace
861 // instead. 864 // instead.
862 TEST_F(WorkspaceManagerTest, MaximizeMinimizeRestoreDoesNotCrash) { 865 TEST_F(WorkspaceManagerTest, MaximizeMinimizeRestoreDoesNotCrash) {
863 // We need to create a regular window first so there's an active workspace. 866 // We need to create a regular window first so there's an active workspace.
864 scoped_ptr<Window> w1(CreateTestWindow()); 867 scoped_ptr<Window> w1(CreateTestWindow());
865 w1->Show(); 868 w1->Show();
866 869
867 // Create a window that persists across all workspaces. 870 // Create a window that persists across all workspaces.
868 scoped_ptr<Window> w2(CreateTestWindow()); 871 scoped_ptr<Window> w2(CreateTestWindow());
869 SetPersistsAcrossAllWorkspaces( 872 SetPersistsAcrossAllWorkspaces(
870 w2.get(), 873 w2.get(),
871 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 874 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
872 w2->Show(); 875 w2->Show();
873 wm::ActivateWindow(w2.get()); 876 wm::ActivateWindow(w2.get());
874 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 877 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
875 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 878 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
876 EXPECT_FALSE(w2->IsVisible()); 879 EXPECT_FALSE(w2->IsVisible());
877 // This is the critical call which should switch to the maximized workspace 880 // This is the critical call which should switch to the fullscreen workspace
878 // of that window instead of reparenting it to the other workspace (and 881 // of that window instead of reparenting it to the other workspace (and
879 // crashing while trying to do so). 882 // crashing while trying to do so).
880 wm::ActivateWindow(w2.get()); 883 wm::ActivateWindow(w2.get());
881 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, 884 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN,
882 w2->GetProperty(aura::client::kShowStateKey)); 885 w2->GetProperty(aura::client::kShowStateKey));
883 EXPECT_TRUE(w2->IsVisible()); 886 EXPECT_TRUE(w2->IsVisible());
884 } 887 }
885 888
886 // Test that we report we're in the fullscreen state even if the fullscreen 889 // Test that we report we're in the fullscreen state even if the fullscreen
887 // window isn't being managed by us (http://crbug.com/123931). 890 // window isn't being managed by us (http://crbug.com/123931).
888 TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) { 891 TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) {
889 ShelfLayoutManager* shelf = shelf_layout_manager(); 892 ShelfLayoutManager* shelf = shelf_layout_manager();
890 893
891 // We need to create a regular window first so there's an active workspace. 894 // We need to create a regular window first so there's an active workspace.
892 scoped_ptr<Window> w1(CreateTestWindow()); 895 scoped_ptr<Window> w1(CreateTestWindow());
893 w1->Show(); 896 w1->Show();
894 897
895 scoped_ptr<Window> w2(CreateTestWindow()); 898 scoped_ptr<Window> w2(CreateTestWindow());
896 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 899 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
897 SetPersistsAcrossAllWorkspaces( 900 SetPersistsAcrossAllWorkspaces(
898 w2.get(), 901 w2.get(),
899 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 902 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
900 w2->Show(); 903 w2->Show();
901 wm::ActivateWindow(w2.get()); 904 wm::ActivateWindow(w2.get());
902 905
903 ASSERT_EQ("1 M1 active=1", StateString()); 906 ASSERT_EQ("1 F1 active=1", StateString());
904 907
905 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 908 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
906 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); 909 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
907 910
908 w2->Hide(); 911 w2->Hide();
909 ASSERT_EQ("1 P=M1 active=0", StateString()); 912 ASSERT_EQ("1 P=F1 active=0", StateString());
910 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); 913 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
911 914
912 w2->Show(); 915 w2->Show();
913 ASSERT_EQ("1 P=M1 active=0", StateString()); 916 ASSERT_EQ("1 P=F1 active=0", StateString());
914 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); 917 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
915 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); 918 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState());
916 919
917 wm::ActivateWindow(w2.get()); 920 wm::ActivateWindow(w2.get());
918 ASSERT_EQ("1 M1 active=1", StateString()); 921 ASSERT_EQ("1 F1 active=1", StateString());
919 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 922 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
920 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); 923 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
921 924
922 w2.reset(); 925 w2.reset();
923 ASSERT_EQ("1 active=0", StateString()); 926 ASSERT_EQ("1 active=0", StateString());
924 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); 927 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
925 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); 928 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState());
926 } 929 }
927 930
928 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized 931 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized
929 // window rather than a normal window. 932 // window rather than a normal window. It should be same as the normal window.
930 TEST_F(WorkspaceManagerTest, 933 TEST_F(WorkspaceManagerTest,
931 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) { 934 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) {
932 ShelfLayoutManager* shelf = shelf_layout_manager(); 935 ShelfLayoutManager* shelf = shelf_layout_manager();
933 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 936 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
934 937
935 // Make the first window maximized. 938 // Make the first window maximized.
936 scoped_ptr<Window> w1(CreateTestWindow()); 939 scoped_ptr<Window> w1(CreateTestWindow());
937 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 940 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
938 w1->Show(); 941 w1->Show();
939 942
(...skipping 18 matching lines...) Expand all
958 wm::ActivateWindow(w2.get()); 961 wm::ActivateWindow(w2.get());
959 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 962 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
960 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, 963 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
961 manager_->GetWindowState()); 964 manager_->GetWindowState());
962 965
963 w2.reset(); 966 w2.reset();
964 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); 967 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
965 } 968 }
966 969
967 // Verifies a window marked as persisting across all workspaces ends up in its 970 // Verifies a window marked as persisting across all workspaces ends up in its
968 // own workspace when maximized. 971 // own workspace when got fullscreen.
969 TEST_F(WorkspaceManagerTest, MaximizeDontPersistEndsUpInOwnWorkspace) { 972 TEST_F(WorkspaceManagerTest, FullscreenDontPersistEndsUpInOwnWorkspace) {
970 scoped_ptr<Window> w1(CreateTestWindow()); 973 scoped_ptr<Window> w1(CreateTestWindow());
971 974
972 SetPersistsAcrossAllWorkspaces( 975 SetPersistsAcrossAllWorkspaces(
973 w1.get(), 976 w1.get(),
974 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 977 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
975 w1->Show(); 978 w1->Show();
976 979
977 ASSERT_EQ("1 active=0", StateString()); 980 ASSERT_EQ("1 active=0", StateString());
978 981
979 // Maximize should trigger containing the window. 982 // Maximize should trigger containing the window.
980 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 983 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
981 ASSERT_EQ("0 P=M1 active=0", StateString()); 984 ASSERT_EQ("0 P=F1 active=0", StateString());
982 985
983 // And resetting to normal should remove it. 986 // And resetting to normal should remove it.
984 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 987 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
985 ASSERT_EQ("1 active=0", StateString()); 988 ASSERT_EQ("1 active=0", StateString());
986 } 989 }
987 990
988 // Verifies going from maximized to minimized sets the right state for painting 991 // Verifies going from maximized to minimized sets the right state for painting
989 // the background of the launcher. 992 // the background of the launcher.
990 TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) { 993 TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) {
991 scoped_ptr<Window> w1(CreateTestWindow()); 994 scoped_ptr<Window> w1(CreateTestWindow());
992 w1->Show(); 995 w1->Show();
993 wm::ActivateWindow(w1.get()); 996 wm::ActivateWindow(w1.get());
994 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 997 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
995 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 998 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
996 EXPECT_EQ(SHELF_VISIBLE, 999 EXPECT_EQ(SHELF_VISIBLE,
997 shelf_layout_manager()->visibility_state()); 1000 shelf_layout_manager()->visibility_state());
998 EXPECT_FALSE(shelf_widget()->paints_background()); 1001 EXPECT_FALSE(shelf_widget()->paints_background());
999 } 1002 }
1000 1003
1001 // Verifies transients are moved when maximizing. 1004 // Verifies transients are moved when fullscreen.
1002 TEST_F(WorkspaceManagerTest, MoveTransientOnMaximize) { 1005 TEST_F(WorkspaceManagerTest, MoveTransientOnFullscreen) {
1003 scoped_ptr<Window> w1(CreateTestWindow()); 1006 scoped_ptr<Window> w1(CreateTestWindow());
1004 w1->Show(); 1007 w1->Show();
1005 scoped_ptr<Window> w2(CreateTestWindow()); 1008 scoped_ptr<Window> w2(CreateTestWindow());
1006 w1->AddTransientChild(w2.get()); 1009 w1->AddTransientChild(w2.get());
1007 w2->Show(); 1010 w2->Show();
1008 wm::ActivateWindow(w1.get()); 1011 wm::ActivateWindow(w1.get());
1009 ASSERT_EQ("2 active=0", StateString()); 1012 ASSERT_EQ("2 active=0", StateString());
1010 1013
1011 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1014 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1012 ASSERT_EQ("0 M2 active=1", StateString()); 1015 ASSERT_EQ("0 F2 active=1", StateString());
1013 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 1016 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
1014 1017
1015 // Create another transient child of |w1|. We do this unparented, set up the 1018 // Create another transient child of |w1|. We do this unparented, set up the
1016 // transient parent then set parent. This is how NativeWidgetAura does things 1019 // transient parent then set parent. This is how NativeWidgetAura does things
1017 // too. 1020 // too.
1018 scoped_ptr<Window> w3(CreateTestWindowUnparented()); 1021 scoped_ptr<Window> w3(CreateTestWindowUnparented());
1019 w1->AddTransientChild(w3.get()); 1022 w1->AddTransientChild(w3.get());
1020 SetDefaultParentByPrimaryRootWindow(w3.get()); 1023 SetDefaultParentByPrimaryRootWindow(w3.get());
1021 w3->Show(); 1024 w3->Show();
1022 ASSERT_EQ("0 M3 active=1", StateString()); 1025 ASSERT_EQ("0 F3 active=1", StateString());
1023 1026
1024 // Minimize the window. All the transients are hidden as a result, so it ends 1027 // Minimize the window. All the transients are hidden as a result, so it ends
1025 // up in pending. 1028 // up in pending.
1026 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 1029 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
1027 ASSERT_EQ("0 P=M3 active=0", StateString()); 1030 ASSERT_EQ("0 P=F3 active=0", StateString());
1028 1031
1029 // Restore and everything should go back to the first workspace. 1032 // Restore and everything should go back to the first workspace.
1030 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 1033 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
1031 ASSERT_EQ("3 active=0", StateString()); 1034 ASSERT_EQ("3 active=0", StateString());
1032 } 1035 }
1033 1036
1034 // Verifies window visibility during various workspace changes. 1037 // Verifies window visibility during various workspace changes.
1035 TEST_F(WorkspaceManagerTest, VisibilityTests) { 1038 TEST_F(WorkspaceManagerTest, VisibilityTests) {
1036 scoped_ptr<Window> w1(CreateTestWindow()); 1039 scoped_ptr<Window> w1(CreateTestWindow());
1037 w1->Show(); 1040 w1->Show();
1038 EXPECT_TRUE(w1->IsVisible()); 1041 EXPECT_TRUE(w1->IsVisible());
1039 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); 1042 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
1040 1043
1041 // Create another window, activate it and maximized it. 1044 // Create another window, activate it and make it fullscreen.
1042 scoped_ptr<Window> w2(CreateTestWindow()); 1045 scoped_ptr<Window> w2(CreateTestWindow());
1043 w2->Show(); 1046 w2->Show();
1044 wm::ActivateWindow(w2.get()); 1047 wm::ActivateWindow(w2.get());
1045 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1048 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1046 EXPECT_TRUE(w2->IsVisible()); 1049 EXPECT_TRUE(w2->IsVisible());
1047 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); 1050 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
1048 EXPECT_FALSE(w1->IsVisible()); 1051 EXPECT_FALSE(w1->IsVisible());
1049 1052
1050 // Switch to w1. |w1| should be visible and |w2| hidden. 1053 // Switch to w1. |w1| should be visible and |w2| hidden.
1051 wm::ActivateWindow(w1.get()); 1054 wm::ActivateWindow(w1.get());
1052 EXPECT_TRUE(w1->IsVisible()); 1055 EXPECT_TRUE(w1->IsVisible());
1053 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); 1056 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
1054 EXPECT_FALSE(w2->IsVisible()); 1057 EXPECT_FALSE(w2->IsVisible());
1055 1058
1056 // Switch back to |w2|. 1059 // Switch back to |w2|.
1057 wm::ActivateWindow(w2.get()); 1060 wm::ActivateWindow(w2.get());
1058 EXPECT_TRUE(w2->IsVisible()); 1061 EXPECT_TRUE(w2->IsVisible());
1059 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); 1062 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
1060 EXPECT_FALSE(w1->IsVisible()); 1063 EXPECT_FALSE(w1->IsVisible());
1061 1064
1062 // Restore |w2|, both windows should be visible. 1065 // Restore |w2|, both windows should be visible.
1063 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 1066 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
1064 EXPECT_TRUE(w1->IsVisible()); 1067 EXPECT_TRUE(w1->IsVisible());
1065 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); 1068 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
1066 EXPECT_TRUE(w2->IsVisible()); 1069 EXPECT_TRUE(w2->IsVisible());
1067 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); 1070 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
1068 1071
1069 // Maximize |w2| again, then close it. 1072 // Make |w2| fullscreen again, then close it.
1070 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1073 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1071 w2->Hide(); 1074 w2->Hide();
1072 EXPECT_FALSE(w2->IsVisible()); 1075 EXPECT_FALSE(w2->IsVisible());
1073 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); 1076 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
1074 EXPECT_TRUE(w1->IsVisible()); 1077 EXPECT_TRUE(w1->IsVisible());
1075 1078
1076 // Create |w2| and make it fullscreen. 1079 // Create |w2| and maximize it.
1077 w2.reset(CreateTestWindow()); 1080 w2.reset(CreateTestWindow());
1078 w2->Show(); 1081 w2->Show();
1079 wm::ActivateWindow(w2.get()); 1082 wm::ActivateWindow(w2.get());
1080 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 1083 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
1081 EXPECT_TRUE(w2->IsVisible()); 1084 EXPECT_TRUE(w2->IsVisible());
1082 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); 1085 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
1083 EXPECT_FALSE(w1->IsVisible()); 1086 EXPECT_TRUE(w1->IsVisible());
1084 1087
1085 // Close |w2|. 1088 // Close |w2|.
1086 w2.reset(); 1089 w2.reset();
1087 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); 1090 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
1088 EXPECT_TRUE(w1->IsVisible()); 1091 EXPECT_TRUE(w1->IsVisible());
1089 } 1092 }
1090 1093
1091 // Verifies windows that are offscreen don't move when switching workspaces. 1094 // Verifies windows that are offscreen don't move when switching workspaces.
1092 TEST_F(WorkspaceManagerTest, DontMoveOnSwitch) { 1095 TEST_F(WorkspaceManagerTest, DontMoveOnSwitch) {
1093 aura::test::EventGenerator generator( 1096 aura::test::EventGenerator generator(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 w1->Show(); 1247 w1->Show();
1245 wm::ActivateWindow(w1.get()); 1248 wm::ActivateWindow(w1.get());
1246 1249
1247 // The window with the transient parent should get added to the same parent as 1250 // The window with the transient parent should get added to the same parent as
1248 // the normal window. 1251 // the normal window.
1249 EXPECT_EQ(w2->parent(), w1->parent()); 1252 EXPECT_EQ(w2->parent(), w1->parent());
1250 } 1253 }
1251 1254
1252 // Verifies changing TrackedByWorkspace works. 1255 // Verifies changing TrackedByWorkspace works.
1253 TEST_F(WorkspaceManagerTest, TrackedByWorkspace) { 1256 TEST_F(WorkspaceManagerTest, TrackedByWorkspace) {
1254 // Create a window maximized. 1257 // Create a fullscreen window.
1255 scoped_ptr<Window> w1(CreateTestWindow()); 1258 scoped_ptr<Window> w1(CreateTestWindow());
1256 w1->Show(); 1259 w1->Show();
1257 wm::ActivateWindow(w1.get()); 1260 wm::ActivateWindow(w1.get());
1258 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1261 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1259 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 1262 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
1260 EXPECT_TRUE(w1->IsVisible()); 1263 EXPECT_TRUE(w1->IsVisible());
1261 1264
1262 // Create a second window maximized and mark it not tracked by workspace 1265 // Create a second fullscreen window and mark it not tracked by workspace
1263 // manager. 1266 // manager.
1264 scoped_ptr<Window> w2(CreateTestWindowUnparented()); 1267 scoped_ptr<Window> w2(CreateTestWindowUnparented());
1265 w2->SetBounds(gfx::Rect(1, 6, 25, 30)); 1268 w2->SetBounds(gfx::Rect(1, 6, 25, 30));
1266 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1269 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1267 SetDefaultParentByPrimaryRootWindow(w2.get()); 1270 SetDefaultParentByPrimaryRootWindow(w2.get());
1268 w2->Show(); 1271 w2->Show();
1269 SetTrackedByWorkspace(w2.get(), false); 1272 SetTrackedByWorkspace(w2.get(), false);
1270 wm::ActivateWindow(w2.get()); 1273 wm::ActivateWindow(w2.get());
1271 1274
1272 // Activating |w2| should force it to have the same parent as |w1|. 1275 // Activating |w2| should force it to have the same parent as |w1|.
1273 EXPECT_EQ(w1->parent(), w2->parent()); 1276 EXPECT_EQ(w1->parent(), w2->parent());
1274 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 1277 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
1275 EXPECT_TRUE(w1->IsVisible()); 1278 EXPECT_TRUE(w1->IsVisible());
1276 EXPECT_TRUE(w2->IsVisible()); 1279 EXPECT_TRUE(w2->IsVisible());
1277 1280
1278 // Because |w2| isn't tracked we should be able to set the bounds of it. 1281 // Because |w2| isn't tracked we should be able to set the bounds of it.
1279 gfx::Rect bounds(w2->bounds()); 1282 gfx::Rect bounds(w2->bounds());
1280 bounds.Offset(4, 5); 1283 bounds.Offset(4, 5);
1281 w2->SetBounds(bounds); 1284 w2->SetBounds(bounds);
1282 EXPECT_EQ(bounds.ToString(), w2->bounds().ToString()); 1285 EXPECT_EQ(bounds.ToString(), w2->bounds().ToString());
1283 1286
1284 // Transition it to tracked by worskpace. It should end up in its own 1287 // Transition it to tracked by worskpace. It should end up in its own
1285 // workspace. 1288 // workspace.
1286 SetTrackedByWorkspace(w2.get(), true); 1289 SetTrackedByWorkspace(w2.get(), true);
1287 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); 1290 EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
1288 EXPECT_FALSE(w1->IsVisible()); 1291 EXPECT_FALSE(w1->IsVisible());
1289 EXPECT_TRUE(w2->IsVisible()); 1292 EXPECT_TRUE(w2->IsVisible());
1290 EXPECT_NE(w1->parent(), w2->parent()); 1293 EXPECT_NE(w1->parent(), w2->parent());
1291 } 1294 }
1292 1295
1293 // Verifies a window marked as persisting across all workspaces ends up in its 1296 // Verifies a window marked as persisting across all workspaces ends up in its
1294 // own workspace when maximized. 1297 // own workspace when get fullscreen.
1295 TEST_F(WorkspaceManagerTest, DeactivateDropsToDesktop) { 1298 TEST_F(WorkspaceManagerTest, DeactivateDropsToDesktop) {
1296 // Create a window maximized. 1299 // Create a fullscreen window.
1297 scoped_ptr<Window> w1(CreateTestWindow()); 1300 scoped_ptr<Window> w1(CreateTestWindow());
1298 w1->Show(); 1301 w1->Show();
1299 wm::ActivateWindow(w1.get()); 1302 wm::ActivateWindow(w1.get());
1300 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1303 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1301 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); 1304 EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
1302 EXPECT_TRUE(w1->IsVisible()); 1305 EXPECT_TRUE(w1->IsVisible());
1303 1306
1304 // Create another window that persists across all workspaces. It should end 1307 // Create another window that persists across all workspaces. It should end
1305 // up with the same parent as |w1|. 1308 // up with the same parent as |w1|.
1306 scoped_ptr<Window> w2(CreateTestWindow()); 1309 scoped_ptr<Window> w2(CreateTestWindow());
1307 SetPersistsAcrossAllWorkspaces( 1310 SetPersistsAcrossAllWorkspaces(
1308 w2.get(), 1311 w2.get(),
1309 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 1312 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
1310 w2->Show(); 1313 w2->Show();
1311 wm::ActivateWindow(w2.get()); 1314 wm::ActivateWindow(w2.get());
1312 EXPECT_EQ(w1->parent(), w2->parent()); 1315 EXPECT_EQ(w1->parent(), w2->parent());
1313 ASSERT_EQ("0 M2 active=1", StateString()); 1316 ASSERT_EQ("0 F2 active=1", StateString());
1314 1317
1315 // Activate |w1|, should result in dropping |w2| to the desktop. 1318 // Activate |w1|, should result in dropping |w2| to the desktop.
1316 wm::ActivateWindow(w1.get()); 1319 wm::ActivateWindow(w1.get());
1317 ASSERT_EQ("1 M1 active=1", StateString()); 1320 ASSERT_EQ("1 F1 active=1", StateString());
1318 } 1321 }
1319 1322
1320 // Test the basic auto placement of one and or two windows in a "simulated 1323 // Test the basic auto placement of one and or two windows in a "simulated
1321 // session" of sequential window operations. 1324 // session" of sequential window operations.
1322 TEST_F(WorkspaceManagerTest, BasicAutoPlacing) { 1325 TEST_F(WorkspaceManagerTest, BasicAutoPlacing) {
1323 // Test 1: In case there is no manageable window, no window should shift. 1326 // Test 1: In case there is no manageable window, no window should shift.
1324 1327
1325 scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); 1328 scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
1326 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); 1329 window1->SetBounds(gfx::Rect(16, 32, 640, 320));
1327 gfx::Rect desktop_area = window1->parent()->bounds(); 1330 gfx::Rect desktop_area = window1->parent()->bounds();
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 } 1726 }
1724 1727
1725 private: 1728 private:
1726 int change_count_; 1729 int change_count_;
1727 1730
1728 DISALLOW_COPY_AND_ASSIGN(DragMaximizedNonTrackedWindowObserver); 1731 DISALLOW_COPY_AND_ASSIGN(DragMaximizedNonTrackedWindowObserver);
1729 }; 1732 };
1730 1733
1731 } // namespace 1734 } // namespace
1732 1735
1733 // Verifies setting tracked by workspace to false and then dragging a maximized 1736 // Verifies setting tracked by workspace to false and then dragging a fullscreen
1734 // window doesn't result in changing the window hierarchy (which typically 1737 // window doesn't result in changing the window hierarchy (which typically
1735 // indicates new workspaces have been created). 1738 // indicates new workspaces have been created).
1736 TEST_F(WorkspaceManagerTest, DragMaximizedNonTrackedWindow) { 1739 TEST_F(WorkspaceManagerTest, DragFullscreenNonTrackedWindow) {
1737 aura::test::EventGenerator generator( 1740 aura::test::EventGenerator generator(
1738 Shell::GetPrimaryRootWindow(), gfx::Point()); 1741 Shell::GetPrimaryRootWindow(), gfx::Point());
1739 generator.MoveMouseTo(5, 5); 1742 generator.MoveMouseTo(5, 5);
1740 1743
1741 aura::test::TestWindowDelegate delegate; 1744 aura::test::TestWindowDelegate delegate;
1742 delegate.set_window_component(HTCAPTION); 1745 delegate.set_window_component(HTCAPTION);
1743 scoped_ptr<Window> w1( 1746 scoped_ptr<Window> w1(
1744 aura::test::CreateTestWindowWithDelegate(&delegate, 1747 aura::test::CreateTestWindowWithDelegate(&delegate,
1745 aura::client::WINDOW_TYPE_NORMAL, 1748 aura::client::WINDOW_TYPE_NORMAL,
1746 gfx::Rect(5, 6, 7, 8), 1749 gfx::Rect(5, 6, 7, 8),
1747 NULL)); 1750 NULL));
1748 SetDefaultParentByPrimaryRootWindow(w1.get()); 1751 SetDefaultParentByPrimaryRootWindow(w1.get());
1749 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1752 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
1750 w1->Show(); 1753 w1->Show();
1751 wm::ActivateWindow(w1.get()); 1754 wm::ActivateWindow(w1.get());
1752 DragMaximizedNonTrackedWindowObserver observer; 1755 DragMaximizedNonTrackedWindowObserver observer;
1753 w1->parent()->parent()->AddObserver(&observer); 1756 w1->parent()->parent()->AddObserver(&observer);
1754 const gfx::Rect max_bounds(w1->bounds()); 1757 const gfx::Rect max_bounds(w1->bounds());
1755 1758
1756 // There should be two workspace, one for the desktop and one for the 1759 // There should be two workspace, one for the desktop and one for the
1757 // maximized window with the maximized active. 1760 // maximized window with the maximized active.
1758 EXPECT_EQ("0 M1 active=1", StateString()); 1761 EXPECT_EQ("0 F1 active=1", StateString());
1759 1762
1760 generator.PressLeftButton(); 1763 generator.PressLeftButton();
1761 generator.MoveMouseTo(100, 100); 1764 generator.MoveMouseTo(100, 100);
1762 // The bounds shouldn't change (drag should result in nothing happening 1765 // The bounds shouldn't change (drag should result in nothing happening
1763 // now. 1766 // now.
1764 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString()); 1767 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
1765 EXPECT_EQ("0 M1 active=1", StateString()); 1768 EXPECT_EQ("0 F1 active=1", StateString());
1766 1769
1767 generator.ReleaseLeftButton(); 1770 generator.ReleaseLeftButton();
1768 EXPECT_EQ(0, observer.change_count()); 1771 EXPECT_EQ(0, observer.change_count());
1772
1773 // Set tracked to false and repeat, now the window should move.
1774 SetTrackedByWorkspace(w1.get(), false);
1775 generator.MoveMouseTo(5, 5);
1776 generator.PressLeftButton();
1777 generator.MoveMouseBy(100, 100);
1778 EXPECT_EQ(gfx::Rect(max_bounds.x() + 100, max_bounds.y() + 100,
1779 max_bounds.width(), max_bounds.height()).ToString(),
1780 w1->bounds().ToString());
1781 EXPECT_EQ("0 F1 active=1", StateString());
1782
1783 generator.ReleaseLeftButton();
1784 SetTrackedByWorkspace(w1.get(), true);
1785 // Marking the window tracked again should snap back to origin.
1786 EXPECT_EQ("0 F1 active=1", StateString());
1787 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
1788 EXPECT_EQ(0, observer.change_count());
1789
1790 w1->parent()->parent()->RemoveObserver(&observer);
1791 }
1792
1793 // Verifies setting tracked by workspace to false and then dragging a maximized
1794 // window can change the bound.
1795 TEST_F(WorkspaceManagerTest, DragMaximizedNonTrackedWindow) {
1796 aura::test::EventGenerator generator(
1797 Shell::GetPrimaryRootWindow(), gfx::Point());
1798 generator.MoveMouseTo(5, 5);
1799
1800 aura::test::TestWindowDelegate delegate;
1801 delegate.set_window_component(HTCAPTION);
1802 scoped_ptr<Window> w1(
1803 aura::test::CreateTestWindowWithDelegate(&delegate,
1804 aura::client::WINDOW_TYPE_NORMAL,
1805 gfx::Rect(5, 6, 7, 8),
1806 NULL));
1807 SetDefaultParentByPrimaryRootWindow(w1.get());
1808 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
1809 w1->Show();
1810 wm::ActivateWindow(w1.get());
1811 DragMaximizedNonTrackedWindowObserver observer;
1812 w1->parent()->parent()->AddObserver(&observer);
1813 const gfx::Rect max_bounds(w1->bounds());
1814
1815 generator.PressLeftButton();
1816 generator.MoveMouseTo(100, 100);
1817 // The bounds shouldn't change (drag should result in nothing happening
1818 // now.
1819 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
1820
1821 generator.ReleaseLeftButton();
1822 EXPECT_EQ(0, observer.change_count());
1769 1823
1770 // Set tracked to false and repeat, now the window should move. 1824 // Set tracked to false and repeat, now the window should move.
1771 SetTrackedByWorkspace(w1.get(), false); 1825 SetTrackedByWorkspace(w1.get(), false);
1772 generator.MoveMouseTo(5, 5); 1826 generator.MoveMouseTo(5, 5);
1773 generator.PressLeftButton(); 1827 generator.PressLeftButton();
1774 generator.MoveMouseBy(100, 100); 1828 generator.MoveMouseBy(100, 100);
1775 EXPECT_EQ(gfx::Rect(max_bounds.x() + 100, max_bounds.y() + 100, 1829 EXPECT_EQ(gfx::Rect(max_bounds.x() + 100, max_bounds.y() + 100,
1776 max_bounds.width(), max_bounds.height()).ToString(), 1830 max_bounds.width(), max_bounds.height()).ToString(),
1777 w1->bounds().ToString()); 1831 w1->bounds().ToString());
1778 EXPECT_EQ("0 M1 active=1", StateString());
1779 1832
1780 generator.ReleaseLeftButton(); 1833 generator.ReleaseLeftButton();
1781 SetTrackedByWorkspace(w1.get(), true); 1834 SetTrackedByWorkspace(w1.get(), true);
1782 // Marking the window tracked again should snap back to origin. 1835 // Marking the window tracked again should snap back to origin.
1783 EXPECT_EQ("0 M1 active=1", StateString());
1784 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString()); 1836 EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
1785 EXPECT_EQ(0, observer.change_count()); 1837 EXPECT_EQ(0, observer.change_count());
1786 1838
1787 w1->parent()->parent()->RemoveObserver(&observer); 1839 w1->parent()->parent()->RemoveObserver(&observer);
1788 } 1840 }
1789 1841
1790 // Verifies that a new maximized window becomes visible after its activation 1842 // Verifies that a new maximized window becomes visible after its activation
1791 // is requested, even though it does not become activated because a system 1843 // is requested, even though it does not become activated because a system
1792 // modal window is active. 1844 // modal window is active.
1793 TEST_F(WorkspaceManagerTest, SwitchFromModal) { 1845 TEST_F(WorkspaceManagerTest, SwitchFromModal) {
1794 scoped_ptr<Window> modal_window(CreateTestWindowUnparented()); 1846 scoped_ptr<Window> modal_window(CreateTestWindowUnparented());
1795 modal_window->SetBounds(gfx::Rect(10, 11, 21, 22)); 1847 modal_window->SetBounds(gfx::Rect(10, 11, 21, 22));
1796 modal_window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); 1848 modal_window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM);
1797 SetDefaultParentByPrimaryRootWindow(modal_window.get()); 1849 SetDefaultParentByPrimaryRootWindow(modal_window.get());
1798 modal_window->Show(); 1850 modal_window->Show();
1799 wm::ActivateWindow(modal_window.get()); 1851 wm::ActivateWindow(modal_window.get());
1800 1852
1801 scoped_ptr<Window> maximized_window(CreateTestWindow()); 1853 scoped_ptr<Window> maximized_window(CreateTestWindow());
1802 maximized_window->SetProperty( 1854 maximized_window->SetProperty(
1803 aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1855 aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
1804 maximized_window->Show(); 1856 maximized_window->Show();
1805 wm::ActivateWindow(maximized_window.get()); 1857 wm::ActivateWindow(maximized_window.get());
1806 EXPECT_TRUE(maximized_window->IsVisible()); 1858 EXPECT_TRUE(maximized_window->IsVisible());
1807 } 1859 }
1808 1860
1809 } // namespace internal 1861 } // namespace internal
1810 } // namespace ash 1862 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager.cc ('k') | chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698