OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/window_positioner.h" | 5 #include "ash/common/wm/window_positioner.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/scoped_root_window_for_new_windows.h" | 10 #include "ash/common/scoped_root_window_for_new_windows.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 private: | 138 private: |
139 views::Widget* widget_; | 139 views::Widget* widget_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(OutOfDisplayDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(OutOfDisplayDelegate); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 | 145 |
146 TEST_P(WindowPositionerTest, EnsureMinimumVisibility) { | 146 TEST_P(WindowPositionerTest, EnsureMinimumVisibility) { |
147 if (!SupportsHostWindowResize()) | |
148 return; | |
149 | |
150 UpdateDisplay("400x400"); | 147 UpdateDisplay("400x400"); |
151 views::Widget* widget = new views::Widget(); | 148 views::Widget* widget = new views::Widget(); |
152 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 149 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
153 params.delegate = new OutOfDisplayDelegate(widget); | 150 params.delegate = new OutOfDisplayDelegate(widget); |
154 params.context = Shell::GetPrimaryRootWindow(); | 151 params.context = Shell::GetPrimaryRootWindow(); |
155 widget->Init(params); | 152 widget->Init(params); |
156 widget->SetBounds(gfx::Rect(450, 10, 100, 100)); | 153 widget->SetBounds(gfx::Rect(450, 10, 100, 100)); |
157 wm::GetWindowState(widget->GetNativeView())->set_minimum_visibility(true); | 154 wm::GetWindowState(widget->GetNativeView())->set_minimum_visibility(true); |
158 widget->Show(); | 155 widget->Show(); |
159 // Make sure the bounds is adjusted to be inside the work area. | 156 // Make sure the bounds is adjusted to be inside the work area. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); | 195 static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); |
199 delegate->SetForceMaximizeOnFirstRun(true); | 196 delegate->SetForceMaximizeOnFirstRun(true); |
200 | 197 |
201 WindowPositioner::GetBoundsAndShowStateForNewWindow( | 198 WindowPositioner::GetBoundsAndShowStateForNewWindow( |
202 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); | 199 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); |
203 | 200 |
204 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); | 201 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); |
205 } | 202 } |
206 | 203 |
207 TEST_P(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) { | 204 TEST_P(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) { |
208 if (!SupportsHostWindowResize()) | |
209 return; | |
210 // Set bigger than 1366 so that the new window is opened in normal state. | 205 // Set bigger than 1366 so that the new window is opened in normal state. |
211 UpdateDisplay("1400x800"); | 206 UpdateDisplay("1400x800"); |
212 | 207 |
213 // 1st window mimics fullscreen browser window behavior. | 208 // 1st window mimics fullscreen browser window behavior. |
214 shell::ToplevelWindow::CreateParams params; | 209 shell::ToplevelWindow::CreateParams params; |
215 params.can_resize = true; | 210 params.can_resize = true; |
216 params.can_maximize = true; | 211 params.can_maximize = true; |
217 views::Widget* widget1 = shell::ToplevelWindow::CreateToplevelWindow(params); | 212 views::Widget* widget1 = shell::ToplevelWindow::CreateToplevelWindow(params); |
218 wm::WindowState* managed_state = | 213 wm::WindowState* managed_state = |
219 wm::GetWindowState(widget1->GetNativeWindow()); | 214 wm::GetWindowState(widget1->GetNativeWindow()); |
(...skipping 13 matching lines...) Expand all Loading... |
233 widget1->SetFullscreen(false); | 228 widget1->SetFullscreen(false); |
234 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); | 229 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); |
235 | 230 |
236 // Closing 2nd widget triggers the rearrange logic but the 1st | 231 // Closing 2nd widget triggers the rearrange logic but the 1st |
237 // widget should stay in the current size. | 232 // widget should stay in the current size. |
238 widget2->CloseNow(); | 233 widget2->CloseNow(); |
239 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); | 234 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); |
240 } | 235 } |
241 | 236 |
242 } // namespace ash | 237 } // namespace ash |
OLD | NEW |