| 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_controller.h" | 10 #include "ash/common/session/session_controller.h" |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 // Then delete window after window and see that everything is in order. | 1091 // Then delete window after window and see that everything is in order. |
| 1092 window1_owner.reset(); | 1092 window1_owner.reset(); |
| 1093 EXPECT_EQ("b,C,X", | 1093 EXPECT_EQ("b,C,X", |
| 1094 GetWindowOrderAsString(backdrop, window1, window2, window3)); | 1094 GetWindowOrderAsString(backdrop, window1, window2, window3)); |
| 1095 window3_owner.reset(); | 1095 window3_owner.reset(); |
| 1096 EXPECT_EQ("b,x", GetWindowOrderAsString(backdrop, window1, window2, window3)); | 1096 EXPECT_EQ("b,x", GetWindowOrderAsString(backdrop, window1, window2, window3)); |
| 1097 ShowTopWindowBackdrop(false); | 1097 ShowTopWindowBackdrop(false); |
| 1098 EXPECT_EQ("b", GetWindowOrderAsString(nullptr, window1, window2, window3)); | 1098 EXPECT_EQ("b", GetWindowOrderAsString(nullptr, window1, window2, window3)); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 // Tests that when hidding the shelf, that the backdrop resizes to fill the | 1101 // Tests that when hidding the shelf, that the backdrop stays fullscreen. |
| 1102 // entire workspace area. | 1102 TEST_F(WorkspaceLayoutManagerBackdropTest, |
| 1103 TEST_F(WorkspaceLayoutManagerBackdropTest, ShelfVisibilityChangesBounds) { | 1103 ShelfVisibilityDoesNotChangesBounds) { |
| 1104 WmShelf* shelf = GetPrimaryShelf(); | 1104 WmShelf* shelf = GetPrimaryShelf(); |
| 1105 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); | 1105 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); |
| 1106 ShowTopWindowBackdrop(true); | 1106 ShowTopWindowBackdrop(true); |
| 1107 RunAllPendingInMessageLoop(); | 1107 RunAllPendingInMessageLoop(); |
| 1108 const gfx::Size fullscreen_size = |
| 1109 display::Screen::GetScreen()->GetPrimaryDisplay().size(); |
| 1108 | 1110 |
| 1109 ASSERT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); | 1111 ASSERT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); |
| 1110 gfx::Rect initial_bounds = default_container()->GetChildren()[0]->GetBounds(); | 1112 EXPECT_EQ(fullscreen_size, |
| 1113 default_container()->GetChildren()[0]->GetBounds().size()); |
| 1111 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 1114 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
| 1112 shelf_layout_manager->UpdateVisibilityState(); | 1115 shelf_layout_manager->UpdateVisibilityState(); |
| 1113 | 1116 |
| 1114 // When the shelf is re-shown WorkspaceLayoutManager shrinks all children | 1117 // When the shelf is re-shown WorkspaceLayoutManager shrinks all children but |
| 1115 // including the backdrop. | 1118 // the backdrop. |
| 1116 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1119 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1117 shelf_layout_manager->UpdateVisibilityState(); | 1120 shelf_layout_manager->UpdateVisibilityState(); |
| 1118 gfx::Rect reduced_bounds = default_container()->GetChildren()[0]->GetBounds(); | 1121 EXPECT_EQ(fullscreen_size, |
| 1119 EXPECT_LT(reduced_bounds.height(), initial_bounds.height()); | 1122 default_container()->GetChildren()[0]->GetBounds().size()); |
| 1120 | 1123 |
| 1121 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 1124 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
| 1122 shelf_layout_manager->UpdateVisibilityState(); | 1125 shelf_layout_manager->UpdateVisibilityState(); |
| 1123 | 1126 EXPECT_EQ(fullscreen_size, |
| 1124 EXPECT_GT(default_container()->GetChildren()[0]->GetBounds().height(), | 1127 default_container()->GetChildren()[0]->GetBounds().size()); |
| 1125 reduced_bounds.height()); | |
| 1126 } | 1128 } |
| 1127 | 1129 |
| 1128 class WorkspaceLayoutManagerKeyboardTest : public AshTest { | 1130 class WorkspaceLayoutManagerKeyboardTest : public AshTest { |
| 1129 public: | 1131 public: |
| 1130 WorkspaceLayoutManagerKeyboardTest() : layout_manager_(nullptr) {} | 1132 WorkspaceLayoutManagerKeyboardTest() : layout_manager_(nullptr) {} |
| 1131 ~WorkspaceLayoutManagerKeyboardTest() override {} | 1133 ~WorkspaceLayoutManagerKeyboardTest() override {} |
| 1132 | 1134 |
| 1133 void SetUp() override { | 1135 void SetUp() override { |
| 1134 AshTest::SetUp(); | 1136 AshTest::SetUp(); |
| 1135 UpdateDisplay("800x600"); | 1137 UpdateDisplay("800x600"); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 window->SetBounds(keyboard_bounds()); | 1277 window->SetBounds(keyboard_bounds()); |
| 1276 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); | 1278 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); |
| 1277 window->Activate(); | 1279 window->Activate(); |
| 1278 | 1280 |
| 1279 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); | 1281 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); |
| 1280 ShowKeyboard(); | 1282 ShowKeyboard(); |
| 1281 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); | 1283 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); |
| 1282 } | 1284 } |
| 1283 | 1285 |
| 1284 } // namespace ash | 1286 } // namespace ash |
| OLD | NEW |