| Index: ash/wm/window_state_unittest.cc
|
| diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc
|
| index 21b2431bb94405595c2c90661af02b7917380c6f..52e6c999a466ec2065ea7e5d3c8c9b5f30da4fcb 100644
|
| --- a/ash/wm/window_state_unittest.cc
|
| +++ b/ash/wm/window_state_unittest.cc
|
| @@ -6,10 +6,11 @@
|
|
|
| #include <utility>
|
|
|
| +#include "ash/common/material_design/material_design_controller.h"
|
| #include "ash/common/wm/window_state.h"
|
| #include "ash/common/wm/wm_event.h"
|
| #include "ash/screen_util.h"
|
| -#include "ash/test/ash_test_base.h"
|
| +#include "ash/test/ash_md_test_base.h"
|
| #include "ash/wm/window_state_aura.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/test/test_window_delegate.h"
|
| @@ -49,11 +50,18 @@ class AlwaysMaximizeTestState : public WindowState::State {
|
|
|
| } // namespace
|
|
|
| -typedef test::AshTestBase WindowStateTest;
|
| +using WindowStateTest = test::AshMDTestBase;
|
| +
|
| +INSTANTIATE_TEST_CASE_P(
|
| + /* prefix intentionally left blank due to only one parameterization */,
|
| + WindowStateTest,
|
| + testing::Values(MaterialDesignController::NON_MATERIAL,
|
| + MaterialDesignController::MATERIAL_NORMAL,
|
| + MaterialDesignController::MATERIAL_EXPERIMENTAL));
|
|
|
| // Test that a window gets properly snapped to the display's edges in a
|
| // multi monitor environment.
|
| -TEST_F(WindowStateTest, SnapWindowBasic) {
|
| +TEST_P(WindowStateTest, SnapWindowBasic) {
|
| if (!SupportsMultipleDisplays())
|
| return;
|
|
|
| @@ -100,7 +108,7 @@ TEST_F(WindowStateTest, SnapWindowBasic) {
|
|
|
| // Test how the minimum and maximum size specified by the aura::WindowDelegate
|
| // affect snapping.
|
| -TEST_F(WindowStateTest, SnapWindowMinimumSize) {
|
| +TEST_P(WindowStateTest, SnapWindowMinimumSize) {
|
| if (!SupportsHostWindowResize())
|
| return;
|
|
|
| @@ -136,7 +144,7 @@ TEST_F(WindowStateTest, SnapWindowMinimumSize) {
|
| }
|
|
|
| // Test that the minimum size specified by aura::WindowDelegate gets respected.
|
| -TEST_F(WindowStateTest, TestRespectMinimumSize) {
|
| +TEST_P(WindowStateTest, TestRespectMinimumSize) {
|
| if (!SupportsHostWindowResize())
|
| return;
|
|
|
| @@ -166,7 +174,7 @@ TEST_F(WindowStateTest, TestRespectMinimumSize) {
|
|
|
| // Test that the minimum window size specified by aura::WindowDelegate does not
|
| // exceed the screen size.
|
| -TEST_F(WindowStateTest, TestIgnoreTooBigMinimumSize) {
|
| +TEST_P(WindowStateTest, TestIgnoreTooBigMinimumSize) {
|
| if (!SupportsHostWindowResize())
|
| return;
|
|
|
| @@ -197,7 +205,7 @@ TEST_F(WindowStateTest, TestIgnoreTooBigMinimumSize) {
|
| }
|
|
|
| // Test that setting the bounds of a snapped window keeps its snapped.
|
| -TEST_F(WindowStateTest, SnapWindowSetBounds) {
|
| +TEST_P(WindowStateTest, SnapWindowSetBounds) {
|
| if (!SupportsHostWindowResize())
|
| return;
|
|
|
| @@ -225,7 +233,7 @@ TEST_F(WindowStateTest, SnapWindowSetBounds) {
|
| }
|
|
|
| // Test that snapping left/right preserves the restore bounds.
|
| -TEST_F(WindowStateTest, RestoreBounds) {
|
| +TEST_P(WindowStateTest, RestoreBounds) {
|
| std::unique_ptr<aura::Window> window(
|
| CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100)));
|
| WindowState* window_state = GetWindowState(window.get());
|
| @@ -266,7 +274,7 @@ TEST_F(WindowStateTest, RestoreBounds) {
|
|
|
| // Test that maximizing an auto managed window, then snapping it puts the window
|
| // at the snapped bounds and not at the auto-managed (centered) bounds.
|
| -TEST_F(WindowStateTest, AutoManaged) {
|
| +TEST_P(WindowStateTest, AutoManaged) {
|
| std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
|
| WindowState* window_state = GetWindowState(window.get());
|
| window_state->set_window_position_managed(true);
|
| @@ -293,7 +301,7 @@ TEST_F(WindowStateTest, AutoManaged) {
|
| }
|
|
|
| // Test that the replacement of a State object works as expected.
|
| -TEST_F(WindowStateTest, SimpleStateSwap) {
|
| +TEST_P(WindowStateTest, SimpleStateSwap) {
|
| std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
|
| WindowState* window_state = GetWindowState(window.get());
|
| EXPECT_FALSE(window_state->IsMaximized());
|
| @@ -304,7 +312,7 @@ TEST_F(WindowStateTest, SimpleStateSwap) {
|
|
|
| // Test that the replacement of a state object, following a restore with the
|
| // original one restores the window to its original state.
|
| -TEST_F(WindowStateTest, StateSwapRestore) {
|
| +TEST_P(WindowStateTest, StateSwapRestore) {
|
| std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
|
| WindowState* window_state = GetWindowState(window.get());
|
| EXPECT_FALSE(window_state->IsMaximized());
|
| @@ -318,7 +326,11 @@ TEST_F(WindowStateTest, StateSwapRestore) {
|
|
|
| // Tests that a window that had same bounds as the work area shrinks after the
|
| // window is maximized and then restored.
|
| -TEST_F(WindowStateTest, RestoredWindowBoundsShrink) {
|
| +TEST_P(WindowStateTest, RestoredWindowBoundsShrink) {
|
| + if (!SupportsHostWindowResize())
|
| + return;
|
| +
|
| + UpdateDisplay("0+0-600x900");
|
| std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
|
| WindowState* window_state = GetWindowState(window.get());
|
| EXPECT_FALSE(window_state->IsMaximized());
|
| @@ -336,16 +348,18 @@ TEST_F(WindowStateTest, RestoredWindowBoundsShrink) {
|
| EXPECT_TRUE(work_area.Contains(window->bounds()));
|
| }
|
|
|
| -TEST_F(WindowStateTest, DoNotResizeMaximizedWindowInFullscreen) {
|
| +TEST_P(WindowStateTest, DoNotResizeMaximizedWindowInFullscreen) {
|
| if (!SupportsHostWindowResize())
|
| return;
|
| + const int height_offset = GetMdMaximizedWindowHeightOffset();
|
|
|
| std::unique_ptr<aura::Window> maximized(CreateTestWindowInShellWithId(0));
|
| std::unique_ptr<aura::Window> fullscreen(CreateTestWindowInShellWithId(1));
|
| WindowState* maximized_state = GetWindowState(maximized.get());
|
| maximized_state->Maximize();
|
| ASSERT_TRUE(maximized_state->IsMaximized());
|
| - EXPECT_EQ("0,0 800x553", maximized->GetBoundsInScreen().ToString());
|
| + EXPECT_EQ(gfx::Rect(0, 0, 800, 553 + height_offset).ToString(),
|
| + maximized->GetBoundsInScreen().ToString());
|
|
|
| // Entering fullscreen mode will not update the maximized window's size
|
| // under fullscreen.
|
| @@ -354,15 +368,17 @@ TEST_F(WindowStateTest, DoNotResizeMaximizedWindowInFullscreen) {
|
| fullscreen_state->OnWMEvent(&fullscreen_event);
|
| ASSERT_TRUE(fullscreen_state->IsFullscreen());
|
| ASSERT_TRUE(maximized_state->IsMaximized());
|
| - EXPECT_EQ("0,0 800x553", maximized->GetBoundsInScreen().ToString());
|
| + EXPECT_EQ(gfx::Rect(0, 0, 800, 553 + height_offset).ToString(),
|
| + maximized->GetBoundsInScreen().ToString());
|
|
|
| // Updating display size will update the maximum window size.
|
| UpdateDisplay("900x700");
|
| EXPECT_EQ("0,0 900x700", maximized->GetBoundsInScreen().ToString());
|
| fullscreen.reset();
|
|
|
| - // Exitting fullscreen will update the maximized widnow to the work area.
|
| - EXPECT_EQ("0,0 900x653", maximized->GetBoundsInScreen().ToString());
|
| + // Exiting fullscreen will update the maximized window to the work area.
|
| + EXPECT_EQ(gfx::Rect(0, 0, 900, 653 + height_offset).ToString(),
|
| + maximized->GetBoundsInScreen().ToString());
|
| }
|
|
|
| // TODO(skuhne): Add more unit test to verify the correctness for the restore
|
|
|