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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // should be visible. | 524 // should be visible. |
525 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 525 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
526 RunAllPendingInMessageLoop(); | 526 RunAllPendingInMessageLoop(); |
527 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); | 527 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); |
528 // Activate the window, ensure callout is visible. | 528 // Activate the window, ensure callout is visible. |
529 wm::ActivateWindow(window.get()); | 529 wm::ActivateWindow(window.get()); |
530 RunAllPendingInMessageLoop(); | 530 RunAllPendingInMessageLoop(); |
531 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); | 531 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); |
532 } | 532 } |
533 | 533 |
534 #if defined(OS_WIN) | 534 TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) { |
535 // Multiple displays aren't supported on Windows Metro/Ash. | 535 if (!SupportsMultipleDisplays()) |
536 // http://crbug.com/165962 | 536 return; |
537 #define MAYBE_PanelMoveBetweenMultipleDisplays \ | |
538 DISABLED_PanelMoveBetweenMultipleDisplays | |
539 #define MAYBE_PanelAttachPositionMultipleDisplays \ | |
540 DISABLED_PanelAttachPositionMultipleDisplays | |
541 #define MAYBE_PanelAlignmentSecondDisplay DISABLED_PanelAlignmentSecondDisplay | |
542 #else | |
543 #define MAYBE_PanelMoveBetweenMultipleDisplays PanelMoveBetweenMultipleDisplays | |
544 #define MAYBE_PanelAttachPositionMultipleDisplays \ | |
545 PanelAttachPositionMultipleDisplays | |
546 #define MAYBE_PanelAlignmentSecondDisplay PanelAlignmentSecondDisplay | |
547 #endif | |
548 | 537 |
549 TEST_F(PanelLayoutManagerTest, MAYBE_PanelMoveBetweenMultipleDisplays) { | |
550 // Keep the displays wide so that launchers have enough | 538 // Keep the displays wide so that launchers have enough |
551 // space for launcher buttons. | 539 // space for launcher buttons. |
552 UpdateDisplay("600x400,600x400"); | 540 UpdateDisplay("600x400,600x400"); |
553 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 541 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
554 | 542 |
555 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 543 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
556 scoped_ptr<aura::Window> p2_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 544 scoped_ptr<aura::Window> p2_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
557 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 545 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
558 scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 546 scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
559 | 547 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // that display. | 594 // that display. |
607 ClickLauncherItemForWindow(launcher_view_1st, p1_d2.get()); | 595 ClickLauncherItemForWindow(launcher_view_1st, p1_d2.get()); |
608 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow()); | 596 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow()); |
609 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); | 597 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); |
610 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow()); | 598 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow()); |
611 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow()); | 599 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow()); |
612 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 600 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
613 p1_d2->GetBoundsInScreen())); | 601 p1_d2->GetBoundsInScreen())); |
614 } | 602 } |
615 | 603 |
616 TEST_F(PanelLayoutManagerTest, MAYBE_PanelAttachPositionMultipleDisplays) { | 604 TEST_F(PanelLayoutManagerTest, PanelAttachPositionMultipleDisplays) { |
| 605 if (!SupportsMultipleDisplays()) |
| 606 return; |
| 607 |
617 // Keep the displays wide so that launchers have enough space for launcher | 608 // Keep the displays wide so that launchers have enough space for launcher |
618 // buttons. Use differently sized displays so the launcher is in a different | 609 // buttons. Use differently sized displays so the launcher is in a different |
619 // position on second display. | 610 // position on second display. |
620 UpdateDisplay("600x400,600x600"); | 611 UpdateDisplay("600x400,600x600"); |
621 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 612 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
622 | 613 |
623 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 614 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); |
624 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 615 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
625 | 616 |
626 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); | 617 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); |
627 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 618 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
628 | 619 |
629 IsPanelAboveLauncherIcon(p1_d1.get()); | 620 IsPanelAboveLauncherIcon(p1_d1.get()); |
630 IsCalloutAboveLauncherIcon(p1_d1.get()); | 621 IsCalloutAboveLauncherIcon(p1_d1.get()); |
631 IsPanelAboveLauncherIcon(p1_d2.get()); | 622 IsPanelAboveLauncherIcon(p1_d2.get()); |
632 IsCalloutAboveLauncherIcon(p1_d2.get()); | 623 IsCalloutAboveLauncherIcon(p1_d2.get()); |
633 } | 624 } |
634 | 625 |
635 TEST_F(PanelLayoutManagerTest, MAYBE_PanelAlignmentSecondDisplay) { | 626 TEST_F(PanelLayoutManagerTest, PanelAlignmentSecondDisplay) { |
| 627 if (!SupportsMultipleDisplays()) |
| 628 return; |
| 629 |
636 UpdateDisplay("600x400,600x400"); | 630 UpdateDisplay("600x400,600x400"); |
637 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 631 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
638 | 632 |
639 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 633 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
640 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 634 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
641 | 635 |
642 IsPanelAboveLauncherIcon(p1_d2.get()); | 636 IsPanelAboveLauncherIcon(p1_d2.get()); |
643 IsCalloutAboveLauncherIcon(p1_d2.get()); | 637 IsCalloutAboveLauncherIcon(p1_d2.get()); |
644 | 638 |
645 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT); | 639 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 EXPECT_TRUE(w1->IsVisible()); | 704 EXPECT_TRUE(w1->IsVisible()); |
711 EXPECT_FALSE(w2->IsVisible()); | 705 EXPECT_FALSE(w2->IsVisible()); |
712 EXPECT_TRUE(w3->IsVisible()); | 706 EXPECT_TRUE(w3->IsVisible()); |
713 } | 707 } |
714 | 708 |
715 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 709 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
716 testing::Bool()); | 710 testing::Bool()); |
717 | 711 |
718 } // namespace internal | 712 } // namespace internal |
719 } // namespace ash | 713 } // namespace ash |
OLD | NEW |