| 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 RETURN_IF_WIN8; |
| 536 // http://crbug.com/165962 | |
| 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 | 536 |
| 549 TEST_F(PanelLayoutManagerTest, MAYBE_PanelMoveBetweenMultipleDisplays) { | |
| 550 // Keep the displays wide so that launchers have enough | 537 // Keep the displays wide so that launchers have enough |
| 551 // space for launcher buttons. | 538 // space for launcher buttons. |
| 552 UpdateDisplay("600x400,600x400"); | 539 UpdateDisplay("600x400,600x400"); |
| 553 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 540 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 554 | 541 |
| 555 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 542 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))); | 543 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))); | 544 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))); | 545 scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
| 559 | 546 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // that display. | 593 // that display. |
| 607 ClickLauncherItemForWindow(launcher_view_1st, p1_d2.get()); | 594 ClickLauncherItemForWindow(launcher_view_1st, p1_d2.get()); |
| 608 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow()); | 595 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow()); |
| 609 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); | 596 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); |
| 610 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow()); | 597 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow()); |
| 611 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow()); | 598 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow()); |
| 612 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( | 599 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( |
| 613 p1_d2->GetBoundsInScreen())); | 600 p1_d2->GetBoundsInScreen())); |
| 614 } | 601 } |
| 615 | 602 |
| 616 TEST_F(PanelLayoutManagerTest, MAYBE_PanelAttachPositionMultipleDisplays) { | 603 TEST_F(PanelLayoutManagerTest, PanelAttachPositionMultipleDisplays) { |
| 604 RETURN_IF_WIN8; |
| 605 |
| 617 // Keep the displays wide so that launchers have enough space for launcher | 606 // 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 | 607 // buttons. Use differently sized displays so the launcher is in a different |
| 619 // position on second display. | 608 // position on second display. |
| 620 UpdateDisplay("600x400,600x600"); | 609 UpdateDisplay("600x400,600x600"); |
| 621 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 610 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 622 | 611 |
| 623 scoped_ptr<aura::Window> p1_d1(CreatePanelWindow(gfx::Rect(0, 0, 50, 50))); | 612 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))); | 613 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
| 625 | 614 |
| 626 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); | 615 EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); |
| 627 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 616 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
| 628 | 617 |
| 629 IsPanelAboveLauncherIcon(p1_d1.get()); | 618 IsPanelAboveLauncherIcon(p1_d1.get()); |
| 630 IsCalloutAboveLauncherIcon(p1_d1.get()); | 619 IsCalloutAboveLauncherIcon(p1_d1.get()); |
| 631 IsPanelAboveLauncherIcon(p1_d2.get()); | 620 IsPanelAboveLauncherIcon(p1_d2.get()); |
| 632 IsCalloutAboveLauncherIcon(p1_d2.get()); | 621 IsCalloutAboveLauncherIcon(p1_d2.get()); |
| 633 } | 622 } |
| 634 | 623 |
| 635 TEST_F(PanelLayoutManagerTest, MAYBE_PanelAlignmentSecondDisplay) { | 624 TEST_F(PanelLayoutManagerTest, PanelAlignmentSecondDisplay) { |
| 625 RETURN_IF_WIN8; |
| 626 |
| 636 UpdateDisplay("600x400,600x400"); | 627 UpdateDisplay("600x400,600x400"); |
| 637 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 628 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 638 | 629 |
| 639 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); | 630 scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); |
| 640 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); | 631 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); |
| 641 | 632 |
| 642 IsPanelAboveLauncherIcon(p1_d2.get()); | 633 IsPanelAboveLauncherIcon(p1_d2.get()); |
| 643 IsCalloutAboveLauncherIcon(p1_d2.get()); | 634 IsCalloutAboveLauncherIcon(p1_d2.get()); |
| 644 | 635 |
| 645 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT); | 636 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()); | 701 EXPECT_TRUE(w1->IsVisible()); |
| 711 EXPECT_FALSE(w2->IsVisible()); | 702 EXPECT_FALSE(w2->IsVisible()); |
| 712 EXPECT_TRUE(w3->IsVisible()); | 703 EXPECT_TRUE(w3->IsVisible()); |
| 713 } | 704 } |
| 714 | 705 |
| 715 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 706 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
| 716 testing::Bool()); | 707 testing::Bool()); |
| 717 | 708 |
| 718 } // namespace internal | 709 } // namespace internal |
| 719 } // namespace ash | 710 } // namespace ash |
| OLD | NEW |