| OLD | NEW |
| 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 "ash/common/accessibility_delegate.h" | 5 #include "ash/common/accessibility_delegate.h" |
| 6 #include "ash/common/wm/window_state.h" | 6 #include "ash/common/wm/window_state.h" |
| 7 #include "ash/common/wm/wm_event.h" | 7 #include "ash/common/wm/wm_event.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); | 846 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); |
| 847 | 847 |
| 848 // Leave fullscreen mode. | 848 // Leave fullscreen mode. |
| 849 window->GetWindowState()->OnWMEvent(&event); | 849 window->GetWindowState()->OnWMEvent(&event); |
| 850 | 850 |
| 851 // Check that shell surface is maximized. | 851 // Check that shell surface is maximized. |
| 852 EXPECT_EQ(CurrentContext()->bounds().width(), | 852 EXPECT_EQ(CurrentContext()->bounds().width(), |
| 853 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); | 853 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
| 854 } | 854 } |
| 855 | 855 |
| 856 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) { | 856 TEST_F(ShellSurfaceTest, MaximizedAndImmersiveFullscreenBackground) { |
| 857 const gfx::Size display_size = | 857 const gfx::Size display_size = |
| 858 display::Screen::GetScreen()->GetPrimaryDisplay().size(); | 858 display::Screen::GetScreen()->GetPrimaryDisplay().size(); |
| 859 const gfx::Size buffer_size(display_size); | 859 const gfx::Size buffer_size(display_size); |
| 860 std::unique_ptr<Buffer> buffer( | 860 std::unique_ptr<Buffer> buffer( |
| 861 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 861 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 862 std::unique_ptr<Surface> surface(new Surface); | 862 std::unique_ptr<Surface> surface(new Surface); |
| 863 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( | 863 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( |
| 864 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), | 864 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 865 true, false, ash::kShellWindowId_DefaultContainer)); | 865 true, false, ash::kShellWindowId_DefaultContainer)); |
| 866 | 866 |
| 867 surface->Attach(buffer.get()); | 867 surface->Attach(buffer.get()); |
| 868 | 868 |
| 869 gfx::Rect shadow_bounds(10, 10, 100, 100); | 869 gfx::Rect shadow_bounds(10, 10, 100, 100); |
| 870 shell_surface->SetGeometry(shadow_bounds); | 870 shell_surface->SetGeometry(shadow_bounds); |
| 871 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); | 871 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); |
| 872 surface->Commit(); | 872 surface->Commit(); |
| 873 EXPECT_EQ(shadow_bounds, | 873 EXPECT_EQ(shadow_bounds, |
| 874 shell_surface->GetWidget()->GetWindowBoundsInScreen()); | 874 shell_surface->GetWidget()->GetWindowBoundsInScreen()); |
| 875 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); | 875 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); |
| 876 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), | 876 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), |
| 877 shell_surface->surface_for_testing()->window()->bounds().size()); | 877 shell_surface->surface_for_testing()->window()->bounds().size()); |
| 878 | 878 |
| 879 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); | 879 ash::wm::WMEvent fullscreen_event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); |
| 880 ash::WmWindow* window = | 880 ash::WmWindow* window = |
| 881 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); | 881 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); |
| 882 | 882 |
| 883 // Enter immersive fullscreen mode. Shadow underlay is fullscreen. | 883 // Enter immersive fullscreen mode. Shadow underlay is fullscreen. |
| 884 window->GetWindowState()->OnWMEvent(&event); | 884 window->GetWindowState()->OnWMEvent(&fullscreen_event); |
| 885 | 885 |
| 886 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | 886 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
| 887 EXPECT_EQ(1.f, shell_surface->shadow_underlay()->layer()->opacity()); | 887 EXPECT_EQ(1.f, shell_surface->shadow_underlay()->layer()->opacity()); |
| 888 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), | 888 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), |
| 889 shell_surface->shadow_underlay()->bounds().size()); | 889 shell_surface->shadow_underlay()->bounds().size()); |
| 890 | 890 |
| 891 // Leave fullscreen mode. Shadow underlay is restored. | 891 // Leave fullscreen mode. Shadow underlay is restored. |
| 892 window->GetWindowState()->OnWMEvent(&event); | 892 window->GetWindowState()->OnWMEvent(&fullscreen_event); |
| 893 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | 893 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
| 894 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); | 894 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); |
| 895 |
| 896 ash::wm::WMEvent maximize_event(ash::wm::WM_EVENT_TOGGLE_MAXIMIZE); |
| 897 |
| 898 // Enter maximized mode. Shadow underlay is fullscreen. |
| 899 window->GetWindowState()->OnWMEvent(&maximize_event); |
| 900 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
| 901 EXPECT_EQ(1.f, shell_surface->shadow_underlay()->layer()->opacity()); |
| 902 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(), |
| 903 shell_surface->shadow_underlay()->bounds().size()); |
| 904 |
| 905 // Leave maximized mode. Shadow underlay is fullscreen. |
| 906 window->GetWindowState()->OnWMEvent(&maximize_event); |
| 907 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
| 908 EXPECT_EQ(1.f, shell_surface->shadow_underlay()->layer()->opacity()); |
| 909 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); |
| 895 } | 910 } |
| 896 | 911 |
| 897 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) { | 912 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) { |
| 898 const gfx::Size display_size = | 913 const gfx::Size display_size = |
| 899 display::Screen::GetScreen()->GetPrimaryDisplay().size(); | 914 display::Screen::GetScreen()->GetPrimaryDisplay().size(); |
| 900 const gfx::Size buffer_size(display_size); | 915 const gfx::Size buffer_size(display_size); |
| 901 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); | 916 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); |
| 902 Surface surface; | 917 Surface surface; |
| 903 ShellSurface shell_surface(&surface, nullptr, | 918 ShellSurface shell_surface(&surface, nullptr, |
| 904 ShellSurface::BoundsMode::CLIENT, gfx::Point(), | 919 ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 shell_surface.OnAccessibilityModeChanged(); | 986 shell_surface.OnAccessibilityModeChanged(); |
| 972 shell_surface2.OnAccessibilityModeChanged(); | 987 shell_surface2.OnAccessibilityModeChanged(); |
| 973 | 988 |
| 974 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); | 989 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); |
| 975 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 990 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
| 976 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); | 991 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); |
| 977 } | 992 } |
| 978 | 993 |
| 979 } // namespace | 994 } // namespace |
| 980 } // namespace exo | 995 } // namespace exo |
| OLD | NEW |