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

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

Issue 2845053004: Do not hide shadow underlay for max/fullscreen state even if the client disables the shadow. (Closed)
Patch Set: Created 3 years, 7 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 "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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 822
823 // Sending a shadow bounds in maximized state won't create a shaodw. 823 // Sending a shadow bounds in maximized state won't create a shaodw.
824 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); 824 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100));
825 surface->Commit(); 825 surface->Commit();
826 826
827 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); 827 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window));
828 // Underlay should be created even without shadow. 828 // Underlay should be created even without shadow.
829 ASSERT_TRUE(shell_surface->shadow_underlay()); 829 ASSERT_TRUE(shell_surface->shadow_underlay());
830 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); 830 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible());
831 831
832 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(0, 0, 0, 0));
833 // Underlay should be created even without shadow.
834 ASSERT_TRUE(shell_surface->shadow_underlay());
835 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible());
836 shell_surface->SetRectangularShadowEnabled(false);
837 surface->Commit();
838 // Underlay should be created even without shadow.
839 ASSERT_TRUE(shell_surface->shadow_underlay());
840 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible());
841
842 shell_surface->SetRectangularShadowEnabled(true);
843 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100));
844 surface->Commit();
845
832 // Restore the window and make sure the shadow is created, visible and 846 // Restore the window and make sure the shadow is created, visible and
833 // has the latest bounds. 847 // has the latest bounds.
834 widget->Restore(); 848 widget->Restore();
835 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 849 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
836 ASSERT_TRUE(shadow); 850 ASSERT_TRUE(shadow);
837 EXPECT_TRUE(shadow->layer()->visible()); 851 EXPECT_TRUE(shadow->layer()->visible());
838 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), shadow->layer()->parent()->bounds()); 852 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), shadow->layer()->parent()->bounds());
839 } 853 }
840 854
841 TEST_F(ShellSurfaceTest, ToggleFullscreen) { 855 TEST_F(ShellSurfaceTest, ToggleFullscreen) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( 1018 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
1005 ash::A11Y_NOTIFICATION_NONE); 1019 ash::A11Y_NOTIFICATION_NONE);
1006 shell_surface.OnAccessibilityModeChanged(); 1020 shell_surface.OnAccessibilityModeChanged();
1007 shell_surface2.OnAccessibilityModeChanged(); 1021 shell_surface2.OnAccessibilityModeChanged();
1008 1022
1009 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); 1023 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible());
1010 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); 1024 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds());
1011 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); 1025 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds());
1012 } 1026 }
1013 1027
1028 // Make sure that a surface shell started in maximize creates deprecated
1029 // shadow correctly.
1030 TEST_F(ShellSurfaceTest,
1031 StartMaximizedThenMinimizeWithSetRectangularShadow_DEPRECATED) {
1032 const gfx::Size display_size =
1033 display::Screen::GetScreen()->GetPrimaryDisplay().size();
1034 const gfx::Size buffer_size(display_size);
1035 std::unique_ptr<Buffer> buffer(
1036 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
1037 std::unique_ptr<Surface> surface(new Surface);
1038 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
1039 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
1040 true, false, ash::kShellWindowId_DefaultContainer));
1041
1042 // Start in maximized.
1043 shell_surface->Maximize();
1044 surface->Attach(buffer.get());
1045 surface->Commit();
1046
1047 gfx::Rect shadow_bounds =
1048 display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
1049 shell_surface->SetGeometry(shadow_bounds);
1050 shell_surface->SetRectangularShadow_DEPRECATED(shadow_bounds);
1051 surface->Commit();
1052 EXPECT_EQ(shadow_bounds,
1053 shell_surface->GetWidget()->GetWindowBoundsInScreen());
1054 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds());
1055 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().size(),
1056 shell_surface->surface_for_testing()->window()->bounds().size());
1057
1058 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE);
1059 ash::WmWindow* window =
1060 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow());
1061 window->GetWindowState()->OnWMEvent(&minimize_event);
1062 }
1063
1014 } // namespace 1064 } // namespace
1015 } // namespace exo 1065 } // 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