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

Side by Side Diff: components/exo/shell_surface_unittest.cc

Issue 2908333003: [mus+ash] Removes WmWindow from ash (app_list, frame, metrics, session, system, wallpaper) (Closed)
Patch Set: [mus ash] Removes WmWindow from ash (rebase, nits and cleanup of use of ResizeHandleWindowTargeter) Created 3 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/public/cpp/window_properties.h" 9 #include "ash/public/cpp/window_properties.h"
10 #include "ash/public/interfaces/window_pin_type.mojom.h" 10 #include "ash/public/interfaces/window_pin_type.mojom.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_port.h" 12 #include "ash/shell_port.h"
13 #include "ash/test/shell_test_api.h" 13 #include "ash/test/shell_test_api.h"
14 #include "ash/test/workspace_controller_test_api.h" 14 #include "ash/test/workspace_controller_test_api.h"
15 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
16 #include "ash/wm/wm_event.h" 16 #include "ash/wm/wm_event.h"
17 #include "ash/wm/workspace/workspace_window_resizer.h" 17 #include "ash/wm/workspace/workspace_window_resizer.h"
18 #include "ash/wm_window.h"
19 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
20 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
21 #include "components/exo/buffer.h" 20 #include "components/exo/buffer.h"
22 #include "components/exo/display.h" 21 #include "components/exo/display.h"
23 #include "components/exo/sub_surface.h" 22 #include "components/exo/sub_surface.h"
24 #include "components/exo/surface.h" 23 #include "components/exo/surface.h"
25 #include "components/exo/test/exo_test_base.h" 24 #include "components/exo/test/exo_test_base.h"
26 #include "components/exo/test/exo_test_helper.h" 25 #include "components/exo/test/exo_test_helper.h"
27 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
28 #include "ui/aura/client/aura_constants.h" 27 #include "ui/aura/client/aura_constants.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 surface->Commit(); 864 surface->Commit();
866 EXPECT_EQ( 865 EXPECT_EQ(
867 buffer_size.ToString(), 866 buffer_size.ToString(),
868 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); 867 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString());
869 868
870 shell_surface->Maximize(); 869 shell_surface->Maximize();
871 EXPECT_EQ(CurrentContext()->bounds().width(), 870 EXPECT_EQ(CurrentContext()->bounds().width(),
872 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); 871 shell_surface->GetWidget()->GetWindowBoundsInScreen().width());
873 872
874 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); 873 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN);
875 ash::WmWindow* window = 874 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
876 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow());
877 875
878 // Enter fullscreen mode. 876 // Enter fullscreen mode.
879 window->GetWindowState()->OnWMEvent(&event); 877 ash::wm::GetWindowState(window)->OnWMEvent(&event);
880 878
881 EXPECT_EQ(CurrentContext()->bounds().ToString(), 879 EXPECT_EQ(CurrentContext()->bounds().ToString(),
882 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); 880 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString());
883 881
884 // Leave fullscreen mode. 882 // Leave fullscreen mode.
885 window->GetWindowState()->OnWMEvent(&event); 883 ash::wm::GetWindowState(window)->OnWMEvent(&event);
886 884
887 // Check that shell surface is maximized. 885 // Check that shell surface is maximized.
888 EXPECT_EQ(CurrentContext()->bounds().width(), 886 EXPECT_EQ(CurrentContext()->bounds().width(),
889 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); 887 shell_surface->GetWidget()->GetWindowBoundsInScreen().width());
890 } 888 }
891 889
892 TEST_F(ShellSurfaceTest, MaximizedAndImmersiveFullscreenBackdrop) { 890 TEST_F(ShellSurfaceTest, MaximizedAndImmersiveFullscreenBackdrop) {
893 ash::WorkspaceController* wc = 891 ash::WorkspaceController* wc =
894 ash::test::ShellTestApi(ash::Shell::Get()).workspace_controller(); 892 ash::test::ShellTestApi(ash::Shell::Get()).workspace_controller();
895 ash::test::WorkspaceControllerTestApi test_helper(wc); 893 ash::test::WorkspaceControllerTestApi test_helper(wc);
(...skipping 16 matching lines...) Expand all
912 surface->Commit(); 910 surface->Commit();
913 EXPECT_EQ(shadow_bounds, 911 EXPECT_EQ(shadow_bounds,
914 shell_surface->GetWidget()->GetWindowBoundsInScreen()); 912 shell_surface->GetWidget()->GetWindowBoundsInScreen());
915 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); 913 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds());
916 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), 914 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(),
917 shell_surface->surface_for_testing()->window()->bounds().size()); 915 shell_surface->surface_for_testing()->window()->bounds().size());
918 916
919 EXPECT_FALSE(test_helper.GetBackdropWindow()); 917 EXPECT_FALSE(test_helper.GetBackdropWindow());
920 918
921 ash::wm::WMEvent fullscreen_event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); 919 ash::wm::WMEvent fullscreen_event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN);
922 ash::WmWindow* window = 920 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
923 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow());
924 921
925 // Enter immersive fullscreen mode. Shadow underlay is fullscreen. 922 // Enter immersive fullscreen mode. Shadow underlay is fullscreen.
926 window->GetWindowState()->OnWMEvent(&fullscreen_event); 923 ash::wm::GetWindowState(window)->OnWMEvent(&fullscreen_event);
927 924
928 EXPECT_TRUE(test_helper.GetBackdropWindow()); 925 EXPECT_TRUE(test_helper.GetBackdropWindow());
929 926
930 // Leave fullscreen mode. Shadow underlay is restored. 927 // Leave fullscreen mode. Shadow underlay is restored.
931 window->GetWindowState()->OnWMEvent(&fullscreen_event); 928 ash::wm::GetWindowState(window)->OnWMEvent(&fullscreen_event);
932 EXPECT_FALSE(test_helper.GetBackdropWindow()); 929 EXPECT_FALSE(test_helper.GetBackdropWindow());
933 930
934 ash::wm::WMEvent maximize_event(ash::wm::WM_EVENT_TOGGLE_MAXIMIZE); 931 ash::wm::WMEvent maximize_event(ash::wm::WM_EVENT_TOGGLE_MAXIMIZE);
935 932
936 // Enter maximized mode. 933 // Enter maximized mode.
937 window->GetWindowState()->OnWMEvent(&maximize_event); 934 ash::wm::GetWindowState(window)->OnWMEvent(&maximize_event);
938 EXPECT_TRUE(test_helper.GetBackdropWindow()); 935 EXPECT_TRUE(test_helper.GetBackdropWindow());
939 936
940 // Leave maximized mode. 937 // Leave maximized mode.
941 window->GetWindowState()->OnWMEvent(&maximize_event); 938 ash::wm::GetWindowState(window)->OnWMEvent(&maximize_event);
942 EXPECT_FALSE(test_helper.GetBackdropWindow()); 939 EXPECT_FALSE(test_helper.GetBackdropWindow());
943 } 940 }
944 941
945 // Make sure that a surface shell started in maximize creates deprecated 942 // Make sure that a surface shell started in maximize creates deprecated
946 // shadow correctly. 943 // shadow correctly.
947 TEST_F(ShellSurfaceTest, 944 TEST_F(ShellSurfaceTest,
948 StartMaximizedThenMinimizeWithSetRectangularShadow_DEPRECATED) { 945 StartMaximizedThenMinimizeWithSetRectangularShadow_DEPRECATED) {
949 const gfx::Size display_size = 946 const gfx::Size display_size =
950 display::Screen::GetScreen()->GetPrimaryDisplay().size(); 947 display::Screen::GetScreen()->GetPrimaryDisplay().size();
951 const gfx::Size buffer_size(display_size); 948 const gfx::Size buffer_size(display_size);
(...skipping 14 matching lines...) Expand all
966 shell_surface->SetGeometry(shadow_bounds); 963 shell_surface->SetGeometry(shadow_bounds);
967 shell_surface->SetRectangularShadow_DEPRECATED(shadow_bounds); 964 shell_surface->SetRectangularShadow_DEPRECATED(shadow_bounds);
968 surface->Commit(); 965 surface->Commit();
969 EXPECT_EQ(shadow_bounds, 966 EXPECT_EQ(shadow_bounds,
970 shell_surface->GetWidget()->GetWindowBoundsInScreen()); 967 shell_surface->GetWidget()->GetWindowBoundsInScreen());
971 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); 968 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds());
972 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), 969 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(),
973 shell_surface->surface_for_testing()->window()->bounds().size()); 970 shell_surface->surface_for_testing()->window()->bounds().size());
974 971
975 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE); 972 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE);
976 ash::WmWindow* window = 973 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
977 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); 974 ash::wm::GetWindowState(window)->OnWMEvent(&minimize_event);
978 window->GetWindowState()->OnWMEvent(&minimize_event);
979 } 975 }
980 976
981 } // namespace 977 } // namespace
982 } // namespace exo 978 } // namespace exo
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc ('k') | components/exo/touch_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698