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 "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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 w3->Close(); | 451 w3->Close(); |
452 | 452 |
453 // Only w2 remains, if minimized GetWindowForFullscreenMode should return | 453 // Only w2 remains, if minimized GetWindowForFullscreenMode should return |
454 // NULL. | 454 // NULL. |
455 w2->Activate(); | 455 w2->Activate(); |
456 EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode()); | 456 EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode()); |
457 w2->Minimize(); | 457 w2->Minimize(); |
458 EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode()); | 458 EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode()); |
459 } | 459 } |
460 | 460 |
461 TEST_F(RootWindowControllerTest, MultipleDisplaysGetWindowForFullscreenMode) { | |
462 if (!SupportsMultipleDisplays()) | |
463 return; | |
464 | |
465 UpdateDisplay("600x600,600x600"); | |
466 Shell::RootWindowControllerList controllers = | |
467 Shell::GetInstance()->GetAllRootWindowControllers(); | |
468 | |
469 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); | |
470 w1->Maximize(); | |
471 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); | |
472 w2->SetFullscreen(true); | |
473 Widget* w3 = CreateTestWidget(gfx::Rect(600, 0, 100, 100)); | |
474 | |
475 EXPECT_EQ(w1->GetNativeWindow()->GetRootWindow(), | |
476 controllers[0]->root_window()); | |
477 EXPECT_EQ(w2->GetNativeWindow()->GetRootWindow(), | |
478 controllers[0]->root_window()); | |
479 EXPECT_EQ(w3->GetNativeWindow()->GetRootWindow(), | |
480 controllers[1]->root_window()); | |
481 | |
482 w2->Activate(); | |
483 EXPECT_EQ(w2->GetNativeWindow(), | |
484 controllers[0]->GetWindowForFullscreenMode()); | |
485 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); | |
486 | |
487 // Verify that the first root window controller remains in fullscreen mode | |
488 // when a window on the other display is activated. | |
489 w3->Activate(); | |
490 EXPECT_EQ(w2->GetNativeWindow(), | |
491 controllers[0]->GetWindowForFullscreenMode()); | |
oshima
2014/02/10 19:21:06
indent
flackr
2014/02/10 21:45:28
Done.
| |
492 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); | |
oshima
2014/02/10 19:21:06
can you also add scenario where w1 is activated?
flackr
2014/02/10 21:45:28
Done.
| |
493 } | |
494 | |
461 // Test that user session window can't be focused if user session blocked by | 495 // Test that user session window can't be focused if user session blocked by |
462 // some overlapping UI. | 496 // some overlapping UI. |
463 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { | 497 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { |
464 UpdateDisplay("600x600"); | 498 UpdateDisplay("600x600"); |
465 internal::RootWindowController* controller = | 499 internal::RootWindowController* controller = |
466 Shell::GetInstance()->GetPrimaryRootWindowController(); | 500 Shell::GetInstance()->GetPrimaryRootWindowController(); |
467 aura::Window* lock_container = | 501 aura::Window* lock_container = |
468 Shell::GetContainer(controller->root_window(), | 502 Shell::GetContainer(controller->root_window(), |
469 internal::kShellWindowId_LockScreenContainer); | 503 internal::kShellWindowId_LockScreenContainer); |
470 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, | 504 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 aura::WindowTracker tracker; | 691 aura::WindowTracker tracker; |
658 tracker.Add(keyboard_container); | 692 tracker.Add(keyboard_container); |
659 // Mock a login user profile change to reinitialize the keyboard. | 693 // Mock a login user profile change to reinitialize the keyboard. |
660 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 694 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
661 // keyboard_container should no longer be present. | 695 // keyboard_container should no longer be present. |
662 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 696 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
663 } | 697 } |
664 | 698 |
665 } // namespace test | 699 } // namespace test |
666 } // namespace ash | 700 } // namespace ash |
OLD | NEW |