| OLD | NEW |
| 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/common/wm/window_state.h" | 5 #include "ash/common/wm/window_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/window_state_util.h" |
| 11 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
| 12 #include "ash/test/ash_md_test_base.h" | 13 #include "ash/test/ash_md_test_base.h" |
| 13 #include "ash/wm/window_state_aura.h" | 14 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 16 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/test/test_window_delegate.h" | 18 #include "ui/aura/test/test_window_delegate.h" |
| 18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 19 #include "ui/display/manager/display_manager.h" | 20 #include "ui/display/manager/display_manager.h" |
| 20 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 415 |
| 415 window_state->set_allow_set_bounds_in_maximized(false); | 416 window_state->set_allow_set_bounds_in_maximized(false); |
| 416 window_state->Maximize(); | 417 window_state->Maximize(); |
| 417 | 418 |
| 418 EXPECT_TRUE(window_state->IsMaximized()); | 419 EXPECT_TRUE(window_state->IsMaximized()); |
| 419 EXPECT_EQ(work_area, window->bounds()); | 420 EXPECT_EQ(work_area, window->bounds()); |
| 420 window->SetBounds(new_bounds); | 421 window->SetBounds(new_bounds); |
| 421 EXPECT_EQ(work_area, window->bounds()); | 422 EXPECT_EQ(work_area, window->bounds()); |
| 422 } | 423 } |
| 423 | 424 |
| 425 TEST_P(WindowStateTest, FullscreenMinimizedSwitching) { |
| 426 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 427 WindowState* window_state = GetWindowState(window.get()); |
| 428 |
| 429 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 430 ASSERT_TRUE(window_state->IsFullscreen()); |
| 431 |
| 432 // Toggling the fullscreen window should restore to normal. |
| 433 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 434 ASSERT_TRUE(window_state->IsNormalStateType()); |
| 435 |
| 436 window_state->Maximize(); |
| 437 ASSERT_TRUE(window_state->IsMaximized()); |
| 438 |
| 439 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 440 ASSERT_TRUE(window_state->IsFullscreen()); |
| 441 |
| 442 // Toggling the fullscreen window should restore to maximized. |
| 443 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 444 ASSERT_TRUE(window_state->IsMaximized()); |
| 445 |
| 446 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 447 ASSERT_TRUE(window_state->IsFullscreen()); |
| 448 |
| 449 // Minimize from fullscreen. |
| 450 window_state->Minimize(); |
| 451 ASSERT_TRUE(window_state->IsMinimized()); |
| 452 |
| 453 // Unminimize should restore to fullscreen. |
| 454 window_state->Unminimize(); |
| 455 ASSERT_TRUE(window_state->IsFullscreen()); |
| 456 |
| 457 // Toggling the fullscreen window should restore to maximized. |
| 458 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 459 ASSERT_TRUE(window_state->IsMaximized()); |
| 460 |
| 461 // Minimize from fullscreen. |
| 462 window_state->Minimize(); |
| 463 ASSERT_TRUE(window_state->IsMinimized()); |
| 464 |
| 465 // Fullscreen a minimized window. |
| 466 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 467 ASSERT_TRUE(window_state->IsFullscreen()); |
| 468 |
| 469 // Toggling the fullscreen window should not return to minimized. It should |
| 470 // return to the state before minimizing and fullscreen. |
| 471 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 472 ASSERT_TRUE(window_state->IsMaximized()); |
| 473 } |
| 474 |
| 424 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 475 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
| 425 // operation. | 476 // operation. |
| 426 | 477 |
| 427 } // namespace wm | 478 } // namespace wm |
| 428 } // namespace ash | 479 } // namespace ash |
| OLD | NEW |