| 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/session/session_controller.h" | 9 #include "ash/common/session/session_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); | 146 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 147 | 147 |
| 148 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); | 148 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); |
| 149 maximized->Maximize(); | 149 maximized->Maximize(); |
| 150 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); | 150 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); |
| 151 EXPECT_EQ(gfx::Rect(600, 0, 300, 252).ToString(), | 151 EXPECT_EQ(gfx::Rect(600, 0, 300, 252).ToString(), |
| 152 maximized->GetWindowBoundsInScreen().ToString()); | 152 maximized->GetWindowBoundsInScreen().ToString()); |
| 153 EXPECT_EQ(gfx::Rect(0, 0, 300, 252).ToString(), | 153 EXPECT_EQ(gfx::Rect(0, 0, 300, 252).ToString(), |
| 154 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 154 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 155 | 155 |
| 156 views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); | 156 views::Widget* minimized = CreateTestWidget(gfx::Rect(550, 10, 200, 200)); |
| 157 minimized->Minimize(); | 157 minimized->Minimize(); |
| 158 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); | 158 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); |
| 159 EXPECT_EQ("800,10 100x100", minimized->GetWindowBoundsInScreen().ToString()); | 159 EXPECT_EQ("550,10 200x200", minimized->GetWindowBoundsInScreen().ToString()); |
| 160 | 160 |
| 161 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 100, 100)); | 161 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 200, 200)); |
| 162 display::Display secondary_display = |
| 163 Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); |
| 164 gfx::Rect orig_bounds = fullscreen->GetWindowBoundsInScreen(); |
| 165 EXPECT_TRUE(secondary_display.work_area().Intersects(orig_bounds)); |
| 166 EXPECT_FALSE(secondary_display.work_area().Contains(orig_bounds)); |
| 167 |
| 162 fullscreen->SetFullscreen(true); | 168 fullscreen->SetFullscreen(true); |
| 163 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); | 169 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); |
| 164 | 170 |
| 165 EXPECT_EQ("600,0 300x300", fullscreen->GetWindowBoundsInScreen().ToString()); | 171 EXPECT_EQ("600,0 300x300", fullscreen->GetWindowBoundsInScreen().ToString()); |
| 166 EXPECT_EQ("0,0 300x300", | 172 EXPECT_EQ("0,0 300x300", |
| 167 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 173 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 168 | 174 |
| 169 views::Widget* unparented_control = new Widget; | 175 views::Widget* unparented_control = new Widget; |
| 170 Widget::InitParams params; | 176 Widget::InitParams params; |
| 171 params.bounds = gfx::Rect(650, 10, 100, 100); | 177 params.bounds = gfx::Rect(650, 10, 100, 100); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Set fullscreen to true, but maximized window's size won't change because | 223 // Set fullscreen to true, but maximized window's size won't change because |
| 218 // it's not visible. see crbug.com/504299. | 224 // it's not visible. see crbug.com/504299. |
| 219 fullscreen->SetFullscreen(true); | 225 fullscreen->SetFullscreen(true); |
| 220 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); | 226 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); |
| 221 EXPECT_EQ(gfx::Rect(0, 0, 600, 552).ToString(), | 227 EXPECT_EQ(gfx::Rect(0, 0, 600, 552).ToString(), |
| 222 maximized->GetWindowBoundsInScreen().ToString()); | 228 maximized->GetWindowBoundsInScreen().ToString()); |
| 223 EXPECT_EQ(gfx::Rect(0, 0, 600, 552).ToString(), | 229 EXPECT_EQ(gfx::Rect(0, 0, 600, 552).ToString(), |
| 224 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 230 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 225 | 231 |
| 226 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); | 232 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); |
| 227 EXPECT_EQ("400,20 100x100", minimized->GetWindowBoundsInScreen().ToString()); | 233 EXPECT_EQ("0,20 200x200", minimized->GetWindowBoundsInScreen().ToString()); |
| 228 | 234 |
| 229 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); | 235 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); |
| 230 EXPECT_TRUE(fullscreen->IsFullscreen()); | 236 EXPECT_TRUE(fullscreen->IsFullscreen()); |
| 231 EXPECT_EQ("0,0 600x600", fullscreen->GetWindowBoundsInScreen().ToString()); | 237 EXPECT_EQ("0,0 600x600", fullscreen->GetWindowBoundsInScreen().ToString()); |
| 232 EXPECT_EQ("0,0 600x600", | 238 EXPECT_EQ("0,0 600x600", |
| 233 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 239 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 234 | 240 |
| 235 // Test if the restore bounds are correctly updated. | 241 // Test if the restore bounds are correctly updated. |
| 236 wm::GetWindowState(maximized->GetNativeView())->Restore(); | 242 wm::GetWindowState(maximized->GetNativeView())->Restore(); |
| 237 EXPECT_EQ("200,20 100x100", maximized->GetWindowBoundsInScreen().ToString()); | 243 EXPECT_EQ("200,20 100x100", maximized->GetWindowBoundsInScreen().ToString()); |
| 238 EXPECT_EQ("200,20 100x100", | 244 EXPECT_EQ("200,20 100x100", |
| 239 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 245 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 240 | 246 |
| 241 fullscreen->SetFullscreen(false); | 247 fullscreen->SetFullscreen(false); |
| 242 EXPECT_EQ("500,20 100x100", fullscreen->GetWindowBoundsInScreen().ToString()); | 248 EXPECT_EQ("400,20 200x200", fullscreen->GetWindowBoundsInScreen().ToString()); |
| 243 EXPECT_EQ("500,20 100x100", | 249 EXPECT_EQ("400,20 200x200", |
| 244 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 250 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 245 | 251 |
| 246 // Test if the unparented widget has moved. | 252 // Test if the unparented widget has moved. |
| 247 EXPECT_EQ(root_windows[0], | 253 EXPECT_EQ(root_windows[0], |
| 248 unparented_control->GetNativeView()->GetRootWindow()); | 254 unparented_control->GetNativeView()->GetRootWindow()); |
| 249 EXPECT_EQ(kShellWindowId_UnparentedControlContainer, | 255 EXPECT_EQ(kShellWindowId_UnparentedControlContainer, |
| 250 unparented_control->GetNativeView()->parent()->id()); | 256 unparented_control->GetNativeView()->parent()->id()); |
| 251 | 257 |
| 252 // Test if the panel has moved. | 258 // Test if the panel has moved. |
| 253 EXPECT_EQ(root_windows[0], panel->GetRootWindow()); | 259 EXPECT_EQ(root_windows[0], panel->GetRootWindow()); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1210 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
| 1205 gfx::Rect(0, 400, 800, 200)); | 1211 gfx::Rect(0, 400, 800, 200)); |
| 1206 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1212 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
| 1207 | 1213 |
| 1208 UpdateDisplay("600x800"); | 1214 UpdateDisplay("600x800"); |
| 1209 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1215 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
| 1210 } | 1216 } |
| 1211 | 1217 |
| 1212 } // namespace test | 1218 } // namespace test |
| 1213 } // namespace ash | 1219 } // namespace ash |
| OLD | NEW |