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

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: Comments. 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
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 }
480 479
481 TEST_F(RootWindowControllerTest, MultipleFullscreenWindows) { 480 TEST_F(RootWindowControllerTest, MultipleFullscreenWindows) {
pkotwicz 2013/12/05 20:50:10 Nit: Can we remove this test? It does not test any
flackr 2013/12/05 21:39:16 It tests that the topmost of multiple fullscreen w
482 UpdateDisplay("600x600"); 481 UpdateDisplay("600x600");
483 internal::RootWindowController* controller = 482 internal::RootWindowController* controller =
484 Shell::GetInstance()->GetPrimaryRootWindowController(); 483 Shell::GetInstance()->GetPrimaryRootWindowController();
485 484
486 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); 485 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
487 w1->Maximize(); 486 w1->Maximize();
488 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); 487 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
489 w2->SetFullscreen(true); 488 w2->SetFullscreen(true);
490 Widget* w3 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); 489 Widget* w3 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
491 w3->SetFullscreen(true); 490 w3->SetFullscreen(true);
492 491
493 // Test that GetTopmostFullscreenWindow() finds the active fullscreen window. 492 // Test that GetWindowForFullscreenMode() finds the active fullscreen window.
494 w2->Activate(); 493 w2->Activate();
495 EXPECT_EQ(w2->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 494 EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode());
496 w3->Activate(); 495 w3->Activate();
497 EXPECT_EQ(w3->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 496 EXPECT_EQ(w3->GetNativeWindow(), controller->GetWindowForFullscreenMode());
498 497
499 // If the active window is not fullscreen, it still returns the topmost 498 // If the active window is not fullscreen, it returns NULL.
500 // fullscreen window, which is the last active one.
501 w1->Activate(); 499 w1->Activate();
502 EXPECT_EQ(w3->GetNativeWindow(), controller->GetTopmostFullscreenWindow()); 500 EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode());
503 } 501 }
504 502
505 // Test that user session window can't be focused if user session blocked by 503 // Test that user session window can't be focused if user session blocked by
506 // some overlapping UI. 504 // some overlapping UI.
507 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { 505 TEST_F(RootWindowControllerTest, FocusBlockedWindow) {
508 UpdateDisplay("600x600"); 506 UpdateDisplay("600x600");
509 internal::RootWindowController* controller = 507 internal::RootWindowController* controller =
510 Shell::GetInstance()->GetPrimaryRootWindowController(); 508 Shell::GetInstance()->GetPrimaryRootWindowController();
511 aura::Window* lock_container = 509 aura::Window* lock_container =
512 Shell::GetContainer(controller->root_window(), 510 Shell::GetContainer(controller->root_window(),
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 aura::WindowTracker tracker; 695 aura::WindowTracker tracker;
698 tracker.Add(keyboard_container); 696 tracker.Add(keyboard_container);
699 // Mock a login user profile change to reinitialize the keyboard. 697 // Mock a login user profile change to reinitialize the keyboard.
700 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); 698 ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
701 // keyboard_container should no longer be present. 699 // keyboard_container should no longer be present.
702 EXPECT_FALSE(tracker.Contains(keyboard_container)); 700 EXPECT_FALSE(tracker.Contains(keyboard_container));
703 } 701 }
704 702
705 } // namespace test 703 } // namespace test
706 } // namespace ash 704 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698