| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_layout_manager.h" | 5 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/shelf_button.h" | 8 #include "ash/common/shelf/shelf_button.h" |
| 9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 } | 576 } |
| 577 | 577 |
| 578 TEST_F(PanelLayoutManagerTest, SplitView) { | 578 TEST_F(PanelLayoutManagerTest, SplitView) { |
| 579 gfx::Rect bounds(0, 0, 90, 201); | 579 gfx::Rect bounds(0, 0, 90, 201); |
| 580 std::unique_ptr<aura::Window> w1(CreatePanelWindow(bounds)); | 580 std::unique_ptr<aura::Window> w1(CreatePanelWindow(bounds)); |
| 581 std::unique_ptr<aura::Window> w2(CreatePanelWindow(bounds)); | 581 std::unique_ptr<aura::Window> w2(CreatePanelWindow(bounds)); |
| 582 | 582 |
| 583 EXPECT_NO_FATAL_FAILURE(PanelsNotOverlapping(w1.get(), w2.get())); | 583 EXPECT_NO_FATAL_FAILURE(PanelsNotOverlapping(w1.get(), w2.get())); |
| 584 } | 584 } |
| 585 | 585 |
| 586 #if defined(OS_WIN) | 586 TEST_F(PanelLayoutManagerTest, SplitViewOverlapWhenLarge) { |
| 587 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 | |
| 588 #define MAYBE_SplitViewOverlapWhenLarge DISABLED_SplitViewOverlapWhenLarge | |
| 589 #else | |
| 590 #define MAYBE_SplitViewOverlapWhenLarge SplitViewOverlapWhenLarge | |
| 591 #endif | |
| 592 | |
| 593 TEST_F(PanelLayoutManagerTest, MAYBE_SplitViewOverlapWhenLarge) { | |
| 594 gfx::Rect bounds(0, 0, 600, 201); | 587 gfx::Rect bounds(0, 0, 600, 201); |
| 595 std::unique_ptr<aura::Window> w1(CreatePanelWindow(bounds)); | 588 std::unique_ptr<aura::Window> w1(CreatePanelWindow(bounds)); |
| 596 std::unique_ptr<aura::Window> w2(CreatePanelWindow(bounds)); | 589 std::unique_ptr<aura::Window> w2(CreatePanelWindow(bounds)); |
| 597 | 590 |
| 598 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w1.get())); | 591 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w1.get())); |
| 599 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w2.get())); | 592 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w2.get())); |
| 600 } | 593 } |
| 601 | 594 |
| 602 TEST_F(PanelLayoutManagerTest, FanWindows) { | 595 TEST_F(PanelLayoutManagerTest, FanWindows) { |
| 603 gfx::Rect bounds(0, 0, 201, 201); | 596 gfx::Rect bounds(0, 0, 201, 201); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 841 |
| 849 SetShelfVisibilityState(Shell::GetPrimaryRootWindow(), SHELF_VISIBLE); | 842 SetShelfVisibilityState(Shell::GetPrimaryRootWindow(), SHELF_VISIBLE); |
| 850 RunAllPendingInMessageLoop(); | 843 RunAllPendingInMessageLoop(); |
| 851 | 844 |
| 852 // Windows should be restored to their prior state. | 845 // Windows should be restored to their prior state. |
| 853 EXPECT_TRUE(w1->IsVisible()); | 846 EXPECT_TRUE(w1->IsVisible()); |
| 854 EXPECT_FALSE(w2->IsVisible()); | 847 EXPECT_FALSE(w2->IsVisible()); |
| 855 EXPECT_TRUE(w3->IsVisible()); | 848 EXPECT_TRUE(w3->IsVisible()); |
| 856 } | 849 } |
| 857 | 850 |
| 858 #if !defined(OS_WIN) | |
| 859 // Verifies that touches along the attached edge of a panel do not | 851 // Verifies that touches along the attached edge of a panel do not |
| 860 // target the panel itself. | 852 // target the panel itself. |
| 861 TEST_F(PanelLayoutManagerTest, TouchHitTestPanel) { | 853 TEST_F(PanelLayoutManagerTest, TouchHitTestPanel) { |
| 862 aura::test::TestWindowDelegate delegate; | 854 aura::test::TestWindowDelegate delegate; |
| 863 std::unique_ptr<aura::Window> w( | 855 std::unique_ptr<aura::Window> w( |
| 864 CreatePanelWindowWithDelegate(&delegate, gfx::Rect(0, 0, 200, 200))); | 856 CreatePanelWindowWithDelegate(&delegate, gfx::Rect(0, 0, 200, 200))); |
| 865 ui::EventTarget* root = w->GetRootWindow(); | 857 ui::EventTarget* root = w->GetRootWindow(); |
| 866 ui::EventTargeter* targeter = root->GetEventTargeter(); | 858 ui::EventTargeter* targeter = root->GetEventTargeter(); |
| 867 | 859 |
| 868 // Note that the constants used in the touch locations below are | 860 // Note that the constants used in the touch locations below are |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 bounds = w->bounds(); | 895 bounds = w->bounds(); |
| 904 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); | 896 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); |
| 905 target = targeter->FindTargetForEvent(root, &touch); | 897 target = targeter->FindTargetForEvent(root, &touch); |
| 906 EXPECT_EQ(w.get(), target); | 898 EXPECT_EQ(w.get(), target); |
| 907 | 899 |
| 908 // Hit test outside the left edge with a left-aligned shelf. | 900 // Hit test outside the left edge with a left-aligned shelf. |
| 909 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); | 901 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); |
| 910 target = targeter->FindTargetForEvent(root, &touch); | 902 target = targeter->FindTargetForEvent(root, &touch); |
| 911 EXPECT_NE(w.get(), target); | 903 EXPECT_NE(w.get(), target); |
| 912 } | 904 } |
| 913 #endif // !defined(OS_WIN) | |
| 914 | 905 |
| 915 INSTANTIATE_TEST_CASE_P(LtrRtl, | 906 INSTANTIATE_TEST_CASE_P(LtrRtl, |
| 916 PanelLayoutManagerTextDirectionTest, | 907 PanelLayoutManagerTextDirectionTest, |
| 917 testing::Bool()); | 908 testing::Bool()); |
| 918 | 909 |
| 919 } // namespace ash | 910 } // namespace ash |
| OLD | NEW |