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

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

Issue 2645663004: exo: Initial support for multiple displays in ARC (Closed)
Patch Set: Fix bad merge in test Created 3 years, 10 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 "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 23 matching lines...) Expand all
34 34
35 namespace exo { 35 namespace exo {
36 namespace { 36 namespace {
37 37
38 using ShellSurfaceTest = test::ExoTestBase; 38 using ShellSurfaceTest = test::ExoTestBase;
39 39
40 uint32_t ConfigureFullscreen(uint32_t serial, 40 uint32_t ConfigureFullscreen(uint32_t serial,
41 const gfx::Size& size, 41 const gfx::Size& size,
42 ash::wm::WindowStateType state_type, 42 ash::wm::WindowStateType state_type,
43 bool resizing, 43 bool resizing,
44 bool activated) { 44 bool activated,
45 const gfx::Point& origin) {
45 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type); 46 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type);
46 return serial; 47 return serial;
47 } 48 }
48 49
49 TEST_F(ShellSurfaceTest, AcknowledgeConfigure) { 50 TEST_F(ShellSurfaceTest, AcknowledgeConfigure) {
50 gfx::Size buffer_size(32, 32); 51 gfx::Size buffer_size(32, 32);
51 std::unique_ptr<Buffer> buffer( 52 std::unique_ptr<Buffer> buffer(
52 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 53 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
53 std::unique_ptr<Surface> surface(new Surface); 54 std::unique_ptr<Surface> surface(new Surface);
54 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 55 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 EXPECT_FALSE(shell_surface.get()); 357 EXPECT_FALSE(shell_surface.get());
357 } 358 }
358 359
359 uint32_t Configure(gfx::Size* suggested_size, 360 uint32_t Configure(gfx::Size* suggested_size,
360 ash::wm::WindowStateType* has_state_type, 361 ash::wm::WindowStateType* has_state_type,
361 bool* is_resizing, 362 bool* is_resizing,
362 bool* is_active, 363 bool* is_active,
363 const gfx::Size& size, 364 const gfx::Size& size,
364 ash::wm::WindowStateType state_type, 365 ash::wm::WindowStateType state_type,
365 bool resizing, 366 bool resizing,
366 bool activated) { 367 bool activated,
368 const gfx::Point& origin) {
367 *suggested_size = size; 369 *suggested_size = size;
368 *has_state_type = state_type; 370 *has_state_type = state_type;
369 *is_resizing = resizing; 371 *is_resizing = resizing;
370 *is_active = activated; 372 *is_active = activated;
371 return 0; 373 return 0;
372 } 374 }
373 375
374 TEST_F(ShellSurfaceTest, ConfigureCallback) { 376 TEST_F(ShellSurfaceTest, ConfigureCallback) {
375 std::unique_ptr<Surface> surface(new Surface); 377 std::unique_ptr<Surface> surface(new Surface);
376 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 378 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 EXPECT_FALSE(is_active); 413 EXPECT_FALSE(is_active);
412 414
413 EXPECT_FALSE(is_resizing); 415 EXPECT_FALSE(is_resizing);
414 shell_surface->Resize(HTBOTTOMRIGHT); 416 shell_surface->Resize(HTBOTTOMRIGHT);
415 shell_surface->AcknowledgeConfigure(0); 417 shell_surface->AcknowledgeConfigure(0);
416 EXPECT_TRUE(is_resizing); 418 EXPECT_TRUE(is_resizing);
417 } 419 }
418 420
419 TEST_F(ShellSurfaceTest, ModalWindow) { 421 TEST_F(ShellSurfaceTest, ModalWindow) {
420 std::unique_ptr<Surface> surface(new Surface); 422 std::unique_ptr<Surface> surface(new Surface);
421 std::unique_ptr<ShellSurface> shell_surface( 423 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
422 new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, 424 surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(),
423 ash::kShellWindowId_SystemModalContainer)); 425 true, false, ash::kShellWindowId_SystemModalContainer));
424 gfx::Size desktop_size(640, 480); 426 gfx::Size desktop_size(640, 480);
425 std::unique_ptr<Buffer> desktop_buffer( 427 std::unique_ptr<Buffer> desktop_buffer(
426 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(desktop_size))); 428 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(desktop_size)));
427 surface->Attach(desktop_buffer.get()); 429 surface->Attach(desktop_buffer.get());
428 surface->SetInputRegion(SkRegion()); 430 surface->SetInputRegion(SkRegion());
429 surface->Commit(); 431 surface->Commit();
430 432
431 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 433 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
432 434
433 // Creating a surface without input region should not make it modal. 435 // Creating a surface without input region should not make it modal.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 geometry.OffsetFromOrigin(), 504 geometry.OffsetFromOrigin(),
503 geometry.size()), 505 geometry.size()),
504 popup->GetWidget()->GetWindowBoundsInScreen()); 506 popup->GetWidget()->GetWindowBoundsInScreen());
505 } 507 }
506 508
507 TEST_F(ShellSurfaceTest, SurfaceShadow) { 509 TEST_F(ShellSurfaceTest, SurfaceShadow) {
508 gfx::Size buffer_size(128, 128); 510 gfx::Size buffer_size(128, 128);
509 std::unique_ptr<Buffer> buffer( 511 std::unique_ptr<Buffer> buffer(
510 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 512 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
511 std::unique_ptr<Surface> surface(new Surface); 513 std::unique_ptr<Surface> surface(new Surface);
512 std::unique_ptr<ShellSurface> shell_surface( 514 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
513 new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, 515 surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(),
514 ash::kShellWindowId_DefaultContainer)); 516 true, false, ash::kShellWindowId_DefaultContainer));
515 surface->Attach(buffer.get()); 517 surface->Attach(buffer.get());
516 surface->Commit(); 518 surface->Commit();
517 519
518 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); 520 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
519 521
520 // 1) Initial state, no shadow. 522 // 1) Initial state, no shadow.
521 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 523 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
522 ASSERT_TRUE(shadow); 524 ASSERT_TRUE(shadow);
523 EXPECT_FALSE(shadow->layer()->visible()); 525 EXPECT_FALSE(shadow->layer()->visible());
524 526
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 EXPECT_EQ(*surface->window()->children().begin(), 579 EXPECT_EQ(*surface->window()->children().begin(),
578 shell_surface->shadow_underlay()); 580 shell_surface->shadow_underlay());
579 } 581 }
580 582
581 TEST_F(ShellSurfaceTest, NonSurfaceShadow) { 583 TEST_F(ShellSurfaceTest, NonSurfaceShadow) {
582 gfx::Size buffer_size(128, 128); 584 gfx::Size buffer_size(128, 128);
583 std::unique_ptr<Buffer> buffer( 585 std::unique_ptr<Buffer> buffer(
584 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 586 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
585 std::unique_ptr<Surface> surface(new Surface); 587 std::unique_ptr<Surface> surface(new Surface);
586 std::unique_ptr<ShellSurface> shell_surface( 588 std::unique_ptr<ShellSurface> shell_surface(
587 new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, 589 new ShellSurface(surface.get(), nullptr, ShellSurface::BoundsMode::SHELL,
590 gfx::Point(), true, false,
588 ash::kShellWindowId_DefaultContainer)); 591 ash::kShellWindowId_DefaultContainer));
589 surface->Attach(buffer.get()); 592 surface->Attach(buffer.get());
590 surface->Commit(); 593 surface->Commit();
591 594
592 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); 595 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
593 596
594 // 1) Initial state, no shadow. 597 // 1) Initial state, no shadow.
595 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 598 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
596 ASSERT_TRUE(shadow); 599 ASSERT_TRUE(shadow);
597 EXPECT_FALSE(shadow->layer()->visible()); 600 EXPECT_FALSE(shadow->layer()->visible());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 ASSERT_NE(underlay_it, window->children().end()); 662 ASSERT_NE(underlay_it, window->children().end());
660 ASSERT_NE(std::next(underlay_it), window->children().end()); 663 ASSERT_NE(std::next(underlay_it), window->children().end());
661 EXPECT_EQ(*std::next(underlay_it), shell_surface->shadow_overlay()); 664 EXPECT_EQ(*std::next(underlay_it), shell_surface->shadow_overlay());
662 } 665 }
663 666
664 TEST_F(ShellSurfaceTest, ShadowWithStateChange) { 667 TEST_F(ShellSurfaceTest, ShadowWithStateChange) {
665 gfx::Size buffer_size(64, 64); 668 gfx::Size buffer_size(64, 64);
666 std::unique_ptr<Buffer> buffer( 669 std::unique_ptr<Buffer> buffer(
667 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 670 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
668 std::unique_ptr<Surface> surface(new Surface); 671 std::unique_ptr<Surface> surface(new Surface);
669 // Set the bounds to disable auto managed mode. 672 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
670 std::unique_ptr<ShellSurface> shell_surface( 673 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
671 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, 674 true, false, ash::kShellWindowId_DefaultContainer));
672 ash::kShellWindowId_DefaultContainer));
673 675
674 // Postion the widget at 10,10 so that we get non zero offset. 676 // Postion the widget at 10,10 so that we get non zero offset.
675 const gfx::Size content_size(100, 100); 677 const gfx::Size content_size(100, 100);
676 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); 678 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size);
677 shell_surface->SetGeometry(original_bounds); 679 shell_surface->SetGeometry(original_bounds);
678 surface->Attach(buffer.get()); 680 surface->Attach(buffer.get());
679 surface->Commit(); 681 surface->Commit();
680 682
681 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). 683 // Placing a shadow at screen origin will make the shadow's origin (-10, -10).
682 const gfx::Rect shadow_bounds(content_size); 684 const gfx::Rect shadow_bounds(content_size);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); 723 shell_surface->SetRectangularSurfaceShadow(shadow_bounds);
722 surface->Commit(); 724 surface->Commit();
723 EXPECT_EQ(expected_shadow_bounds, shadow->layer()->parent()->bounds()); 725 EXPECT_EQ(expected_shadow_bounds, shadow->layer()->parent()->bounds());
724 } 726 }
725 727
726 TEST_F(ShellSurfaceTest, ShadowWithTransform) { 728 TEST_F(ShellSurfaceTest, ShadowWithTransform) {
727 gfx::Size buffer_size(64, 64); 729 gfx::Size buffer_size(64, 64);
728 std::unique_ptr<Buffer> buffer( 730 std::unique_ptr<Buffer> buffer(
729 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 731 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
730 std::unique_ptr<Surface> surface(new Surface); 732 std::unique_ptr<Surface> surface(new Surface);
731 // Set the bounds to disable auto managed mode. 733 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
732 std::unique_ptr<ShellSurface> shell_surface( 734 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
733 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 400), true, false, 735 true, false, ash::kShellWindowId_DefaultContainer));
734 ash::kShellWindowId_DefaultContainer));
735 736
736 // Postion the widget at 10,10 so that we get non zero offset. 737 // Postion the widget at 10,10 so that we get non zero offset.
737 const gfx::Size content_size(100, 100); 738 const gfx::Size content_size(100, 100);
738 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); 739 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size);
739 shell_surface->SetGeometry(original_bounds); 740 shell_surface->SetGeometry(original_bounds);
740 surface->Attach(buffer.get()); 741 surface->Attach(buffer.get());
741 surface->Commit(); 742 surface->Commit();
742 743
743 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); 744 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
744 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 745 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
745 746
746 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). 747 // Placing a shadow at screen origin will make the shadow's origin (-10, -10).
747 const gfx::Rect shadow_bounds(content_size); 748 const gfx::Rect shadow_bounds(content_size);
748 749
749 // Shadow bounds relative to its parent should not be affected by a transform. 750 // Shadow bounds relative to its parent should not be affected by a transform.
750 gfx::Transform transform; 751 gfx::Transform transform;
751 transform.Translate(50, 50); 752 transform.Translate(50, 50);
752 window->SetTransform(transform); 753 window->SetTransform(transform);
753 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); 754 shell_surface->SetRectangularSurfaceShadow(shadow_bounds);
754 surface->Commit(); 755 surface->Commit();
755 EXPECT_TRUE(shadow->layer()->visible()); 756 EXPECT_TRUE(shadow->layer()->visible());
756 EXPECT_EQ(gfx::Rect(-10, -10, 100, 100), shadow->layer()->parent()->bounds()); 757 EXPECT_EQ(gfx::Rect(-10, -10, 100, 100), shadow->layer()->parent()->bounds());
757 } 758 }
758 759
759 TEST_F(ShellSurfaceTest, ShadowStartMaximized) { 760 TEST_F(ShellSurfaceTest, ShadowStartMaximized) {
760 std::unique_ptr<Surface> surface(new Surface); 761 std::unique_ptr<Surface> surface(new Surface);
761 std::unique_ptr<ShellSurface> shell_surface( 762 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
762 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, 763 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
763 ash::kShellWindowId_DefaultContainer)); 764 true, false, ash::kShellWindowId_DefaultContainer));
764 shell_surface->Maximize(); 765 shell_surface->Maximize();
765 views::Widget* widget = shell_surface->GetWidget(); 766 views::Widget* widget = shell_surface->GetWidget();
766 aura::Window* window = widget->GetNativeWindow(); 767 aura::Window* window = widget->GetNativeWindow();
767 768
768 // There is no shadow when started in maximized state. 769 // There is no shadow when started in maximized state.
769 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); 770 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window));
770 771
771 // Sending a shadow bounds in maximized state won't create a shaodw. 772 // Sending a shadow bounds in maximized state won't create a shaodw.
772 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); 773 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100));
773 surface->Commit(); 774 surface->Commit();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); 822 shell_surface->GetWidget()->GetWindowBoundsInScreen().width());
822 } 823 }
823 824
824 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) { 825 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) {
825 const gfx::Size display_size = 826 const gfx::Size display_size =
826 display::Screen::GetScreen()->GetPrimaryDisplay().size(); 827 display::Screen::GetScreen()->GetPrimaryDisplay().size();
827 const gfx::Size buffer_size(display_size); 828 const gfx::Size buffer_size(display_size);
828 std::unique_ptr<Buffer> buffer( 829 std::unique_ptr<Buffer> buffer(
829 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 830 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
830 std::unique_ptr<Surface> surface(new Surface); 831 std::unique_ptr<Surface> surface(new Surface);
831 std::unique_ptr<ShellSurface> shell_surface( 832 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
832 new ShellSurface(surface.get(), nullptr, gfx::Rect(100, 100), true, false, 833 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
833 ash::kShellWindowId_DefaultContainer)); 834 true, false, ash::kShellWindowId_DefaultContainer));
834 835
835 surface->Attach(buffer.get()); 836 surface->Attach(buffer.get());
836 837
837 gfx::Rect shadow_bounds(10, 10, 100, 100); 838 gfx::Rect shadow_bounds(10, 10, 100, 100);
838 shell_surface->SetGeometry(shadow_bounds); 839 shell_surface->SetGeometry(shadow_bounds);
839 shell_surface->SetRectangularSurfaceShadow(shadow_bounds); 840 shell_surface->SetRectangularSurfaceShadow(shadow_bounds);
840 surface->Commit(); 841 surface->Commit();
841 EXPECT_EQ(shadow_bounds, 842 EXPECT_EQ(shadow_bounds,
842 shell_surface->GetWidget()->GetWindowBoundsInScreen()); 843 shell_surface->GetWidget()->GetWindowBoundsInScreen());
843 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); 844 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds());
(...skipping 17 matching lines...) Expand all
861 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); 862 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible());
862 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); 863 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds());
863 } 864 }
864 865
865 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) { 866 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) {
866 const gfx::Size display_size = 867 const gfx::Size display_size =
867 display::Screen::GetScreen()->GetPrimaryDisplay().size(); 868 display::Screen::GetScreen()->GetPrimaryDisplay().size();
868 const gfx::Size buffer_size(display_size); 869 const gfx::Size buffer_size(display_size);
869 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); 870 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size));
870 Surface surface; 871 Surface surface;
871 ShellSurface shell_surface(&surface, nullptr, gfx::Rect(100, 100), true, 872 ShellSurface shell_surface(&surface, nullptr,
872 false, ash::kShellWindowId_DefaultContainer); 873 ShellSurface::BoundsMode::CLIENT, gfx::Point(),
874 true, false, ash::kShellWindowId_DefaultContainer);
873 surface.Attach(&buffer); 875 surface.Attach(&buffer);
874 876
875 gfx::Rect shadow_bounds(10, 10, 100, 100); 877 gfx::Rect shadow_bounds(10, 10, 100, 100);
876 shell_surface.SetGeometry(shadow_bounds); 878 shell_surface.SetGeometry(shadow_bounds);
877 shell_surface.SetRectangularSurfaceShadow(shadow_bounds); 879 shell_surface.SetRectangularSurfaceShadow(shadow_bounds);
878 surface.Commit(); 880 surface.Commit();
879 EXPECT_EQ(shadow_bounds, 881 EXPECT_EQ(shadow_bounds,
880 shell_surface.GetWidget()->GetWindowBoundsInScreen()); 882 shell_surface.GetWidget()->GetWindowBoundsInScreen());
881 ASSERT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); 883 ASSERT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds());
882 884
(...skipping 28 matching lines...) Expand all
911 EXPECT_EQ(shell_surface.shadow_underlay(), 913 EXPECT_EQ(shell_surface.shadow_underlay(),
912 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( 914 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent(
913 shell_window, &ev_out)); 915 shell_window, &ev_out));
914 EXPECT_NE(shell_surface.shadow_underlay(), 916 EXPECT_NE(shell_surface.shadow_underlay(),
915 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( 917 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent(
916 shell_window, &ev_in)); 918 shell_window, &ev_in));
917 919
918 // Create a new surface 920 // Create a new surface
919 Buffer buffer2(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); 921 Buffer buffer2(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size));
920 Surface surface2; 922 Surface surface2;
921 ShellSurface shell_surface2(&surface2, nullptr, gfx::Rect(640, 480), true, 923 ShellSurface shell_surface2(
922 false, ash::kShellWindowId_DefaultContainer); 924 &surface2, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), true,
925 false, ash::kShellWindowId_DefaultContainer);
923 surface2.Attach(&buffer2); 926 surface2.Attach(&buffer2);
924 shell_surface2.SetRectangularSurfaceShadow(shadow_bounds); 927 shell_surface2.SetRectangularSurfaceShadow(shadow_bounds);
925 surface2.Commit(); 928 surface2.Commit();
926 929
927 // spoken-feedback was already on, so underlay should fill screen 930 // spoken-feedback was already on, so underlay should fill screen
928 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), 931 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
929 shell_surface2.shadow_underlay()->bounds()); 932 shell_surface2.shadow_underlay()->bounds());
930 933
931 // De-activated shell-surface should NOT have fullscreen underlay 934 // De-activated shell-surface should NOT have fullscreen underlay
932 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); 935 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds());
933 936
934 // Disable spoken feedback. Shadow underlay is restored. 937 // Disable spoken feedback. Shadow underlay is restored.
935 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( 938 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
936 ash::A11Y_NOTIFICATION_NONE); 939 ash::A11Y_NOTIFICATION_NONE);
937 shell_surface.OnAccessibilityModeChanged(); 940 shell_surface.OnAccessibilityModeChanged();
938 shell_surface2.OnAccessibilityModeChanged(); 941 shell_surface2.OnAccessibilityModeChanged();
939 942
940 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); 943 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible());
941 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); 944 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds());
942 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); 945 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds());
943 } 946 }
944 947
945 } // namespace 948 } // namespace
946 } // namespace exo 949 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698