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

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

Issue 2870613002: Use defualt shadow elevation. (Closed)
Patch Set: update unit tests to use DEFAULT 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 "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"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 shell_surface->SetRectangularSurfaceShadow(gfx::Rect()); 617 shell_surface->SetRectangularSurfaceShadow(gfx::Rect());
618 surface->Commit(); 618 surface->Commit();
619 619
620 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); 620 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window));
621 EXPECT_FALSE(shadow->layer()->visible()); 621 EXPECT_FALSE(shadow->layer()->visible());
622 622
623 // 6) This should enable non surface shadow again. 623 // 6) This should enable non surface shadow again.
624 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); 624 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100));
625 surface->Commit(); 625 surface->Commit();
626 626
627 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); 627 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window));
628 EXPECT_TRUE(shadow->layer()->visible()); 628 EXPECT_TRUE(shadow->layer()->visible());
629 629
630 // For surface shadow, the underlay is placed at the bottom of shell surfaces. 630 // For surface shadow, the underlay is placed at the bottom of shell surfaces.
631 EXPECT_EQ(surface->window(), shell_surface->shadow_underlay()->parent()); 631 EXPECT_EQ(surface->window(), shell_surface->shadow_underlay()->parent());
632 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); 632 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent());
633 633
634 EXPECT_EQ(*surface->window()->children().begin(), 634 EXPECT_EQ(*surface->window()->children().begin(),
635 shell_surface->shadow_underlay()); 635 shell_surface->shadow_underlay());
636 } 636 }
637 637
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 shell_surface->SetRectangularShadowEnabled(false); 694 shell_surface->SetRectangularShadowEnabled(false);
695 surface->Commit(); 695 surface->Commit();
696 696
697 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window)); 697 EXPECT_EQ(wm::ShadowElevation::NONE, GetShadowElevation(window));
698 EXPECT_FALSE(shadow->layer()->visible()); 698 EXPECT_FALSE(shadow->layer()->visible());
699 699
700 // 6) This should enable non surface shadow. 700 // 6) This should enable non surface shadow.
701 shell_surface->SetRectangularShadowEnabled(true); 701 shell_surface->SetRectangularShadowEnabled(true);
702 surface->Commit(); 702 surface->Commit();
703 703
704 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); 704 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window));
705 EXPECT_TRUE(shadow->layer()->visible()); 705 EXPECT_TRUE(shadow->layer()->visible());
706 706
707 // For no surface shadow, both of underlay and overlay should be stacked 707 // For no surface shadow, both of underlay and overlay should be stacked
708 // below the surface window. 708 // below the surface window.
709 EXPECT_EQ(window, shell_surface->shadow_underlay()->parent()); 709 EXPECT_EQ(window, shell_surface->shadow_underlay()->parent());
710 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent()); 710 EXPECT_EQ(window, shell_surface->shadow_overlay()->parent());
711 711
712 // Shadow overlay should be stacked just above the shadow underlay. 712 // Shadow overlay should be stacked just above the shadow underlay.
713 auto underlay_it = 713 auto underlay_it =
714 std::find(window->children().begin(), window->children().end(), 714 std::find(window->children().begin(), window->children().end(),
(...skipping 25 matching lines...) Expand all
740 // Expected shadow position/bounds in parent coordinates. 740 // Expected shadow position/bounds in parent coordinates.
741 const gfx::Point expected_shadow_origin(-10, -10); 741 const gfx::Point expected_shadow_origin(-10, -10);
742 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size); 742 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size);
743 743
744 views::Widget* widget = shell_surface->GetWidget(); 744 views::Widget* widget = shell_surface->GetWidget();
745 aura::Window* window = widget->GetNativeWindow(); 745 aura::Window* window = widget->GetNativeWindow();
746 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 746 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
747 747
748 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); 748 shell_surface->SetRectangularSurfaceShadow(shadow_bounds);
749 surface->Commit(); 749 surface->Commit();
750 EXPECT_EQ(wm::ShadowElevation::MEDIUM, GetShadowElevation(window)); 750 EXPECT_EQ(wm::ShadowElevation::DEFAULT, GetShadowElevation(window));
751 751
752 // Shadow overlay bounds. 752 // Shadow overlay bounds.
753 EXPECT_TRUE(shadow->layer()->visible()); 753 EXPECT_TRUE(shadow->layer()->visible());
754 // Origin must be in sync. 754 // Origin must be in sync.
755 EXPECT_EQ(expected_shadow_origin, 755 EXPECT_EQ(expected_shadow_origin,
756 shadow->layer()->parent()->bounds().origin()); 756 shadow->layer()->parent()->bounds().origin());
757 757
758 const gfx::Rect work_area = 758 const gfx::Rect work_area =
759 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); 759 display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
760 // Maximizing window hides the shadow. 760 // Maximizing window hides the shadow.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 shell_surface->surface_for_testing()->window()->bounds().size()); 1059 shell_surface->surface_for_testing()->window()->bounds().size());
1060 1060
1061 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE); 1061 ash::wm::WMEvent minimize_event(ash::wm::WM_EVENT_MINIMIZE);
1062 ash::WmWindow* window = 1062 ash::WmWindow* window =
1063 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow()); 1063 ash::WmWindow::Get(shell_surface->GetWidget()->GetNativeWindow());
1064 window->GetWindowState()->OnWMEvent(&minimize_event); 1064 window->GetWindowState()->OnWMEvent(&minimize_event);
1065 } 1065 }
1066 1066
1067 } // namespace 1067 } // namespace
1068 } // namespace exo 1068 } // 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