Chromium Code Reviews| 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/system_modal_container_layout_manager.h" | 5 #include "ash/wm/system_modal_container_layout_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_NONE); | 669 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_NONE); |
| 670 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); | 670 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 671 | 671 |
| 672 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); | 672 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); |
| 673 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 673 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 674 | 674 |
| 675 widget->Close(); | 675 widget->Close(); |
| 676 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); | 676 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 677 } | 677 } |
| 678 | 678 |
| 679 TEST_F(SystemModalContainerLayoutManagerTest, VisibilityChange) { | |
| 680 // Create a modal window. | |
| 681 std::unique_ptr<aura::Window> parent(OpenToplevelTestWindow(false)); | |
| 682 std::unique_ptr<aura::Window> modal_window( | |
| 683 OpenTestWindowWithParent(parent.get(), true)); | |
| 684 parent->Show(); | |
| 685 modal_window->Show(); | |
|
James Cook
2016/06/27 00:33:43
optional: Maybe test it prior to modal_window->Sho
oshima
2016/06/27 02:26:07
Done. (turns out the function was calling show, so
| |
| 686 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | |
| 687 EXPECT_TRUE(Shell::GetPrimaryRootWindowController() | |
|
James Cook
2016/06/27 00:33:43
optional nit: Cache pointer to SystemModalLayoutMa
oshima
2016/06/27 02:26:07
Done.
| |
| 688 ->GetSystemModalLayoutManager(modal_window.get()) | |
| 689 ->has_modal_background()); | |
| 690 | |
| 691 modal_window->Hide(); | |
| 692 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); | |
| 693 EXPECT_FALSE(Shell::GetPrimaryRootWindowController() | |
| 694 ->GetSystemModalLayoutManager(modal_window.get()) | |
| 695 ->has_modal_background()); | |
| 696 | |
| 697 modal_window->Show(); | |
| 698 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | |
| 699 EXPECT_TRUE(Shell::GetPrimaryRootWindowController() | |
| 700 ->GetSystemModalLayoutManager(modal_window.get()) | |
| 701 ->has_modal_background()); | |
| 702 } | |
| 703 | |
| 679 namespace { | 704 namespace { |
| 680 | 705 |
| 681 class InputTestDelegate : public aura::test::TestWindowDelegate { | 706 class InputTestDelegate : public aura::test::TestWindowDelegate { |
| 682 public: | 707 public: |
| 683 InputTestDelegate() {} | 708 InputTestDelegate() {} |
| 684 ~InputTestDelegate() override {} | 709 ~InputTestDelegate() override {} |
| 685 | 710 |
| 686 void RunTest(test::AshTestBase* test_base) { | 711 void RunTest(test::AshTestBase* test_base) { |
| 687 std::unique_ptr<aura::Window> window( | 712 std::unique_ptr<aura::Window> window( |
| 688 test_base->CreateTestWindowInShellWithDelegate( | 713 test_base->CreateTestWindowInShellWithDelegate( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 if (!SupportsMultipleDisplays()) | 795 if (!SupportsMultipleDisplays()) |
| 771 return; | 796 return; |
| 772 | 797 |
| 773 UpdateDisplay("500x500, 500x500"); | 798 UpdateDisplay("500x500, 500x500"); |
| 774 InputTestDelegate delegate; | 799 InputTestDelegate delegate; |
| 775 delegate.RunTest(this); | 800 delegate.RunTest(this); |
| 776 } | 801 } |
| 777 | 802 |
| 778 } // namespace test | 803 } // namespace test |
| 779 } // namespace ash | 804 } // namespace ash |
| OLD | NEW |