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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc

Issue 247363005: Fullscreen/immersive mode is allowed in touch view mode, the shelf gets hidden and an edge swipe br… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 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
« no previous file with comments | « ash/wm/default_state.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_state.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_window_manager.h" 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
6 6
7 #include "ash/root_window_controller.h"
7 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shell.h" 10 #include "ash/shell.h"
9 #include "ash/switchable_windows.h" 11 #include "ash/switchable_windows.h"
10 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
11 #include "ash/test/shell_test_api.h" 13 #include "ash/test/shell_test_api.h"
12 #include "ash/wm/mru_window_tracker.h" 14 #include "ash/wm/mru_window_tracker.h"
13 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
14 #include "ash/wm/wm_event.h" 16 #include "ash/wm/wm_event.h"
15 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
16 #include "base/values.h" 18 #include "base/values.h"
17 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 EXPECT_TRUE(window_state->IsMaximized()); 668 EXPECT_TRUE(window_state->IsMaximized());
667 EXPECT_FALSE(window_state->IsMinimized()); 669 EXPECT_FALSE(window_state->IsMinimized());
668 EXPECT_TRUE(window->IsVisible()); 670 EXPECT_TRUE(window->IsVisible());
669 671
670 ash::Shell::GetInstance()->EnableMaximizeModeWindowManager(false); 672 ash::Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
671 EXPECT_FALSE(window_state->IsMaximized()); 673 EXPECT_FALSE(window_state->IsMaximized());
672 EXPECT_FALSE(window_state->IsMinimized()); 674 EXPECT_FALSE(window_state->IsMinimized());
673 EXPECT_TRUE(window->IsVisible()); 675 EXPECT_TRUE(window->IsVisible());
674 } 676 }
675 677
676 // Check that a full screen window is changing to maximized in maximize mode, 678 // Check that a full screen window is staying full screen in maximize mode,
677 // cannot go to fullscreen and goes back to fullscreen thereafter. 679 // and that it returns to full screen thereafter (if left).
678 TEST_F(MaximizeModeWindowManagerTest, FullScreenModeTests) { 680 TEST_F(MaximizeModeWindowManagerTest, KeepFullScreenModeOn) {
679 gfx::Rect rect(20, 140, 100, 100); 681 gfx::Rect rect(20, 140, 100, 100);
680 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 682 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
681 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 683 wm::WindowState* window_state = wm::GetWindowState(w1.get());
684
685 ShelfLayoutManager* shelf =
686 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
687
688 // Allow the shelf to hide.
689 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
690 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
691
692 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
693 window_state->OnWMEvent(&event);
694
695 // With full screen, the shelf should get hidden.
696 EXPECT_TRUE(window_state->IsFullscreen());
697 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
698
699 CreateMaximizeModeWindowManager();
700
701 // The Full screen mode should continue to be on.
702 EXPECT_TRUE(window_state->IsFullscreen());
703 EXPECT_FALSE(window_state->IsMaximized());
704 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
705
706 // With leaving the fullscreen mode, the maximized mode should return and the
707 // shelf should become visible.
708 window_state->OnWMEvent(&event);
709 EXPECT_FALSE(window_state->IsFullscreen());
710 EXPECT_TRUE(window_state->IsMaximized());
711 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
712
713 // Ending the maximize mode should return to full screen and the shelf should
714 // be hidden again.
715 DestroyMaximizeModeWindowManager();
716 EXPECT_TRUE(window_state->IsFullscreen());
717 EXPECT_FALSE(window_state->IsMaximized());
718 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
719 }
720
721 // Check that full screen mode can be turned on in maximized mode.
722 TEST_F(MaximizeModeWindowManagerTest, AllowFullScreenMode) {
723 gfx::Rect rect(20, 140, 100, 100);
724 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
725 wm::WindowState* window_state = wm::GetWindowState(w1.get());
726
727 ShelfLayoutManager* shelf =
728 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
729
730 // Allow the shelf to hide.
731 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
732
733 EXPECT_FALSE(window_state->IsFullscreen());
734 EXPECT_FALSE(window_state->IsMaximized());
735 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
736
737 CreateMaximizeModeWindowManager();
738
739 // Fullscreen mode should still be off and the shelf should be visible.
740 EXPECT_FALSE(window_state->IsFullscreen());
741 EXPECT_TRUE(window_state->IsMaximized());
742 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
743
744 // After going into fullscreen mode, the shelf should be hidden.
682 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 745 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
683 window_state->OnWMEvent(&event); 746 window_state->OnWMEvent(&event);
684 EXPECT_TRUE(window_state->IsFullscreen()); 747 EXPECT_TRUE(window_state->IsFullscreen());
748 EXPECT_FALSE(window_state->IsMaximized());
749 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
685 750
686 CreateMaximizeModeWindowManager(); 751 // With the destruction of the manager we should fall back to the old state.
687 752 DestroyMaximizeModeWindowManager();
688 // Fullscreen mode should now be off and it should not come back while in
689 // maximize mode.
690 EXPECT_FALSE(window_state->IsFullscreen()); 753 EXPECT_FALSE(window_state->IsFullscreen());
691 EXPECT_TRUE(window_state->IsMaximized());
692 window_state->OnWMEvent(&event);
693 EXPECT_FALSE(window_state->IsFullscreen());
694 EXPECT_TRUE(window_state->IsMaximized());
695
696 DestroyMaximizeModeWindowManager();
697 EXPECT_TRUE(window_state->IsFullscreen());
698 EXPECT_FALSE(window_state->IsMaximized()); 754 EXPECT_FALSE(window_state->IsMaximized());
755 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
699 } 756 }
700 757
701 // Check that snapping operations get ignored. 758 // Check that snapping operations get ignored.
702 TEST_F(MaximizeModeWindowManagerTest, SnapModeTests) { 759 TEST_F(MaximizeModeWindowManagerTest, SnapModeTests) {
703 gfx::Rect rect(20, 140, 100, 100); 760 gfx::Rect rect(20, 140, 100, 100);
704 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 761 scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
705 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 762 wm::WindowState* window_state = wm::GetWindowState(w1.get());
706 wm::WMEvent event_left(wm::WM_EVENT_SNAP_LEFT); 763 wm::WMEvent event_left(wm::WM_EVENT_SNAP_LEFT);
707 wm::WMEvent event_right(wm::WM_EVENT_SNAP_RIGHT); 764 wm::WMEvent event_right(wm::WM_EVENT_SNAP_RIGHT);
708 window_state->OnWMEvent(&event_left); 765 window_state->OnWMEvent(&event_left);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 generator.MoveMouseBy(10, 5); 824 generator.MoveMouseBy(10, 5);
768 RunAllPendingInMessageLoop(); 825 RunAllPendingInMessageLoop();
769 generator.ReleaseLeftButton(); 826 generator.ReleaseLeftButton();
770 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x()); 827 EXPECT_EQ(first_dragged_origin.x() + 10, window->bounds().x());
771 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y()); 828 EXPECT_EQ(first_dragged_origin.y() + 5, window->bounds().y());
772 } 829 }
773 830
774 #endif // OS_WIN 831 #endif // OS_WIN
775 832
776 } // namespace ash 833 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/default_state.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698