| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 gfx::Point location = resizer.GetInitialLocation(); | 56 gfx::Point location = resizer.GetInitialLocation(); |
| 57 location.set_x(location.x() + delta_x); | 57 location.set_x(location.x() + delta_x); |
| 58 location.set_y(location.y() + delta_y); | 58 location.set_y(location.y() + delta_y); |
| 59 return location; | 59 return location; |
| 60 } | 60 } |
| 61 | 61 |
| 62 aura::Window* CreatePanelWindow(const gfx::Point& origin) { | 62 aura::Window* CreatePanelWindow(const gfx::Point& origin) { |
| 63 gfx::Rect bounds(origin, gfx::Size(101, 101)); | 63 gfx::Rect bounds(origin, gfx::Size(101, 101)); |
| 64 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 64 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 65 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); | 65 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
| 66 shelf_delegate_->AddLauncherItem(window); | 66 shelf_delegate_->AddShelfItem(window); |
| 67 PanelLayoutManager* manager = | 67 PanelLayoutManager* manager = |
| 68 static_cast<PanelLayoutManager*>( | 68 static_cast<PanelLayoutManager*>( |
| 69 Shell::GetContainer(window->GetRootWindow(), | 69 Shell::GetContainer(window->GetRootWindow(), |
| 70 internal::kShellWindowId_PanelContainer)-> | 70 internal::kShellWindowId_PanelContainer)-> |
| 71 layout_manager()); | 71 layout_manager()); |
| 72 manager->Relayout(); | 72 manager->Relayout(); |
| 73 return window; | 73 return window; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void DragStart(aura::Window* window) { | 76 void DragStart(aura::Window* window) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); | 137 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); |
| 138 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); | 138 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { | 141 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { |
| 142 int panel_index = model_->FirstPanelIndex(); | 142 int panel_index = model_->FirstPanelIndex(); |
| 143 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); | 143 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); |
| 144 for (std::vector<aura::Window*>::const_iterator iter = | 144 for (std::vector<aura::Window*>::const_iterator iter = |
| 145 window_order.begin(); iter != window_order.end(); | 145 window_order.begin(); iter != window_order.end(); |
| 146 ++iter, ++panel_index) { | 146 ++iter, ++panel_index) { |
| 147 LauncherID id = GetLauncherIDForWindow(*iter); | 147 ShelfID id = GetShelfIDForWindow(*iter); |
| 148 EXPECT_EQ(id, model_->items()[panel_index].id); | 148 EXPECT_EQ(id, model_->items()[panel_index].id); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Test dragging panel window along the shelf and verify that panel icons | 152 // Test dragging panel window along the shelf and verify that panel icons |
| 153 // are reordered appropriately. | 153 // are reordered appropriately. |
| 154 void DragAlongShelfReorder(int dx, int dy) { | 154 void DragAlongShelfReorder(int dx, int dy) { |
| 155 gfx::Point origin(0, 0); | 155 gfx::Point origin(0, 0); |
| 156 scoped_ptr<aura::Window> w1(CreatePanelWindow(origin)); | 156 scoped_ptr<aura::Window> w1(CreatePanelWindow(origin)); |
| 157 scoped_ptr<aura::Window> w2(CreatePanelWindow(origin)); | 157 scoped_ptr<aura::Window> w2(CreatePanelWindow(origin)); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 527 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
| 528 testing::Bool()); | 528 testing::Bool()); |
| 529 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 529 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 530 PanelWindowResizerTransientTest, | 530 PanelWindowResizerTransientTest, |
| 531 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 531 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 532 ui::wm::WINDOW_TYPE_PANEL, | 532 ui::wm::WINDOW_TYPE_PANEL, |
| 533 ui::wm::WINDOW_TYPE_POPUP)); | 533 ui::wm::WINDOW_TYPE_POPUP)); |
| 534 | 534 |
| 535 } // namespace internal | 535 } // namespace internal |
| 536 } // namespace ash | 536 } // namespace ash |
| OLD | NEW |