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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 100903002: Ignore fullscreen windows which are behind other windows for fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include "ash/session_state_delegate.h" 7 #include "ash/session_state_delegate.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 internal::kShellWindowId_SystemModalContainer)->layout_manager(), 447 internal::kShellWindowId_SystemModalContainer)->layout_manager(),
448 controller->GetSystemModalLayoutManager( 448 controller->GetSystemModalLayoutManager(
449 session_modal_widget->GetNativeView())); 449 session_modal_widget->GetNativeView()));
450 session_modal_widget->Close(); 450 session_modal_widget->Close();
451 451
452 lock_modal_widget->Close(); 452 lock_modal_widget->Close();
453 UnblockUserSession(); 453 UnblockUserSession();
454 } 454 }
455 } 455 }
456 456
457 TEST_F(RootWindowControllerTest, GetTopmostFullscreenWindow) { 457 TEST_F(RootWindowControllerTest, GetWindowForFullscreenMode) {
458 UpdateDisplay("600x600"); 458 UpdateDisplay("600x600");
459 internal::RootWindowController* controller = 459 internal::RootWindowController* controller =
460 Shell::GetInstance()->GetPrimaryRootWindowController(); 460 Shell::GetInstance()->GetPrimaryRootWindowController();
461 461
462 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); 462 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
463 w1->Maximize(); 463 w1->Maximize();
464 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); 464 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
465 w2->SetFullscreen(true); 465 w2->SetFullscreen(true);
466 // |w3| is a transient child of |w2|. 466 // |w3| is a transient child of |w2|.
467 Widget* w3 = Widget::CreateWindowWithParentAndBounds(NULL, 467 Widget* w3 = Widget::CreateWindowWithParentAndBounds(NULL,
468 w2->GetNativeWindow(), gfx::Rect(0, 0, 100, 100)); 468 w2->GetNativeWindow(), gfx::Rect(0, 0, 100, 100));
469 469
470 // Test that GetTopmostFullscreenWindow() finds the fullscreen window when one 470 // Test that GetWindowForFullscreenMode() finds the fullscreen window when one
471 // of its transient children is active. 471 // of its transient children is active.
472 w3->Activate(); 472 w3->Activate();
473 EXPECT_EQ(w2->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 473 EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode());
474 474
475 // Since there's only one desktop workspace, it always returns the same 475 // If the topmost window is not fullscreen, it returns NULL.
476 // fullscreen window.
477 w1->Activate(); 476 w1->Activate();
478 EXPECT_EQ(w2->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 477 EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode());
479 } 478 w1->Close();
479 w3->Close();
480 480
481 TEST_F(RootWindowControllerTest, MultipleFullscreenWindows) { 481 // Only w2 remains, if minimized GetWindowForFullscreenMode should return
482 UpdateDisplay("600x600"); 482 // NULL.
483 internal::RootWindowController* controller =
484 Shell::GetInstance()->GetPrimaryRootWindowController();
485
486 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
487 w1->Maximize();
488 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
489 w2->SetFullscreen(true);
490 Widget* w3 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
491 w3->SetFullscreen(true);
492
493 // Test that GetTopmostFullscreenWindow() finds the active fullscreen window.
494 w2->Activate(); 483 w2->Activate();
495 EXPECT_EQ(w2->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 484 EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode());
496 w3->Activate(); 485 w2->Minimize();
497 EXPECT_EQ(w3->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 486 EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode());
498
499 // If the active window is not fullscreen, it still returns the topmost
500 // fullscreen window, which is the last active one.
501 w1->Activate();
502 EXPECT_EQ(w3->GetNativeWindow(), controller->GetTopmostFullscreenWindow());
503 } 487 }
504 488
505 // Test that user session window can't be focused if user session blocked by 489 // Test that user session window can't be focused if user session blocked by
506 // some overlapping UI. 490 // some overlapping UI.
507 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { 491 TEST_F(RootWindowControllerTest, FocusBlockedWindow) {
508 UpdateDisplay("600x600"); 492 UpdateDisplay("600x600");
509 internal::RootWindowController* controller = 493 internal::RootWindowController* controller =
510 Shell::GetInstance()->GetPrimaryRootWindowController(); 494 Shell::GetInstance()->GetPrimaryRootWindowController();
511 aura::Window* lock_container = 495 aura::Window* lock_container =
512 Shell::GetContainer(controller->root_window(), 496 Shell::GetContainer(controller->root_window(),
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 aura::WindowTracker tracker; 681 aura::WindowTracker tracker;
698 tracker.Add(keyboard_container); 682 tracker.Add(keyboard_container);
699 // Mock a login user profile change to reinitialize the keyboard. 683 // Mock a login user profile change to reinitialize the keyboard.
700 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); 684 ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
701 // keyboard_container should no longer be present. 685 // keyboard_container should no longer be present.
702 EXPECT_FALSE(tracker.Contains(keyboard_container)); 686 EXPECT_FALSE(tracker.Contains(keyboard_container));
703 } 687 }
704 688
705 } // namespace test 689 } // namespace test
706 } // namespace ash 690 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698