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/wm/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
9 #include "ash/launcher/launcher_button.h" | 9 #include "ash/launcher/launcher_button.h" |
10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); | 329 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); |
330 } | 330 } |
331 | 331 |
332 TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIconSecondDisplay) { | 332 TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIconSecondDisplay) { |
333 if (!SupportsMultipleDisplays()) | 333 if (!SupportsMultipleDisplays()) |
334 return; | 334 return; |
335 | 335 |
336 // Keep the displays wide so that launchers have enough | 336 // Keep the displays wide so that launchers have enough |
337 // space for launcher buttons. | 337 // space for launcher buttons. |
338 UpdateDisplay("400x400,600x400"); | 338 UpdateDisplay("400x400,600x400"); |
339 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 339 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
340 | 340 |
341 scoped_ptr<aura::Window> normal_window( | 341 scoped_ptr<aura::Window> normal_window( |
342 CreateNormalWindow(gfx::Rect(450, 0, 100, 100))); | 342 CreateNormalWindow(gfx::Rect(450, 0, 100, 100))); |
343 scoped_ptr<aura::Window> panel(CreatePanelWindow(gfx::Rect(400, 0, 50, 50))); | 343 scoped_ptr<aura::Window> panel(CreatePanelWindow(gfx::Rect(400, 0, 50, 50))); |
344 EXPECT_EQ(root_windows[1], panel->GetRootWindow()); | 344 EXPECT_EQ(root_windows[1], panel->GetRootWindow()); |
345 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(panel.get())); | 345 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(panel.get())); |
346 gfx::Rect shelf_visible_position = panel->GetBoundsInScreen(); | 346 gfx::Rect shelf_visible_position = panel->GetBoundsInScreen(); |
347 | 347 |
348 SetShelfAutoHideBehavior(root_windows[1], | 348 SetShelfAutoHideBehavior(root_windows[1], |
349 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 349 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); | 596 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); |
597 } | 597 } |
598 | 598 |
599 TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) { | 599 TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) { |
600 if (!SupportsMultipleDisplays()) | 600 if (!SupportsMultipleDisplays()) |
601 return; | 601 return; |
602 | 602 |
603 // Keep the displays wide so that launchers have enough | 603 // Keep the displays wide so that launchers have enough |
604 // space for launcher buttons. | 604 // space for launcher buttons. |
605 UpdateDisplay("600x400,600x400"); | 605 UpdateDisplay("600x400,600x400"); |
606 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 606 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
607 | 607 |
608 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 608 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
609 scoped_ptr<aura::Window> p2_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 609 scoped_ptr<aura::Window> p2_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
610 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 610 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
611 scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 611 scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
612 | 612 |
613 ShelfView* shelf_view_1st = GetShelfView(Launcher::ForPrimaryDisplay()); | 613 ShelfView* shelf_view_1st = GetShelfView(Launcher::ForPrimaryDisplay()); |
614 ShelfView* shelf_view_2nd = | 614 ShelfView* shelf_view_2nd = |
615 GetShelfView(Launcher::ForWindow(root_windows[1])); | 615 GetShelfView(Launcher::ForWindow(root_windows[1])); |
616 | 616 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 676 } |
677 | 677 |
678 TEST_F(PanelLayoutManagerTest, PanelAttachPositionMultipleDisplays) { | 678 TEST_F(PanelLayoutManagerTest, PanelAttachPositionMultipleDisplays) { |
679 if (!SupportsMultipleDisplays()) | 679 if (!SupportsMultipleDisplays()) |
680 return; | 680 return; |
681 | 681 |
682 // Keep the displays wide so that launchers have enough space for launcher | 682 // Keep the displays wide so that launchers have enough space for launcher |
683 // buttons. Use differently sized displays so the launcher is in a different | 683 // buttons. Use differently sized displays so the launcher is in a different |
684 // position on second display. | 684 // position on second display. |
685 UpdateDisplay("600x400,600x600"); | 685 UpdateDisplay("600x400,600x600"); |
686 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 686 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
687 | 687 |
688 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 688 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
689 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 689 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
690 | 690 |
691 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); | 691 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); |
692 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 692 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
693 | 693 |
694 IsPanelAboveLauncherIcon(p1_d1.get()); | 694 IsPanelAboveLauncherIcon(p1_d1.get()); |
695 IsCalloutAboveLauncherIcon(p1_d1.get()); | 695 IsCalloutAboveLauncherIcon(p1_d1.get()); |
696 IsPanelAboveLauncherIcon(p1_d2.get()); | 696 IsPanelAboveLauncherIcon(p1_d2.get()); |
697 IsCalloutAboveLauncherIcon(p1_d2.get()); | 697 IsCalloutAboveLauncherIcon(p1_d2.get()); |
698 } | 698 } |
699 | 699 |
700 TEST_F(PanelLayoutManagerTest, PanelAlignmentSecondDisplay) { | 700 TEST_F(PanelLayoutManagerTest, PanelAlignmentSecondDisplay) { |
701 if (!SupportsMultipleDisplays()) | 701 if (!SupportsMultipleDisplays()) |
702 return; | 702 return; |
703 | 703 |
704 UpdateDisplay("600x400,600x400"); | 704 UpdateDisplay("600x400,600x400"); |
705 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 705 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
706 | 706 |
707 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 707 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
708 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 708 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
709 | 709 |
710 IsPanelAboveLauncherIcon(p1_d2.get()); | 710 IsPanelAboveLauncherIcon(p1_d2.get()); |
711 IsCalloutAboveLauncherIcon(p1_d2.get()); | 711 IsCalloutAboveLauncherIcon(p1_d2.get()); |
712 | 712 |
713 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT); | 713 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT); |
714 IsPanelAboveLauncherIcon(p1_d2.get()); | 714 IsPanelAboveLauncherIcon(p1_d2.get()); |
715 IsCalloutAboveLauncherIcon(p1_d2.get()); | 715 IsCalloutAboveLauncherIcon(p1_d2.get()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 EXPECT_TRUE(w1->IsVisible()); | 778 EXPECT_TRUE(w1->IsVisible()); |
779 EXPECT_FALSE(w2->IsVisible()); | 779 EXPECT_FALSE(w2->IsVisible()); |
780 EXPECT_TRUE(w3->IsVisible()); | 780 EXPECT_TRUE(w3->IsVisible()); |
781 } | 781 } |
782 | 782 |
783 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 783 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
784 testing::Bool()); | 784 testing::Bool()); |
785 | 785 |
786 } // namespace internal | 786 } // namespace internal |
787 } // namespace ash | 787 } // namespace ash |
OLD | NEW |