| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); | 567 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); |
| 568 | 568 |
| 569 // Verify that the first root window controller remains in fullscreen mode | 569 // Verify that the first root window controller remains in fullscreen mode |
| 570 // when a window on the other display is activated. | 570 // when a window on the other display is activated. |
| 571 w3->Activate(); | 571 w3->Activate(); |
| 572 EXPECT_EQ(w2->GetNativeWindow(), | 572 EXPECT_EQ(w2->GetNativeWindow(), |
| 573 controllers[0]->GetWindowForFullscreenMode()); | 573 controllers[0]->GetWindowForFullscreenMode()); |
| 574 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); | 574 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); |
| 575 } | 575 } |
| 576 | 576 |
| 577 // Test that GetRootWindowController() works with multiple displays and |
| 578 // child widgets. |
| 579 TEST_F(RootWindowControllerTest, GetRootWindowController) { |
| 580 if (!SupportsMultipleDisplays()) |
| 581 return; |
| 582 UpdateDisplay("600x600,600x600"); |
| 583 Shell::RootWindowControllerList controllers = |
| 584 Shell::GetInstance()->GetAllRootWindowControllers(); |
| 585 ASSERT_EQ(2u, controllers.size()); |
| 586 |
| 587 // Test null. |
| 588 EXPECT_FALSE(GetRootWindowController(nullptr)); |
| 589 |
| 590 // Test a widget on the first display. |
| 591 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); |
| 592 EXPECT_EQ(controllers[0], |
| 593 GetRootWindowController(w1->GetNativeWindow()->GetRootWindow())); |
| 594 |
| 595 // Test a child widget. |
| 596 Widget* w2 = Widget::CreateWindowWithParentAndBounds( |
| 597 nullptr, w1->GetNativeWindow(), gfx::Rect(0, 0, 100, 100)); |
| 598 EXPECT_EQ(controllers[0], |
| 599 GetRootWindowController(w2->GetNativeWindow()->GetRootWindow())); |
| 600 |
| 601 // Test a widget on the second display. |
| 602 Widget* w3 = CreateTestWidget(gfx::Rect(600, 0, 100, 100)); |
| 603 EXPECT_EQ(controllers[1], |
| 604 GetRootWindowController(w3->GetNativeWindow()->GetRootWindow())); |
| 605 } |
| 606 |
| 577 // Test that user session window can't be focused if user session blocked by | 607 // Test that user session window can't be focused if user session blocked by |
| 578 // some overlapping UI. | 608 // some overlapping UI. |
| 579 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { | 609 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { |
| 580 UpdateDisplay("600x600"); | 610 UpdateDisplay("600x600"); |
| 581 RootWindowController* controller = | 611 RootWindowController* controller = |
| 582 Shell::GetInstance()->GetPrimaryRootWindowController(); | 612 Shell::GetInstance()->GetPrimaryRootWindowController(); |
| 583 aura::Window* lock_container = | 613 aura::Window* lock_container = |
| 584 controller->GetContainer(kShellWindowId_LockScreenContainer); | 614 controller->GetContainer(kShellWindowId_LockScreenContainer); |
| 585 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, | 615 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, |
| 586 lock_container, gfx::Rect(0, 0, 100, 100))->GetNativeView(); | 616 lock_container, gfx::Rect(0, 0, 100, 100))->GetNativeView(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1049 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
| 1020 gfx::Rect(0, 400, 800, 200)); | 1050 gfx::Rect(0, 400, 800, 200)); |
| 1021 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1051 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
| 1022 | 1052 |
| 1023 UpdateDisplay("600x800"); | 1053 UpdateDisplay("600x800"); |
| 1024 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1054 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
| 1025 } | 1055 } |
| 1026 | 1056 |
| 1027 } // namespace test | 1057 } // namespace test |
| 1028 } // namespace ash | 1058 } // namespace ash |
| OLD | NEW |