OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace/workspace_layout_manager.h" | 5 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // to the original state. | 569 // to the original state. |
570 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets(0, 0, 0, 0)); | 570 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets(0, 0, 0, 0)); |
571 ui::LayerAnimator* animator = window->GetLayer()->GetAnimator(); | 571 ui::LayerAnimator* animator = window->GetLayer()->GetAnimator(); |
572 EXPECT_TRUE(animator->is_animating()); | 572 EXPECT_TRUE(animator->is_animating()); |
573 WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); | 573 WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); |
574 animator->StopAnimating(); | 574 animator->StopAnimating(); |
575 EXPECT_FALSE(animator->is_animating()); | 575 EXPECT_FALSE(animator->is_animating()); |
576 EXPECT_EQ(expected_bounds.ToString(), window->GetBounds().ToString()); | 576 EXPECT_EQ(expected_bounds.ToString(), window->GetBounds().ToString()); |
577 } | 577 } |
578 | 578 |
| 579 // Do not adjust window bounds to ensure minimum visibility for transient |
| 580 // windows (crbug.com/624806). |
| 581 TEST_F(WorkspaceLayoutManagerTest, |
| 582 DoNotAdjustTransientWindowBoundsToEnsureMinimumVisibility) { |
| 583 UpdateDisplay("300x400"); |
| 584 WindowOwner window_owner(WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
| 585 ui::LAYER_TEXTURED)); |
| 586 WmWindow* window = window_owner.window(); |
| 587 window->SetBounds(gfx::Rect(10, 0, 100, 200)); |
| 588 ParentWindowInPrimaryRootWindow(window); |
| 589 window->Show(); |
| 590 |
| 591 std::unique_ptr<WindowOwner> window2_owner( |
| 592 CreateTestWindow(gfx::Rect(10, 0, 40, 20))); |
| 593 WmWindow* window2 = window2_owner->window(); |
| 594 AddTransientChild(window, window2); |
| 595 window2->Show(); |
| 596 |
| 597 gfx::Rect expected_bounds = window2->GetBounds(); |
| 598 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets(50, 0, 0, 0)); |
| 599 EXPECT_EQ(expected_bounds.ToString(), window2->GetBounds().ToString()); |
| 600 } |
| 601 |
579 // Following "Solo" tests were originally written for BaseLayoutManager. | 602 // Following "Solo" tests were originally written for BaseLayoutManager. |
580 using WorkspaceLayoutManagerSoloTest = AshTest; | 603 using WorkspaceLayoutManagerSoloTest = AshTest; |
581 | 604 |
582 // Tests normal->maximize->normal. | 605 // Tests normal->maximize->normal. |
583 TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) { | 606 TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) { |
584 gfx::Rect bounds(100, 100, 200, 200); | 607 gfx::Rect bounds(100, 100, 200, 200); |
585 std::unique_ptr<WindowOwner> window_owner(CreateTestWindow(bounds)); | 608 std::unique_ptr<WindowOwner> window_owner(CreateTestWindow(bounds)); |
586 WmWindow* window = window_owner->window(); | 609 WmWindow* window = window_owner->window(); |
587 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); | 610 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); |
588 // Maximized window fills the work area, not the whole display. | 611 // Maximized window fills the work area, not the whole display. |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 window->SetBounds(keyboard_bounds()); | 1272 window->SetBounds(keyboard_bounds()); |
1250 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); | 1273 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); |
1251 window->Activate(); | 1274 window->Activate(); |
1252 | 1275 |
1253 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); | 1276 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); |
1254 ShowKeyboard(); | 1277 ShowKeyboard(); |
1255 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); | 1278 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); |
1256 } | 1279 } |
1257 | 1280 |
1258 } // namespace ash | 1281 } // namespace ash |
OLD | NEW |