| 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 10 matching lines...) Expand all Loading... |
| 21 #include "ash/wm/coordinate_conversion.h" | 21 #include "ash/wm/coordinate_conversion.h" |
| 22 #include "ash/wm/dock/docked_window_layout_manager.h" | 22 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 23 #include "ash/wm/drag_window_resizer.h" | 23 #include "ash/wm/drag_window_resizer.h" |
| 24 #include "ash/wm/panels/panel_layout_manager.h" | 24 #include "ash/wm/panels/panel_layout_manager.h" |
| 25 #include "ash/wm/window_state.h" | 25 #include "ash/wm/window_state.h" |
| 26 #include "ash/wm/window_util.h" | 26 #include "ash/wm/window_util.h" |
| 27 #include "ash/wm/wm_event.h" | 27 #include "ash/wm/wm_event.h" |
| 28 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 29 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
| 30 #include "ui/aura/client/window_tree_client.h" | 30 #include "ui/aura/client/window_tree_client.h" |
| 31 #include "ui/aura/test/event_generator.h" |
| 31 #include "ui/aura/test/test_window_delegate.h" | 32 #include "ui/aura/test/test_window_delegate.h" |
| 32 #include "ui/aura/window_event_dispatcher.h" | 33 #include "ui/aura/window_event_dispatcher.h" |
| 33 #include "ui/base/hit_test.h" | 34 #include "ui/base/hit_test.h" |
| 34 #include "ui/base/ui_base_types.h" | 35 #include "ui/base/ui_base_types.h" |
| 35 #include "ui/events/test/event_generator.h" | |
| 36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 37 #include "ui/wm/core/window_util.h" | 37 #include "ui/wm/core/window_util.h" |
| 38 | 38 |
| 39 namespace ash { | 39 namespace ash { |
| 40 | 40 |
| 41 class DockedWindowResizerTest | 41 class DockedWindowResizerTest |
| 42 : public test::AshTestBase, | 42 : public test::AshTestBase, |
| 43 public testing::WithParamInterface<ui::wm::WindowType> { | 43 public testing::WithParamInterface<ui::wm::WindowType> { |
| 44 public: | 44 public: |
| 45 DockedWindowResizerTest() : model_(NULL), window_type_(GetParam()) {} | 45 DockedWindowResizerTest() : model_(NULL), window_type_(GetParam()) {} |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 static_cast<DockedWindowLayoutManager*>( | 1581 static_cast<DockedWindowLayoutManager*>( |
| 1582 window->parent()->layout_manager()); | 1582 window->parent()->layout_manager()); |
| 1583 EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, docked_alignment(manager)); | 1583 EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, docked_alignment(manager)); |
| 1584 EXPECT_EQ(window->bounds().width(), docked_width(manager)); | 1584 EXPECT_EQ(window->bounds().width(), docked_width(manager)); |
| 1585 EXPECT_TRUE(window_state->IsDocked()); | 1585 EXPECT_TRUE(window_state->IsDocked()); |
| 1586 | 1586 |
| 1587 // Maximize the window while in a real drag. In particular, | 1587 // Maximize the window while in a real drag. In particular, |
| 1588 // ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowStateTypeChanged() | 1588 // ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowStateTypeChanged() |
| 1589 // must be called in order for the maximized window's size to be correct. | 1589 // must be called in order for the maximized window's size to be correct. |
| 1590 delegate()->set_window_component(HTCAPTION); | 1590 delegate()->set_window_component(HTCAPTION); |
| 1591 ui::test::EventGenerator& generator = GetEventGenerator(); | 1591 aura::test::EventGenerator& generator = GetEventGenerator(); |
| 1592 generator.MoveMouseTo(window->GetBoundsInScreen().origin()); | 1592 generator.MoveMouseTo(window->GetBoundsInScreen().origin()); |
| 1593 generator.PressLeftButton(); | 1593 generator.PressLeftButton(); |
| 1594 generator.MoveMouseBy(10, 10); | 1594 generator.MoveMouseBy(10, 10); |
| 1595 window_state->Maximize(); | 1595 window_state->Maximize(); |
| 1596 generator.ReleaseLeftButton(); | 1596 generator.ReleaseLeftButton(); |
| 1597 | 1597 |
| 1598 // |window| should get undocked. | 1598 // |window| should get undocked. |
| 1599 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 1599 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 1600 EXPECT_EQ(0, docked_width(manager)); | 1600 EXPECT_EQ(0, docked_width(manager)); |
| 1601 EXPECT_EQ( | 1601 EXPECT_EQ( |
| 1602 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), | 1602 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), |
| 1603 window->bounds().ToString()); | 1603 window->bounds().ToString()); |
| 1604 EXPECT_TRUE(window_state->IsMaximized()); | 1604 EXPECT_TRUE(window_state->IsMaximized()); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 // Tests run twice - on both panels and normal windows | 1607 // Tests run twice - on both panels and normal windows |
| 1608 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1608 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1609 DockedWindowResizerTest, | 1609 DockedWindowResizerTest, |
| 1610 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1610 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1611 ui::wm::WINDOW_TYPE_PANEL)); | 1611 ui::wm::WINDOW_TYPE_PANEL)); |
| 1612 | 1612 |
| 1613 } // namespace ash | 1613 } // namespace ash |
| OLD | NEW |