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

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

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « ash/wm/immersive_fullscreen_controller_unittest.cc ('k') | ash/wm/overview/window_grid.cc » ('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 <string> 7 #include <string>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/public/cpp/config.h" 10 #include "ash/public/cpp/config.h"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shelf/wm_shelf.h" 13 #include "ash/shelf/shelf.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_port.h" 15 #include "ash/shell_port.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/shell_test_api.h" 17 #include "ash/test/shell_test_api.h"
18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
19 #include "ash/wm/mru_window_tracker.h" 19 #include "ash/wm/mru_window_tracker.h"
20 #include "ash/wm/overview/window_selector_controller.h" 20 #include "ash/wm/overview/window_selector_controller.h"
21 #include "ash/wm/switchable_windows.h" 21 #include "ash/wm/switchable_windows.h"
22 #include "ash/wm/window_properties.h" 22 #include "ash/wm/window_properties.h"
23 #include "ash/wm/window_state.h" 23 #include "ash/wm/window_state.h"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 // Check that a full screen window remains full screen upon entering maximize 859 // Check that a full screen window remains full screen upon entering maximize
860 // mode. Furthermore, checks that this window is not full screen upon exiting 860 // mode. Furthermore, checks that this window is not full screen upon exiting
861 // maximize mode if it was un-full-screened while in maximize mode. 861 // maximize mode if it was un-full-screened while in maximize mode.
862 TEST_F(MaximizeModeWindowManagerTest, KeepFullScreenModeOn) { 862 TEST_F(MaximizeModeWindowManagerTest, KeepFullScreenModeOn) {
863 gfx::Rect rect(20, 140, 100, 100); 863 gfx::Rect rect(20, 140, 100, 100);
864 std::unique_ptr<aura::Window> w1( 864 std::unique_ptr<aura::Window> w1(
865 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 865 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
866 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 866 wm::WindowState* window_state = wm::GetWindowState(w1.get());
867 867
868 WmShelf* shelf = GetPrimaryShelf(); 868 Shelf* shelf = GetPrimaryShelf();
869 869
870 // Allow the shelf to hide. 870 // Allow the shelf to hide.
871 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 871 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
872 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); 872 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
873 873
874 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 874 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
875 window_state->OnWMEvent(&event); 875 window_state->OnWMEvent(&event);
876 876
877 // With full screen, the shelf should get hidden. 877 // With full screen, the shelf should get hidden.
878 EXPECT_TRUE(window_state->IsFullscreen()); 878 EXPECT_TRUE(window_state->IsFullscreen());
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1053
1054 // Verifies that if a window is un-full-screened while in maximize mode, 1054 // Verifies that if a window is un-full-screened while in maximize mode,
1055 // other changes to that window's state (such as minimizing it) are 1055 // other changes to that window's state (such as minimizing it) are
1056 // preserved upon exiting maximize mode. 1056 // preserved upon exiting maximize mode.
1057 TEST_F(MaximizeModeWindowManagerTest, MinimizePreservedAfterLeavingFullscreen) { 1057 TEST_F(MaximizeModeWindowManagerTest, MinimizePreservedAfterLeavingFullscreen) {
1058 gfx::Rect rect(20, 140, 100, 100); 1058 gfx::Rect rect(20, 140, 100, 100);
1059 std::unique_ptr<aura::Window> w1( 1059 std::unique_ptr<aura::Window> w1(
1060 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1060 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1061 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 1061 wm::WindowState* window_state = wm::GetWindowState(w1.get());
1062 1062
1063 WmShelf* shelf = GetPrimaryShelf(); 1063 Shelf* shelf = GetPrimaryShelf();
1064 1064
1065 // Allow the shelf to hide and enter full screen. 1065 // Allow the shelf to hide and enter full screen.
1066 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1066 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1067 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 1067 wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
1068 window_state->OnWMEvent(&event); 1068 window_state->OnWMEvent(&event);
1069 ASSERT_FALSE(window_state->IsMinimized()); 1069 ASSERT_FALSE(window_state->IsMinimized());
1070 1070
1071 // Enter maximize mode, exit full screen, and then minimize the window. 1071 // Enter maximize mode, exit full screen, and then minimize the window.
1072 CreateMaximizeModeWindowManager(); 1072 CreateMaximizeModeWindowManager();
1073 window_state->OnWMEvent(&event); 1073 window_state->OnWMEvent(&event);
1074 window_state->Minimize(); 1074 window_state->Minimize();
1075 ASSERT_TRUE(window_state->IsMinimized()); 1075 ASSERT_TRUE(window_state->IsMinimized());
1076 1076
1077 // The window should remain minimized when exiting maximize mode. 1077 // The window should remain minimized when exiting maximize mode.
1078 DestroyMaximizeModeWindowManager(); 1078 DestroyMaximizeModeWindowManager();
1079 EXPECT_TRUE(window_state->IsMinimized()); 1079 EXPECT_TRUE(window_state->IsMinimized());
1080 } 1080 }
1081 1081
1082 // Check that full screen mode can be turned on in maximized mode and remains 1082 // Check that full screen mode can be turned on in maximized mode and remains
1083 // upon coming back. 1083 // upon coming back.
1084 TEST_F(MaximizeModeWindowManagerTest, AllowFullScreenMode) { 1084 TEST_F(MaximizeModeWindowManagerTest, AllowFullScreenMode) {
1085 gfx::Rect rect(20, 140, 100, 100); 1085 gfx::Rect rect(20, 140, 100, 100);
1086 std::unique_ptr<aura::Window> w1( 1086 std::unique_ptr<aura::Window> w1(
1087 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1087 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1088 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 1088 wm::WindowState* window_state = wm::GetWindowState(w1.get());
1089 1089
1090 WmShelf* shelf = GetPrimaryShelf(); 1090 Shelf* shelf = GetPrimaryShelf();
1091 1091
1092 // Allow the shelf to hide. 1092 // Allow the shelf to hide.
1093 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1093 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1094 1094
1095 EXPECT_FALSE(window_state->IsFullscreen()); 1095 EXPECT_FALSE(window_state->IsFullscreen());
1096 EXPECT_FALSE(window_state->IsMaximized()); 1096 EXPECT_FALSE(window_state->IsMaximized());
1097 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); 1097 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1098 1098
1099 CreateMaximizeModeWindowManager(); 1099 CreateMaximizeModeWindowManager();
1100 1100
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1697 EXPECT_EQ(1, observer.GetPostCountAndReset());
1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1699 observer.GetLastOldStateAndReset()); 1699 observer.GetLastOldStateAndReset());
1700 1700
1701 window_state->RemoveObserver(&observer); 1701 window_state->RemoveObserver(&observer);
1702 1702
1703 DestroyMaximizeModeWindowManager(); 1703 DestroyMaximizeModeWindowManager();
1704 } 1704 }
1705 1705
1706 } // namespace ash 1706 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/immersive_fullscreen_controller_unittest.cc ('k') | ash/wm/overview/window_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698