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

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

Issue 2336653002: Ports SystemModalContainerLayoutManager to ash/common (Closed)
Patch Set: merge again Created 4 years, 3 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/common/wm/system_modal_container_layout_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/wm/container_finder.h"
13 #include "ash/common/wm_root_window_controller.h"
11 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
12 #include "ash/root_window_controller.h" 15 #include "ash/root_window_controller.h"
13 #include "ash/shell.h" 16 #include "ash/shell.h"
14 #include "ash/test/ash_test_base.h" 17 #include "ash/test/ash_test_base.h"
15 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
16 #include "base/command_line.h" 19 #include "base/command_line.h"
17 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
18 #include "base/run_loop.h" 21 #include "base/run_loop.h"
19 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/test/test_window_delegate.h" 23 #include "ui/aura/test/test_window_delegate.h"
(...skipping 17 matching lines...) Expand all
38 namespace test { 41 namespace test {
39 42
40 namespace { 43 namespace {
41 44
42 aura::Window* GetModalContainer() { 45 aura::Window* GetModalContainer() {
43 return Shell::GetPrimaryRootWindowController()->GetContainer( 46 return Shell::GetPrimaryRootWindowController()->GetContainer(
44 ash::kShellWindowId_SystemModalContainer); 47 ash::kShellWindowId_SystemModalContainer);
45 } 48 }
46 49
47 bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) { 50 bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) {
48 std::vector<aura::Window*> containers = 51 WmWindow::Windows containers =
49 Shell::GetContainersFromAllRootWindows(container_id, NULL); 52 wm::GetContainersFromAllRootWindows(container_id);
50 bool has_modal_screen = !containers.empty(); 53 bool has_modal_screen = !containers.empty();
51 for (std::vector<aura::Window*>::iterator iter = containers.begin(); 54 for (WmWindow* container : containers) {
52 iter != containers.end(); ++iter) {
53 has_modal_screen &= static_cast<SystemModalContainerLayoutManager*>( 55 has_modal_screen &= static_cast<SystemModalContainerLayoutManager*>(
54 (*iter)->layout_manager()) 56 container->GetLayoutManager())
55 ->has_window_dimmer(); 57 ->has_window_dimmer();
56 } 58 }
57 return has_modal_screen; 59 return has_modal_screen;
58 } 60 }
59 61
60 bool AllRootWindowsHaveLockedModalBackgrounds() { 62 bool AllRootWindowsHaveLockedModalBackgrounds() {
61 return AllRootWindowsHaveModalBackgroundsForContainer( 63 return AllRootWindowsHaveModalBackgroundsForContainer(
62 kShellWindowId_LockSystemModalContainer); 64 kShellWindowId_LockSystemModalContainer);
63 } 65 }
64 66
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); 766 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
765 } 767 }
766 768
767 TEST_F(SystemModalContainerLayoutManagerTest, VisibilityChange) { 769 TEST_F(SystemModalContainerLayoutManagerTest, VisibilityChange) {
768 std::unique_ptr<aura::Window> window(OpenToplevelTestWindow(false)); 770 std::unique_ptr<aura::Window> window(OpenToplevelTestWindow(false));
769 std::unique_ptr<aura::Window> modal_window( 771 std::unique_ptr<aura::Window> modal_window(
770 views::Widget::CreateWindowWithContext(new TestWindow(true), 772 views::Widget::CreateWindowWithContext(new TestWindow(true),
771 CurrentContext()) 773 CurrentContext())
772 ->GetNativeWindow()); 774 ->GetNativeWindow());
773 SystemModalContainerLayoutManager* layout_manager = 775 SystemModalContainerLayoutManager* layout_manager =
774 Shell::GetPrimaryRootWindowController()->GetSystemModalLayoutManager( 776 WmShell::Get()
775 modal_window.get()); 777 ->GetPrimaryRootWindowController()
778 ->GetSystemModalLayoutManager(WmWindowAura::Get(modal_window.get()));
776 779
777 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); 780 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
778 EXPECT_FALSE(layout_manager->has_window_dimmer()); 781 EXPECT_FALSE(layout_manager->has_window_dimmer());
779 782
780 modal_window->Show(); 783 modal_window->Show();
781 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); 784 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen());
782 EXPECT_TRUE(layout_manager->has_window_dimmer()); 785 EXPECT_TRUE(layout_manager->has_window_dimmer());
783 786
784 modal_window->Hide(); 787 modal_window->Hide();
785 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen()); 788 EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 if (!SupportsMultipleDisplays()) 887 if (!SupportsMultipleDisplays())
885 return; 888 return;
886 889
887 UpdateDisplay("500x500, 500x500"); 890 UpdateDisplay("500x500, 500x500");
888 InputTestDelegate delegate; 891 InputTestDelegate delegate;
889 delegate.RunTest(this); 892 delegate.RunTest(this);
890 } 893 }
891 894
892 } // namespace test 895 } // namespace test
893 } // namespace ash 896 } // 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