| 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 9f2c5d6b0161c5e857d1a6c0b772665ab6ea829d..961e1cf1c29a395c9d46971e6c3cd8d64a1526e1 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"
|
| @@ -639,29 +641,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
|
| + // 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);
|
| +
|
| + 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.
|
|
|