| 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.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/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 RunAllPendingInMessageLoop(); | 538 RunAllPendingInMessageLoop(); |
| 539 EXPECT_TRUE(window->IsVisible()); | 539 EXPECT_TRUE(window->IsVisible()); |
| 540 EXPECT_TRUE(window_state->IsMaximized()); | 540 EXPECT_TRUE(window_state->IsMaximized()); |
| 541 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); | 541 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); |
| 542 } | 542 } |
| 543 | 543 |
| 544 // Dock two windows, undock one, check that the other one is still docked. | 544 // Dock two windows, undock one, check that the other one is still docked. |
| 545 TEST_P(DockedWindowResizerTest, AttachTwoWindows) { | 545 TEST_P(DockedWindowResizerTest, AttachTwoWindows) { |
| 546 if (!SupportsHostWindowResize()) | 546 if (!SupportsHostWindowResize()) |
| 547 return; | 547 return; |
| 548 UpdateDisplay("600x600"); |
| 548 | 549 |
| 549 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); | 550 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); |
| 550 scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); | 551 scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); |
| 551 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); | 552 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); |
| 552 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 50); | 553 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 50); |
| 553 | 554 |
| 555 // Docking second window should not minimize the first. |
| 556 wm::WindowState* window_state1 = wm::GetWindowState(w1.get()); |
| 557 EXPECT_FALSE(window_state1->IsMinimized()); |
| 558 |
| 554 // Both windows should be docked at the right edge. | 559 // Both windows should be docked at the right edge. |
| 555 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), | 560 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), |
| 556 w1->GetBoundsInScreen().right()); | 561 w1->GetBoundsInScreen().right()); |
| 557 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); | 562 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); |
| 558 | 563 |
| 559 EXPECT_EQ(w2->GetRootWindow()->GetBoundsInScreen().right(), | 564 EXPECT_EQ(w2->GetRootWindow()->GetBoundsInScreen().right(), |
| 560 w2->GetBoundsInScreen().right()); | 565 w2->GetBoundsInScreen().right()); |
| 561 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id()); | 566 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id()); |
| 562 | 567 |
| 563 // Detach by dragging left (should get undocked). | 568 // Detach by dragging left (should get undocked). |
| 564 const int left_edge = w2->bounds().x(); | 569 const int left_edge = w2->bounds().x(); |
| 565 ASSERT_NO_FATAL_FAILURE(DragStart(w2.get())); | 570 ASSERT_NO_FATAL_FAILURE(DragStart(w2.get())); |
| 566 // Drag up as well to avoid attaching panels to launcher shelf. | 571 // Drag up as well to avoid attaching panels to launcher shelf. |
| 567 DragMove(-32, -100); | 572 DragMove(-32, -100); |
| 568 // Release the mouse and the window should be no longer attached to the edge. | 573 // Release the mouse and the window should be no longer attached to the edge. |
| 569 DragEnd(); | 574 DragEnd(); |
| 570 | 575 |
| 571 // The first window should be still docked. | 576 // The first window should be still docked. |
| 577 EXPECT_FALSE(window_state1->IsMinimized()); |
| 572 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), | 578 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), |
| 573 w1->GetBoundsInScreen().right()); | 579 w1->GetBoundsInScreen().right()); |
| 574 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); | 580 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); |
| 575 | 581 |
| 576 // The window should be floating on the desktop again and moved to the left. | 582 // The window should be floating on the desktop again and moved to the left. |
| 577 EXPECT_EQ(left_edge - 32, w2->GetBoundsInScreen().x()); | 583 EXPECT_EQ(left_edge - 32, w2->GetBoundsInScreen().x()); |
| 578 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, | 584 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, |
| 579 w2->parent()->id()); | 585 w2->parent()->id()); |
| 580 } | 586 } |
| 581 | 587 |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 EXPECT_TRUE(window_state->IsMaximized()); | 1617 EXPECT_TRUE(window_state->IsMaximized()); |
| 1612 } | 1618 } |
| 1613 | 1619 |
| 1614 // Tests run twice - on both panels and normal windows | 1620 // Tests run twice - on both panels and normal windows |
| 1615 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1621 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1616 DockedWindowResizerTest, | 1622 DockedWindowResizerTest, |
| 1617 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1623 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1618 ui::wm::WINDOW_TYPE_PANEL)); | 1624 ui::wm::WINDOW_TYPE_PANEL)); |
| 1619 } // namespace internal | 1625 } // namespace internal |
| 1620 } // namespace ash | 1626 } // namespace ash |
| OLD | NEW |