Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: ash/wm/system_modal_container_layout_manager_unittest.cc

Issue 2098183002: Make system modal check more strict (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed cut Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 std::unique_ptr<aura::Window> window(OpenToplevelTestWindow(false));
681 std::unique_ptr<aura::Window> modal_window(
682 views::Widget::CreateWindowWithContext(new TestWindow(true),
683 CurrentContext())
684 ->GetNativeWindow());
685 SystemModalContainerLayoutManager* layout_manager =
686 Shell::GetPrimaryRootWindowController()->GetSystemModalLayoutManager(
687 modal_window.get());
688
689 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
690 EXPECT_FALSE(layout_manager->has_modal_background());
691
692 modal_window->Show();
693 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen());
694 EXPECT_TRUE(layout_manager->has_modal_background());
695
696 modal_window->Hide();
697 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
698 EXPECT_FALSE(layout_manager->has_modal_background());
699
700 modal_window->Show();
701 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen());
702 EXPECT_TRUE(layout_manager->has_modal_background());
703 }
704
679 namespace { 705 namespace {
680 706
681 class InputTestDelegate : public aura::test::TestWindowDelegate { 707 class InputTestDelegate : public aura::test::TestWindowDelegate {
682 public: 708 public:
683 InputTestDelegate() {} 709 InputTestDelegate() {}
684 ~InputTestDelegate() override {} 710 ~InputTestDelegate() override {}
685 711
686 void RunTest(test::AshTestBase* test_base) { 712 void RunTest(test::AshTestBase* test_base) {
687 std::unique_ptr<aura::Window> window( 713 std::unique_ptr<aura::Window> window(
688 test_base->CreateTestWindowInShellWithDelegate( 714 test_base->CreateTestWindowInShellWithDelegate(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 if (!SupportsMultipleDisplays()) 796 if (!SupportsMultipleDisplays())
771 return; 797 return;
772 798
773 UpdateDisplay("500x500, 500x500"); 799 UpdateDisplay("500x500, 500x500");
774 InputTestDelegate delegate; 800 InputTestDelegate delegate;
775 delegate.RunTest(this); 801 delegate.RunTest(this);
776 } 802 }
777 803
778 } // namespace test 804 } // namespace test
779 } // namespace ash 805 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698