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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 149493008: Use active window if on current workspace for fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update fullscreen state tracking in workspace and only consider switchable containers for active no… Created 6 years, 10 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/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
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 w1->Activate();
483 EXPECT_EQ(NULL, controllers[0]->GetWindowForFullscreenMode());
484 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode());
485
486 w2->Activate();
487 EXPECT_EQ(w2->GetNativeWindow(),
488 controllers[0]->GetWindowForFullscreenMode());
489 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode());
490
491 // Verify that the first root window controller remains in fullscreen mode
492 // when a window on the other display is activated.
493 w3->Activate();
494 EXPECT_EQ(w2->GetNativeWindow(),
495 controllers[0]->GetWindowForFullscreenMode());
496 EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode());
497 }
498
461 // Test that user session window can't be focused if user session blocked by 499 // Test that user session window can't be focused if user session blocked by
462 // some overlapping UI. 500 // some overlapping UI.
463 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { 501 TEST_F(RootWindowControllerTest, FocusBlockedWindow) {
464 UpdateDisplay("600x600"); 502 UpdateDisplay("600x600");
465 internal::RootWindowController* controller = 503 internal::RootWindowController* controller =
466 Shell::GetInstance()->GetPrimaryRootWindowController(); 504 Shell::GetInstance()->GetPrimaryRootWindowController();
467 aura::Window* lock_container = 505 aura::Window* lock_container =
468 Shell::GetContainer(controller->root_window(), 506 Shell::GetContainer(controller->root_window(),
469 internal::kShellWindowId_LockScreenContainer); 507 internal::kShellWindowId_LockScreenContainer);
470 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, 508 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 aura::WindowTracker tracker; 695 aura::WindowTracker tracker;
658 tracker.Add(keyboard_container); 696 tracker.Add(keyboard_container);
659 // Mock a login user profile change to reinitialize the keyboard. 697 // Mock a login user profile change to reinitialize the keyboard.
660 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); 698 ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
661 // keyboard_container should no longer be present. 699 // keyboard_container should no longer be present.
662 EXPECT_FALSE(tracker.Contains(keyboard_container)); 700 EXPECT_FALSE(tracker.Contains(keyboard_container));
663 } 701 }
664 702
665 } // namespace test 703 } // namespace test
666 } // namespace ash 704 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698