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

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

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

Powered by Google App Engine
This is Rietveld 408576698