| 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/common/panels/panel_window_resizer.h" | 5 #include "ash/wm/common/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 221 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 ash::Shell* shell = ash::Shell::GetInstance(); | 242 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); |
| 243 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT, | 243 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 244 shell->GetPrimaryRootWindow()); | 244 DetachReattachTest(window.get(), 1, 0); |
| 245 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | |
| 246 DetachReattachTest(window.get(), 1, 0); | |
| 247 } | 245 } |
| 248 | 246 |
| 249 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { | 247 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { |
| 250 if (!SupportsHostWindowResize()) | 248 if (!SupportsHostWindowResize()) |
| 251 return; | 249 return; |
| 252 | 250 |
| 253 ash::Shell* shell = ash::Shell::GetInstance(); | 251 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT); |
| 254 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_RIGHT, | |
| 255 shell->GetPrimaryRootWindow()); | |
| 256 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 252 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 257 DetachReattachTest(window.get(), -1, 0); | 253 DetachReattachTest(window.get(), -1, 0); |
| 258 } | 254 } |
| 259 | 255 |
| 260 // 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 |
| 261 // the animation when switching profiles. http://crbug.com/393047. | 257 // the animation when switching profiles. http://crbug.com/393047. |
| 262 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { | 258 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { |
| 263 if (!SupportsHostWindowResize()) | 259 if (!SupportsHostWindowResize()) |
| 264 return; | 260 return; |
| 265 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 261 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 if (!SupportsHostWindowResize()) | 484 if (!SupportsHostWindowResize()) |
| 489 return; | 485 return; |
| 490 | 486 |
| 491 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); | 487 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); |
| 492 } | 488 } |
| 493 | 489 |
| 494 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { | 490 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { |
| 495 if (!SupportsHostWindowResize()) | 491 if (!SupportsHostWindowResize()) |
| 496 return; | 492 return; |
| 497 | 493 |
| 498 ash::Shell* shell = ash::Shell::GetInstance(); | 494 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); |
| 499 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT, | |
| 500 shell->GetPrimaryRootWindow()); | |
| 501 DragAlongShelfReorder(0, -1); | 495 DragAlongShelfReorder(0, -1); |
| 502 } | 496 } |
| 503 | 497 |
| 504 // Tests that panels can have transient children of different types. | 498 // Tests that panels can have transient children of different types. |
| 505 // The transient children should be reparented in sync with the panel. | 499 // The transient children should be reparented in sync with the panel. |
| 506 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { | 500 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { |
| 507 if (!SupportsHostWindowResize()) | 501 if (!SupportsHostWindowResize()) |
| 508 return; | 502 return; |
| 509 | 503 |
| 510 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 504 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 560 |
| 567 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 561 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
| 568 testing::Bool()); | 562 testing::Bool()); |
| 569 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 563 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 570 PanelWindowResizerTransientTest, | 564 PanelWindowResizerTransientTest, |
| 571 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 565 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 572 ui::wm::WINDOW_TYPE_PANEL, | 566 ui::wm::WINDOW_TYPE_PANEL, |
| 573 ui::wm::WINDOW_TYPE_POPUP)); | 567 ui::wm::WINDOW_TYPE_POPUP)); |
| 574 | 568 |
| 575 } // namespace ash | 569 } // namespace ash |
| OLD | NEW |