| 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/common/wm/panels/panel_window_resizer.h" | 5 #include "ash/common/wm/panels/panel_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | |
| 8 #include "ash/common/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
| 9 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
| 11 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/test/test_shelf_delegate.h" | 11 #include "ash/common/test/test_shelf_delegate.h" |
| 13 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 14 #include "ash/common/wm/wm_event.h" | 13 #include "ash/common/wm/wm_event.h" |
| 15 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/common/wm_window_property.h" | 16 #include "ash/common/wm_window_property.h" |
| 17 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
| 18 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
| 19 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
| 20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/test/ash_test_base.h" | 21 #include "ash/test/ash_test_base.h" |
| 22 #include "ash/test/cursor_manager_test_api.h" | 22 #include "ash/test/cursor_manager_test_api.h" |
| 23 #include "ash/wm/drag_window_resizer.h" | 23 #include "ash/wm/drag_window_resizer.h" |
| 24 #include "ash/wm/window_properties.h" | 24 #include "ash/wm/window_properties.h" |
| 25 #include "ash/wm/window_state_aura.h" | 25 #include "ash/wm/window_state_aura.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 gfx::Point location = resizer.GetInitialLocation(); | 57 gfx::Point location = resizer.GetInitialLocation(); |
| 58 location.set_x(location.x() + delta_x); | 58 location.set_x(location.x() + delta_x); |
| 59 location.set_y(location.y() + delta_y); | 59 location.set_y(location.y() + delta_y); |
| 60 return location; | 60 return location; |
| 61 } | 61 } |
| 62 | 62 |
| 63 aura::Window* CreatePanelWindow(const gfx::Point& origin) { | 63 aura::Window* CreatePanelWindow(const gfx::Point& origin) { |
| 64 gfx::Rect bounds(origin, gfx::Size(101, 101)); | 64 gfx::Rect bounds(origin, gfx::Size(101, 101)); |
| 65 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 65 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 66 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); | 66 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
| 67 test::TestShelfDelegate::instance()->AddShelfItem( | 67 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window)); |
| 68 WmWindowAura::Get(window)); | |
| 69 return window; | 68 return window; |
| 70 } | 69 } |
| 71 | 70 |
| 72 void DragStart(aura::Window* window) { | 71 void DragStart(aura::Window* window) { |
| 73 resizer_.reset(CreateWindowResizer(WmWindowAura::Get(window), | 72 resizer_.reset(CreateWindowResizer(WmWindow::Get(window), |
| 74 window->bounds().origin(), HTCAPTION, | 73 window->bounds().origin(), HTCAPTION, |
| 75 aura::client::WINDOW_MOVE_SOURCE_MOUSE) | 74 aura::client::WINDOW_MOVE_SOURCE_MOUSE) |
| 76 .release()); | 75 .release()); |
| 77 ASSERT_TRUE(resizer_.get()); | 76 ASSERT_TRUE(resizer_.get()); |
| 78 } | 77 } |
| 79 | 78 |
| 80 void DragMove(int dx, int dy) { | 79 void DragMove(int dx, int dy) { |
| 81 resizer_->Drag(CalculateDragPoint(*resizer_, dx, dy), 0); | 80 resizer_->Drag(CalculateDragPoint(*resizer_, dx, dy), 0); |
| 82 } | 81 } |
| 83 | 82 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 130 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 132 } | 131 } |
| 133 | 132 |
| 134 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { | 133 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { |
| 135 int panel_index = model_->FirstPanelIndex(); | 134 int panel_index = model_->FirstPanelIndex(); |
| 136 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); | 135 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); |
| 137 for (std::vector<aura::Window *>::const_iterator | 136 for (std::vector<aura::Window *>::const_iterator |
| 138 iter = window_order.begin(); | 137 iter = window_order.begin(); |
| 139 iter != window_order.end(); ++iter, ++panel_index) { | 138 iter != window_order.end(); ++iter, ++panel_index) { |
| 140 ShelfID id = | 139 ShelfID id = |
| 141 WmWindowAura::Get(*iter)->GetIntProperty(WmWindowProperty::SHELF_ID); | 140 WmWindow::Get(*iter)->GetIntProperty(WmWindowProperty::SHELF_ID); |
| 142 EXPECT_EQ(id, model_->items()[panel_index].id); | 141 EXPECT_EQ(id, model_->items()[panel_index].id); |
| 143 } | 142 } |
| 144 } | 143 } |
| 145 | 144 |
| 146 // Test dragging panel window along the shelf and verify that panel icons | 145 // Test dragging panel window along the shelf and verify that panel icons |
| 147 // are reordered appropriately. | 146 // are reordered appropriately. |
| 148 void DragAlongShelfReorder(int dx, int dy) { | 147 void DragAlongShelfReorder(int dx, int dy) { |
| 149 gfx::Point origin(0, 0); | 148 gfx::Point origin(0, 0); |
| 150 std::unique_ptr<aura::Window> w1(CreatePanelWindow(origin)); | 149 std::unique_ptr<aura::Window> w1(CreatePanelWindow(origin)); |
| 151 std::unique_ptr<aura::Window> w2(CreatePanelWindow(origin)); | 150 std::unique_ptr<aura::Window> w2(CreatePanelWindow(origin)); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 INSTANTIATE_TEST_CASE_P(LtrRtl, | 538 INSTANTIATE_TEST_CASE_P(LtrRtl, |
| 540 PanelWindowResizerTextDirectionTest, | 539 PanelWindowResizerTextDirectionTest, |
| 541 testing::Bool()); | 540 testing::Bool()); |
| 542 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 541 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 543 PanelWindowResizerTransientTest, | 542 PanelWindowResizerTransientTest, |
| 544 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 543 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 545 ui::wm::WINDOW_TYPE_PANEL, | 544 ui::wm::WINDOW_TYPE_PANEL, |
| 546 ui::wm::WINDOW_TYPE_POPUP)); | 545 ui::wm::WINDOW_TYPE_POPUP)); |
| 547 | 546 |
| 548 } // namespace ash | 547 } // namespace ash |
| OLD | NEW |