Chromium Code Reviews| Index: ash/common/wm/workspace/workspace_layout_manager_unittest.cc |
| diff --git a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc |
| index 5b102ca7b726ee0179bcbd30bdf34a471d9452dc..7c9029e98296f66c8cf14f57628fcb841ab0adfd 100644 |
| --- a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc |
| +++ b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc |
| @@ -29,6 +29,7 @@ |
| #include "ui/aura/env.h" |
| #include "ui/base/ui_base_switches.h" |
| #include "ui/base/ui_base_types.h" |
| +#include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| #include "ui/display/display.h" |
| #include "ui/display/screen.h" |
| #include "ui/gfx/geometry/insets.h" |
| @@ -539,6 +540,38 @@ TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) { |
| EXPECT_FALSE(observer.is_fullscreen()); |
| } |
| +TEST_F(WorkspaceLayoutManagerTest, SnappedWindowMayNotUpdateOnWorkAreaChanged) { |
|
James Cook
2016/12/20 17:50:31
nit: Maybe call this test what you expect the good
Qiang(Joe) Xu
2016/12/21 02:37:55
done by adding a comment and adjust the title a li
|
| + UpdateDisplay("300x400"); |
| + std::unique_ptr<WindowOwner> window_owner( |
| + CreateTestWindow(gfx::Rect(40, 40, 40, 40))); |
|
James Cook
2016/12/20 17:50:31
tip: It doesn't matter here, but in tests, vary yo
Qiang(Joe) Xu
2016/12/21 02:37:55
Done.
|
| + WmWindow* window = window_owner->window(); |
| + wm::WindowState* window_state = window->GetWindowState(); |
| + gfx::Insets insets(0, 0, 50, 0); |
| + WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); |
| + const wm::WMEvent snap_left(wm::WM_EVENT_SNAP_LEFT); |
| + window_state->OnWMEvent(&snap_left); |
| + EXPECT_EQ(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED, window_state->GetStateType()); |
| + const gfx::Rect kWorkAreaBounds = |
| + display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
| + gfx::Rect expected = |
|
James Cook
2016/12/20 17:50:31
How about |expected_bounds| or |expected_window_bo
Qiang(Joe) Xu
2016/12/21 02:37:55
Done.
|
| + gfx::Rect(kWorkAreaBounds.x(), kWorkAreaBounds.y(), |
| + kWorkAreaBounds.width() / 2, kWorkAreaBounds.height()); |
| + EXPECT_EQ(expected.ToString(), window->GetBounds().ToString()); |
| + |
| + ui::ScopedAnimationDurationScaleMode test_duration_mode( |
| + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
| + // The following two SetDisplayWorkAreaInsets calls simulate the case of |
| + // crbug.com/673803 that work area first becomes fullscreen and then return to |
|
James Cook
2016/12/20 17:50:31
nit: return -> returns
Qiang(Joe) Xu
2016/12/21 02:37:55
Done.
|
| + // the original state. |
| + WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets(0, 0, 0, 0)); |
| + ui::LayerAnimator* animator = window->GetLayer()->GetAnimator(); |
| + EXPECT_TRUE(animator->is_animating()); |
| + WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); |
| + animator->StopAnimating(); |
| + EXPECT_FALSE(animator->is_animating()); |
| + EXPECT_EQ(expected.ToString(), window->GetBounds().ToString()); |
| +} |
| + |
| // Following "Solo" tests were originally written for BaseLayoutManager. |
| using WorkspaceLayoutManagerSoloTest = AshTest; |