| 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/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 int delta_y) const { | 54 int delta_y) const { |
| 55 gfx::Point location = resizer.GetInitialLocation(); | 55 gfx::Point location = resizer.GetInitialLocation(); |
| 56 location.set_x(location.x() + delta_x); | 56 location.set_x(location.x() + delta_x); |
| 57 location.set_y(location.y() + delta_y); | 57 location.set_y(location.y() + delta_y); |
| 58 return location; | 58 return location; |
| 59 } | 59 } |
| 60 | 60 |
| 61 aura::Window* CreatePanelWindow(const gfx::Point& origin) { | 61 aura::Window* CreatePanelWindow(const gfx::Point& origin) { |
| 62 gfx::Rect bounds(origin, gfx::Size(101, 101)); | 62 gfx::Rect bounds(origin, gfx::Size(101, 101)); |
| 63 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 63 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 64 NULL, | 64 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
| 65 aura::client::WINDOW_TYPE_PANEL, | |
| 66 0, | |
| 67 bounds); | |
| 68 shelf_delegate_->AddLauncherItem(window); | 65 shelf_delegate_->AddLauncherItem(window); |
| 69 PanelLayoutManager* manager = | 66 PanelLayoutManager* manager = |
| 70 static_cast<PanelLayoutManager*>( | 67 static_cast<PanelLayoutManager*>( |
| 71 Shell::GetContainer(window->GetRootWindow(), | 68 Shell::GetContainer(window->GetRootWindow(), |
| 72 internal::kShellWindowId_PanelContainer)-> | 69 internal::kShellWindowId_PanelContainer)-> |
| 73 layout_manager()); | 70 layout_manager()); |
| 74 manager->Relayout(); | 71 manager->Relayout(); |
| 75 return window; | 72 return window; |
| 76 } | 73 } |
| 77 | 74 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 bool is_rtl_; | 215 bool is_rtl_; |
| 219 std::string original_locale; | 216 std::string original_locale; |
| 220 | 217 |
| 221 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTextDirectionTest); | 218 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTextDirectionTest); |
| 222 }; | 219 }; |
| 223 | 220 |
| 224 // PanelLayoutManager and PanelWindowResizer should work if panels have | 221 // PanelLayoutManager and PanelWindowResizer should work if panels have |
| 225 // transient children of supported types. | 222 // transient children of supported types. |
| 226 class PanelWindowResizerTransientTest | 223 class PanelWindowResizerTransientTest |
| 227 : public PanelWindowResizerTest, | 224 : public PanelWindowResizerTest, |
| 228 public testing::WithParamInterface<aura::client::WindowType> { | 225 public testing::WithParamInterface<ui::wm::WindowType> { |
| 229 public: | 226 public: |
| 230 PanelWindowResizerTransientTest() : transient_window_type_(GetParam()) {} | 227 PanelWindowResizerTransientTest() : transient_window_type_(GetParam()) {} |
| 231 virtual ~PanelWindowResizerTransientTest() {} | 228 virtual ~PanelWindowResizerTransientTest() {} |
| 232 | 229 |
| 233 protected: | 230 protected: |
| 234 aura::client::WindowType transient_window_type_; | 231 ui::wm::WindowType transient_window_type_; |
| 235 | 232 |
| 236 private: | 233 private: |
| 237 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest); | 234 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest); |
| 238 }; | 235 }; |
| 239 | 236 |
| 240 // Verifies a window can be dragged from the panel and detached and then | 237 // Verifies a window can be dragged from the panel and detached and then |
| 241 // reattached. | 238 // reattached. |
| 242 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { | 239 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { |
| 243 if (!SupportsHostWindowResize()) | 240 if (!SupportsHostWindowResize()) |
| 244 return; | 241 return; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 EXPECT_EQ(internal::kShellWindowId_PanelContainer, child->parent()->id()); | 518 EXPECT_EQ(internal::kShellWindowId_PanelContainer, child->parent()->id()); |
| 522 DragEnd(); | 519 DragEnd(); |
| 523 | 520 |
| 524 // When dropped they should return to the default container. | 521 // When dropped they should return to the default container. |
| 525 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); | 522 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); |
| 526 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, child->parent()->id()); | 523 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, child->parent()->id()); |
| 527 } | 524 } |
| 528 | 525 |
| 529 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 526 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
| 530 testing::Bool()); | 527 testing::Bool()); |
| 531 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, PanelWindowResizerTransientTest, | 528 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 532 testing::Values(aura::client::WINDOW_TYPE_NORMAL, | 529 PanelWindowResizerTransientTest, |
| 533 aura::client::WINDOW_TYPE_PANEL, | 530 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 534 aura::client::WINDOW_TYPE_POPUP)); | 531 ui::wm::WINDOW_TYPE_PANEL, |
| 532 ui::wm::WINDOW_TYPE_POPUP)); |
| 535 | 533 |
| 536 } // namespace internal | 534 } // namespace internal |
| 537 } // namespace ash | 535 } // namespace ash |
| OLD | NEW |