| 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/common/shelf/shelf_types.h" |
| 7 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm/wm_event.h" | 10 #include "ash/common/wm/wm_event.h" |
| 10 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
| 12 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
| 13 #include "ash/shelf/shelf_model.h" | 14 #include "ash/shelf/shelf_model.h" |
| 14 #include "ash/shelf/shelf_types.h" | |
| 15 #include "ash/shelf/shelf_util.h" | 15 #include "ash/shelf/shelf_util.h" |
| 16 #include "ash/shelf/shelf_widget.h" | 16 #include "ash/shelf/shelf_widget.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/test/ash_test_base.h" | 18 #include "ash/test/ash_test_base.h" |
| 19 #include "ash/test/cursor_manager_test_api.h" | 19 #include "ash/test/cursor_manager_test_api.h" |
| 20 #include "ash/test/shell_test_api.h" | 20 #include "ash/test/shell_test_api.h" |
| 21 #include "ash/test/test_shelf_delegate.h" | 21 #include "ash/test/test_shelf_delegate.h" |
| 22 #include "ash/wm/aura/wm_window_aura.h" | 22 #include "ash/wm/aura/wm_window_aura.h" |
| 23 #include "ash/wm/drag_window_resizer.h" | 23 #include "ash/wm/drag_window_resizer.h" |
| 24 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 234 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 235 DetachReattachTest(window.get(), 0, -1); | 235 DetachReattachTest(window.get(), 0, -1); |
| 236 } | 236 } |
| 237 | 237 |
| 238 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { | 238 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { |
| 239 if (!SupportsHostWindowResize()) | 239 if (!SupportsHostWindowResize()) |
| 240 return; | 240 return; |
| 241 | 241 |
| 242 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); | 242 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 243 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 243 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 244 DetachReattachTest(window.get(), 1, 0); | 244 DetachReattachTest(window.get(), 1, 0); |
| 245 } | 245 } |
| 246 | 246 |
| 247 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { | 247 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { |
| 248 if (!SupportsHostWindowResize()) | 248 if (!SupportsHostWindowResize()) |
| 249 return; | 249 return; |
| 250 | 250 |
| 251 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT); | 251 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
| 252 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 252 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 253 DetachReattachTest(window.get(), -1, 0); | 253 DetachReattachTest(window.get(), -1, 0); |
| 254 } | 254 } |
| 255 | 255 |
| 256 // Tests that a drag continues when the shelf is hidden. This occurs as part of | 256 // Tests that a drag continues when the shelf is hidden. This occurs as part of |
| 257 // the animation when switching profiles. http://crbug.com/393047. | 257 // the animation when switching profiles. http://crbug.com/393047. |
| 258 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { | 258 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { |
| 259 if (!SupportsHostWindowResize()) | 259 if (!SupportsHostWindowResize()) |
| 260 return; | 260 return; |
| 261 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 261 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (!SupportsHostWindowResize()) | 481 if (!SupportsHostWindowResize()) |
| 482 return; | 482 return; |
| 483 | 483 |
| 484 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); | 484 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); |
| 485 } | 485 } |
| 486 | 486 |
| 487 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { | 487 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { |
| 488 if (!SupportsHostWindowResize()) | 488 if (!SupportsHostWindowResize()) |
| 489 return; | 489 return; |
| 490 | 490 |
| 491 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); | 491 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 492 DragAlongShelfReorder(0, -1); | 492 DragAlongShelfReorder(0, -1); |
| 493 } | 493 } |
| 494 | 494 |
| 495 // Tests that panels can have transient children of different types. | 495 // Tests that panels can have transient children of different types. |
| 496 // The transient children should be reparented in sync with the panel. | 496 // The transient children should be reparented in sync with the panel. |
| 497 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { | 497 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { |
| 498 if (!SupportsHostWindowResize()) | 498 if (!SupportsHostWindowResize()) |
| 499 return; | 499 return; |
| 500 | 500 |
| 501 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 501 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 558 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
| 559 testing::Bool()); | 559 testing::Bool()); |
| 560 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 560 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 561 PanelWindowResizerTransientTest, | 561 PanelWindowResizerTransientTest, |
| 562 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 562 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 563 ui::wm::WINDOW_TYPE_PANEL, | 563 ui::wm::WINDOW_TYPE_PANEL, |
| 564 ui::wm::WINDOW_TYPE_POPUP)); | 564 ui::wm::WINDOW_TYPE_POPUP)); |
| 565 | 565 |
| 566 } // namespace ash | 566 } // namespace ash |
| OLD | NEW |