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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
index d8c10f25ad17a08210e046955213c6dc04c7d110..daaacb4a53cb9a80d8ac6e9c31df8cffe0bcc86a 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
@@ -4,7 +4,9 @@
#include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_util.h"
+#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
#include "ash/switchable_windows.h"
#include "ash/test/ash_test_base.h"
@@ -673,29 +675,85 @@ TEST_F(MaximizeModeWindowManagerTest, TestMinimize) {
EXPECT_TRUE(window->IsVisible());
}
-// Check that a full screen window is changing to maximized in maximize mode,
-// cannot go to fullscreen and goes back to fullscreen thereafter.
-TEST_F(MaximizeModeWindowManagerTest, FullScreenModeTests) {
+// Check that a full screen window is staying full screen in maximize mode,
+// and that it returns to full screen thereafter (if left).
+TEST_F(MaximizeModeWindowManagerTest, KeepFullScreenModeOn) {
gfx::Rect rect(20, 140, 100, 100);
scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
wm::WindowState* window_state = wm::GetWindowState(w1.get());
+
+ ShelfLayoutManager* shelf =
+ Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
+
+ // Allow the shelf to hide.
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+
wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
window_state->OnWMEvent(&event);
+
+ // With full screen, the shelf should get hidden.
EXPECT_TRUE(window_state->IsFullscreen());
+ EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
CreateMaximizeModeWindowManager();
- // Fullscreen mode should now be off and it should not come back while in
- // maximize mode.
- EXPECT_FALSE(window_state->IsFullscreen());
- EXPECT_TRUE(window_state->IsMaximized());
+ // Full screen mode should now be off and it should not come back while in
oshima 2014/04/25 18:46:55 I didn't understand this comment. Fullscreen shoul
Mr4D (OOO till 08-26) 2014/04/25 19:55:19 Right. It should stay on. Changed
+ // maximize mode - the shelf still hidden.
+ EXPECT_TRUE(window_state->IsFullscreen());
+ EXPECT_FALSE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
+
+ // With leaving the fullscreen mode, the maximized mode should return and the
+ // shelf should become visible.
window_state->OnWMEvent(&event);
EXPECT_FALSE(window_state->IsFullscreen());
EXPECT_TRUE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+ // Ending the maximize mode should return to full screen and the shelf should
+ // be hidden again.
DestroyMaximizeModeWindowManager();
EXPECT_TRUE(window_state->IsFullscreen());
EXPECT_FALSE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
+}
+
+// Check that full screen mode can be turned on in maximized mode.
+TEST_F(MaximizeModeWindowManagerTest, AllowFullScreenMode) {
+ gfx::Rect rect(20, 140, 100, 100);
+ scoped_ptr<aura::Window> w1(CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
+ wm::WindowState* window_state = wm::GetWindowState(w1.get());
+ wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
oshima 2014/04/25 18:46:55 move this to 745, just before OnWMEvent
Mr4D (OOO till 08-26) 2014/04/25 19:55:19 Done.
+
+ ShelfLayoutManager* shelf =
+ Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
+
+ // Allow the shelf to hide.
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+
+ EXPECT_FALSE(window_state->IsFullscreen());
+ EXPECT_FALSE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+
+ CreateMaximizeModeWindowManager();
+
+ // Fullscreen mode should still be off and the shelf should be visible.
+ EXPECT_FALSE(window_state->IsFullscreen());
+ EXPECT_TRUE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
+
+ // After going into fullscreen mode, the shelf should be hidden.
+ window_state->OnWMEvent(&event);
+ EXPECT_TRUE(window_state->IsFullscreen());
+ EXPECT_FALSE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
+
+ // With the destruction of the manager we should fall back to the old state.
+ DestroyMaximizeModeWindowManager();
+ EXPECT_FALSE(window_state->IsFullscreen());
+ EXPECT_FALSE(window_state->IsMaximized());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
}
// Check that snapping operations get ignored.
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.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