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/shell_window_ids.h" | 5 #include "ash/common/shell_window_ids.h" |
6 #include "ash/common/wm/window_state.h" | 6 #include "ash/common/wm/window_state.h" |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 124 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
125 EXPECT_NE(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 125 EXPECT_NE(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
126 | 126 |
127 const gfx::Rect bounds2 = gfx::Rect(100, 100, 200, 200); | 127 const gfx::Rect bounds2 = gfx::Rect(100, 100, 200, 200); |
128 window->SetBounds(bounds2); | 128 window->SetBounds(bounds2); |
129 EXPECT_EQ(bounds2.ToString(), window->GetBoundsInScreen().ToString()); | 129 EXPECT_EQ(bounds2.ToString(), window->GetBoundsInScreen().ToString()); |
130 } | 130 } |
131 | 131 |
132 TEST_F(LockLayoutManagerTest, MaximizedFullscreenWindowBoundsAreEqualToScreen) { | 132 TEST_F(LockLayoutManagerTest, MaximizedFullscreenWindowBoundsAreEqualToScreen) { |
133 if (!SupportsHostWindowResize()) | |
134 return; | |
135 | |
136 gfx::Rect screen_bounds = | 133 gfx::Rect screen_bounds = |
137 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 134 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
138 | 135 |
139 views::Widget::InitParams widget_params( | 136 views::Widget::InitParams widget_params( |
140 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 137 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
141 widget_params.show_state = ui::SHOW_STATE_MAXIMIZED; | 138 widget_params.show_state = ui::SHOW_STATE_MAXIMIZED; |
142 const gfx::Rect bounds = gfx::Rect(10, 10, 300, 300); | 139 const gfx::Rect bounds = gfx::Rect(10, 10, 300, 300); |
143 widget_params.bounds = bounds; | 140 widget_params.bounds = bounds; |
144 // Maximized TYPE_WINDOW_FRAMELESS windows needs a delegate defined otherwise | 141 // Maximized TYPE_WINDOW_FRAMELESS windows needs a delegate defined otherwise |
145 // it won't get initial SetBounds event. | 142 // it won't get initial SetBounds event. |
(...skipping 30 matching lines...) Expand all Loading... |
176 const gfx::Rect bounds2 = gfx::Rect(100, 100, 200, 200); | 173 const gfx::Rect bounds2 = gfx::Rect(100, 100, 200, 200); |
177 maximized_window->SetBounds(bounds2); | 174 maximized_window->SetBounds(bounds2); |
178 fullscreen_window->SetBounds(bounds2); | 175 fullscreen_window->SetBounds(bounds2); |
179 EXPECT_EQ(screen_bounds.ToString(), | 176 EXPECT_EQ(screen_bounds.ToString(), |
180 maximized_window->GetBoundsInScreen().ToString()); | 177 maximized_window->GetBoundsInScreen().ToString()); |
181 EXPECT_EQ(screen_bounds.ToString(), | 178 EXPECT_EQ(screen_bounds.ToString(), |
182 fullscreen_window->GetBoundsInScreen().ToString()); | 179 fullscreen_window->GetBoundsInScreen().ToString()); |
183 } | 180 } |
184 | 181 |
185 TEST_F(LockLayoutManagerTest, KeyboardBounds) { | 182 TEST_F(LockLayoutManagerTest, KeyboardBounds) { |
186 if (!SupportsHostWindowResize()) | |
187 return; | |
188 | |
189 display::Display primary_display = | 183 display::Display primary_display = |
190 display::Screen::GetScreen()->GetPrimaryDisplay(); | 184 display::Screen::GetScreen()->GetPrimaryDisplay(); |
191 gfx::Rect screen_bounds = primary_display.bounds(); | 185 gfx::Rect screen_bounds = primary_display.bounds(); |
192 | 186 |
193 views::Widget::InitParams widget_params( | 187 views::Widget::InitParams widget_params( |
194 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 188 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
195 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; | 189 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; |
196 std::unique_ptr<aura::Window> window( | 190 std::unique_ptr<aura::Window> window( |
197 CreateTestLoginWindow(widget_params, false /* use_delegate */)); | 191 CreateTestLoginWindow(widget_params, false /* use_delegate */)); |
198 | 192 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); | 290 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); |
297 window->SetBounds(work_area); | 291 window->SetBounds(work_area); |
298 // Usually work_area takes Shelf into account but that doesn't affect | 292 // Usually work_area takes Shelf into account but that doesn't affect |
299 // LockScreen container windows. | 293 // LockScreen container windows. |
300 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 294 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
301 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 295 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
302 } | 296 } |
303 | 297 |
304 } // namespace test | 298 } // namespace test |
305 } // namespace ash | 299 } // namespace ash |
OLD | NEW |