OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/wm/panels/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 scoped_ptr<aura::Window> window( | 279 scoped_ptr<aura::Window> window( |
280 CreatePanelWindow(gfx::Point(0, 0))); | 280 CreatePanelWindow(gfx::Point(0, 0))); |
281 DetachReattachTest(window.get(), 0, 1); | 281 DetachReattachTest(window.get(), 0, 1); |
282 } | 282 } |
283 | 283 |
284 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { | 284 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { |
285 if (!SupportsMultipleDisplays()) | 285 if (!SupportsMultipleDisplays()) |
286 return; | 286 return; |
287 | 287 |
288 UpdateDisplay("600x400,600x400"); | 288 UpdateDisplay("600x400,600x400"); |
289 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 289 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
290 scoped_ptr<aura::Window> window( | 290 scoped_ptr<aura::Window> window( |
291 CreatePanelWindow(gfx::Point(600, 0))); | 291 CreatePanelWindow(gfx::Point(600, 0))); |
292 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 292 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
293 DetachReattachTest(window.get(), 0, -1); | 293 DetachReattachTest(window.get(), 0, -1); |
294 } | 294 } |
295 | 295 |
296 TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) { | 296 TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) { |
297 if (!SupportsMultipleDisplays()) | 297 if (!SupportsMultipleDisplays()) |
298 return; | 298 return; |
299 | 299 |
300 UpdateDisplay("600x400,600x400"); | 300 UpdateDisplay("600x400,600x400"); |
301 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 301 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
302 scoped_ptr<aura::Window> window( | 302 scoped_ptr<aura::Window> window( |
303 CreatePanelWindow(gfx::Point(0, 0))); | 303 CreatePanelWindow(gfx::Point(0, 0))); |
304 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 304 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
305 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 305 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
306 DragStart(window.get()); | 306 DragStart(window.get()); |
307 DragMove(0, -100); | 307 DragMove(0, -100); |
308 DragEnd(); | 308 DragEnd(); |
309 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 309 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
310 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); | 310 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); |
311 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 311 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
312 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 312 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); |
313 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); | 313 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); |
314 | 314 |
315 DragStart(window.get()); | 315 DragStart(window.get()); |
316 DragMove(500, 0); | 316 DragMove(500, 0); |
317 DragEnd(); | 317 DragEnd(); |
318 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 318 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
319 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 319 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
320 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 320 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
321 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 321 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); |
322 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); | 322 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); |
323 } | 323 } |
324 | 324 |
325 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) { | 325 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) { |
326 if (!SupportsMultipleDisplays()) | 326 if (!SupportsMultipleDisplays()) |
327 return; | 327 return; |
328 | 328 |
329 UpdateDisplay("600x400,600x400"); | 329 UpdateDisplay("600x400,600x400"); |
330 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 330 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
331 scoped_ptr<aura::Window> window( | 331 scoped_ptr<aura::Window> window( |
332 CreatePanelWindow(gfx::Point(0, 0))); | 332 CreatePanelWindow(gfx::Point(0, 0))); |
333 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 333 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
334 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 334 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
335 DragStart(window.get()); | 335 DragStart(window.get()); |
336 DragMove(500, -100); | 336 DragMove(500, -100); |
337 DragEnd(); | 337 DragEnd(); |
338 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 338 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
339 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 339 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
340 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 340 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
341 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 341 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); |
342 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); | 342 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); |
343 } | 343 } |
344 | 344 |
345 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) { | 345 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) { |
346 if (!SupportsMultipleDisplays()) | 346 if (!SupportsMultipleDisplays()) |
347 return; | 347 return; |
348 | 348 |
349 UpdateDisplay("600x400,600x600"); | 349 UpdateDisplay("600x400,600x600"); |
350 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 350 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
351 scoped_ptr<aura::Window> window( | 351 scoped_ptr<aura::Window> window( |
352 CreatePanelWindow(gfx::Point(0, 0))); | 352 CreatePanelWindow(gfx::Point(0, 0))); |
353 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 353 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
354 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 354 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
355 | 355 |
356 // Detach the window. | 356 // Detach the window. |
357 DragStart(window.get()); | 357 DragStart(window.get()); |
358 DragMove(0, -100); | 358 DragMove(0, -100); |
359 DragEnd(); | 359 DragEnd(); |
360 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 360 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
(...skipping 12 matching lines...) Expand all Loading... |
373 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 373 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
374 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 374 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); |
375 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 375 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
376 } | 376 } |
377 | 377 |
378 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) { | 378 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) { |
379 if (!SupportsMultipleDisplays()) | 379 if (!SupportsMultipleDisplays()) |
380 return; | 380 return; |
381 | 381 |
382 UpdateDisplay("600x400,600x600"); | 382 UpdateDisplay("600x400,600x600"); |
383 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 383 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
384 scoped_ptr<aura::Window> window( | 384 scoped_ptr<aura::Window> window( |
385 CreatePanelWindow(gfx::Point(0, 0))); | 385 CreatePanelWindow(gfx::Point(0, 0))); |
386 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 386 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
387 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 387 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
388 | 388 |
389 // Drag the window just above the other display's launcher. | 389 // Drag the window just above the other display's launcher. |
390 DragStart(window.get()); | 390 DragStart(window.get()); |
391 DragMove(500, 195); | 391 DragMove(500, 195); |
392 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 392 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
393 | 393 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 527 |
528 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 528 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
529 testing::Bool()); | 529 testing::Bool()); |
530 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, PanelWindowResizerTransientTest, | 530 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, PanelWindowResizerTransientTest, |
531 testing::Values(aura::client::WINDOW_TYPE_NORMAL, | 531 testing::Values(aura::client::WINDOW_TYPE_NORMAL, |
532 aura::client::WINDOW_TYPE_PANEL, | 532 aura::client::WINDOW_TYPE_PANEL, |
533 aura::client::WINDOW_TYPE_POPUP)); | 533 aura::client::WINDOW_TYPE_POPUP)); |
534 | 534 |
535 } // namespace internal | 535 } // namespace internal |
536 } // namespace ash | 536 } // namespace ash |
OLD | NEW |