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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // Should stick to other launcher. | 393 // Should stick to other launcher. |
394 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); | 394 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); |
395 DragEnd(); | 395 DragEnd(); |
396 | 396 |
397 // When dropped should move to second display's panel container. | 397 // When dropped should move to second display's panel container. |
398 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 398 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
399 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 399 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); |
400 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 400 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
401 } | 401 } |
402 | 402 |
| 403 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) { |
| 404 if (!SupportsMultipleDisplays()) |
| 405 return; |
| 406 |
| 407 UpdateDisplay("600x400,600x600"); |
| 408 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 409 scoped_ptr<aura::Window> window( |
| 410 CreatePanelWindow(gfx::Point(0, 0))); |
| 411 scoped_ptr<aura::Window> fullscreen( |
| 412 CreateTestWindowInShellWithBounds(gfx::Rect(600, 0, 101, 101))); |
| 413 wm::GetWindowState(fullscreen.get())->Activate(); |
| 414 wm::GetWindowState(fullscreen.get())->ToggleFullscreen(); |
| 415 EXPECT_TRUE(wm::GetWindowState(fullscreen.get())->IsFullscreen()); |
| 416 |
| 417 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 418 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 419 |
| 420 // Activate and drag the window to the other display's launcher. |
| 421 wm::GetWindowState(window.get())->Activate(); |
| 422 DragStart(window.get()); |
| 423 DragMove(500, 250); |
| 424 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 425 EXPECT_GT(window->GetBoundsInScreen().y(), |
| 426 initial_bounds.y() + 200); |
| 427 DragEnd(); |
| 428 |
| 429 // When dropped should move to second display's panel container. |
| 430 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 431 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); |
| 432 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
| 433 EXPECT_TRUE(window->IsVisible()); |
| 434 EXPECT_TRUE(wm::GetWindowState(window.get())->IsActive()); |
| 435 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); |
| 436 } |
| 437 |
403 TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) { | 438 TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) { |
404 scoped_ptr<aura::Window> window( | 439 scoped_ptr<aura::Window> window( |
405 CreatePanelWindow(gfx::Point(0, 0))); | 440 CreatePanelWindow(gfx::Point(0, 0))); |
406 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 441 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); |
407 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 442 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
408 DragStart(window.get()); | 443 DragStart(window.get()); |
409 DragMove(0, -100); | 444 DragMove(0, -100); |
410 DragRevert(); | 445 DragRevert(); |
411 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 446 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); |
412 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 447 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 562 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
528 testing::Bool()); | 563 testing::Bool()); |
529 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 564 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
530 PanelWindowResizerTransientTest, | 565 PanelWindowResizerTransientTest, |
531 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 566 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
532 ui::wm::WINDOW_TYPE_PANEL, | 567 ui::wm::WINDOW_TYPE_PANEL, |
533 ui::wm::WINDOW_TYPE_POPUP)); | 568 ui::wm::WINDOW_TYPE_POPUP)); |
534 | 569 |
535 } // namespace internal | 570 } // namespace internal |
536 } // namespace ash | 571 } // namespace ash |
OLD | NEW |