| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 TEST_P(DockedWindowResizerTest, AttachTwoWindows) { | 545 TEST_P(DockedWindowResizerTest, AttachTwoWindows) { |
| 546 if (!SupportsHostWindowResize()) | 546 if (!SupportsHostWindowResize()) |
| 547 return; | 547 return; |
| 548 | 548 |
| 549 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); | 549 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))); | 550 scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); |
| 551 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); | 551 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); |
| 552 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 50); | 552 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 50); |
| 553 | 553 |
| 554 // Both windows should be docked at the right edge. | 554 // Both windows should be docked at the right edge. |
| 555 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), | 555 wm::WindowState* window_state = wm::GetWindowState(w1.get()); |
| 556 w1->GetBoundsInScreen().right()); | 556 EXPECT_TRUE(window_state->IsMinimized()); |
| 557 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); | 557 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); |
| 558 | 558 |
| 559 EXPECT_EQ(w2->GetRootWindow()->GetBoundsInScreen().right(), | 559 EXPECT_EQ(w2->GetRootWindow()->GetBoundsInScreen().right(), |
| 560 w2->GetBoundsInScreen().right()); | 560 w2->GetBoundsInScreen().right()); |
| 561 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id()); | 561 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id()); |
| 562 | 562 |
| 563 // Detach by dragging left (should get undocked). | 563 // Detach by dragging left (should get undocked). |
| 564 const int left_edge = w2->bounds().x(); | 564 const int left_edge = w2->bounds().x(); |
| 565 ASSERT_NO_FATAL_FAILURE(DragStart(w2.get())); | 565 ASSERT_NO_FATAL_FAILURE(DragStart(w2.get())); |
| 566 // Drag up as well to avoid attaching panels to launcher shelf. | 566 // Drag up as well to avoid attaching panels to launcher shelf. |
| 567 DragMove(-32, -100); | 567 DragMove(-32, -100); |
| 568 // Release the mouse and the window should be no longer attached to the edge. | 568 // Release the mouse and the window should be no longer attached to the edge. |
| 569 DragEnd(); | 569 DragEnd(); |
| 570 | 570 |
| 571 // The first window should be still docked. | 571 // The first window should be still docked. |
| 572 EXPECT_EQ(w1->GetRootWindow()->GetBoundsInScreen().right(), | 572 EXPECT_TRUE(window_state->IsMinimized()); |
| 573 w1->GetBoundsInScreen().right()); | |
| 574 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); | 573 EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id()); |
| 575 | 574 |
| 576 // The window should be floating on the desktop again and moved to the left. | 575 // The window should be floating on the desktop again and moved to the left. |
| 577 EXPECT_EQ(left_edge - 32, w2->GetBoundsInScreen().x()); | 576 EXPECT_EQ(left_edge - 32, w2->GetBoundsInScreen().x()); |
| 578 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, | 577 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, |
| 579 w2->parent()->id()); | 578 w2->parent()->id()); |
| 580 } | 579 } |
| 581 | 580 |
| 582 // Create two windows, dock one and change shelf to auto-hide. | 581 // Create two windows, dock one and change shelf to auto-hide. |
| 583 TEST_P(DockedWindowResizerTest, AttachOneAutoHideShelf) { | 582 TEST_P(DockedWindowResizerTest, AttachOneAutoHideShelf) { |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 EXPECT_TRUE(window_state->IsMaximized()); | 1610 EXPECT_TRUE(window_state->IsMaximized()); |
| 1612 } | 1611 } |
| 1613 | 1612 |
| 1614 // Tests run twice - on both panels and normal windows | 1613 // Tests run twice - on both panels and normal windows |
| 1615 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1614 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1616 DockedWindowResizerTest, | 1615 DockedWindowResizerTest, |
| 1617 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1616 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1618 ui::wm::WINDOW_TYPE_PANEL)); | 1617 ui::wm::WINDOW_TYPE_PANEL)); |
| 1619 } // namespace internal | 1618 } // namespace internal |
| 1620 } // namespace ash | 1619 } // namespace ash |
| OLD | NEW |