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

Unified Diff: ash/wm/window_state_unittest.cc

Issue 2622053004: ash: Restore previous show state after exiting fullscreen. (Closed)
Patch Set: Rebase Created 3 years, 11 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
Index: ash/wm/window_state_unittest.cc
diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc
index 6431f4fae76a03ece7f67b021aa94d54e3a3ffd1..c5eff758c597a560c5a9d352535eed8036fc4b86 100644
--- a/ash/wm/window_state_unittest.cc
+++ b/ash/wm/window_state_unittest.cc
@@ -8,6 +8,7 @@
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/wm/window_state.h"
+#include "ash/common/wm/window_state_util.h"
#include "ash/common/wm/wm_event.h"
#include "ash/test/ash_md_test_base.h"
#include "ash/wm/window_state_aura.h"
@@ -421,6 +422,56 @@ TEST_P(WindowStateTest, AllowSetBoundsInMaximized) {
EXPECT_EQ(work_area, window->bounds());
}
+TEST_P(WindowStateTest, FullscreenMinimizedSwitching) {
+ std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
+ WindowState* window_state = GetWindowState(window.get());
+
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsFullscreen());
+
+ // Toggling the fullscreen window should restore to normal.
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsNormalStateType());
+
+ window_state->Maximize();
+ ASSERT_TRUE(window_state->IsMaximized());
+
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsFullscreen());
+
+ // Toggling the fullscreen window should restore to maximized.
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsMaximized());
+
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsFullscreen());
+
+ // Minimize from fullscreen.
+ window_state->Minimize();
+ ASSERT_TRUE(window_state->IsMinimized());
+
+ // Unminimize should restore to fullscreen.
+ window_state->Unminimize();
+ ASSERT_TRUE(window_state->IsFullscreen());
+
+ // Toggling the fullscreen window should restore to maximized.
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsMaximized());
+
+ // Minimize from fullscreen.
+ window_state->Minimize();
+ ASSERT_TRUE(window_state->IsMinimized());
+
+ // Fullscreen a minimized window.
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsFullscreen());
+
+ // Toggling the fullscreen window should not return to minimized. It should
+ // return to the state before minimizing and fullscreen.
+ ash::wm::ToggleFullScreen(window_state, nullptr);
+ ASSERT_TRUE(window_state->IsMaximized());
+}
+
// TODO(skuhne): Add more unit test to verify the correctness for the restore
// operation.
« no previous file with comments | « ash/wm/screen_pinning_controller.cc ('k') | chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698