| 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 23 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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, Shadow) { | 509 TEST_F(ShellSurfaceTest, Shadow) { |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 ASSERT_NE(underlay_it, window->children().end()); | 580 ASSERT_NE(underlay_it, window->children().end()); |
| 579 ASSERT_NE(std::next(underlay_it), window->children().end()); | 581 ASSERT_NE(std::next(underlay_it), window->children().end()); |
| 580 EXPECT_EQ(*std::next(underlay_it), shell_surface->shadow_overlay()); | 582 EXPECT_EQ(*std::next(underlay_it), shell_surface->shadow_overlay()); |
| 581 } | 583 } |
| 582 | 584 |
| 583 TEST_F(ShellSurfaceTest, ShadowWithStateChange) { | 585 TEST_F(ShellSurfaceTest, ShadowWithStateChange) { |
| 584 gfx::Size buffer_size(64, 64); | 586 gfx::Size buffer_size(64, 64); |
| 585 std::unique_ptr<Buffer> buffer( | 587 std::unique_ptr<Buffer> buffer( |
| 586 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 588 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 587 std::unique_ptr<Surface> surface(new Surface); | 589 std::unique_ptr<Surface> surface(new Surface); |
| 588 // Set the bounds to disable auto managed mode. | 590 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( |
| 589 std::unique_ptr<ShellSurface> shell_surface( | 591 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 590 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, | 592 true, false, ash::kShellWindowId_DefaultContainer)); |
| 591 ash::kShellWindowId_DefaultContainer)); | |
| 592 | 593 |
| 593 // Postion the widget at 10,10 so that we get non zero offset. | 594 // Postion the widget at 10,10 so that we get non zero offset. |
| 594 const gfx::Size content_size(100, 100); | 595 const gfx::Size content_size(100, 100); |
| 595 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); | 596 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); |
| 596 shell_surface->SetGeometry(original_bounds); | 597 shell_surface->SetGeometry(original_bounds); |
| 597 surface->Attach(buffer.get()); | 598 surface->Attach(buffer.get()); |
| 598 surface->Commit(); | 599 surface->Commit(); |
| 599 | 600 |
| 600 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). | 601 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). |
| 601 const gfx::Rect shadow_bounds(content_size); | 602 const gfx::Rect shadow_bounds(content_size); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); | 642 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); |
| 642 surface->Commit(); | 643 surface->Commit(); |
| 643 EXPECT_EQ(expected_shadow_bounds, shadow->layer()->parent()->bounds()); | 644 EXPECT_EQ(expected_shadow_bounds, shadow->layer()->parent()->bounds()); |
| 644 } | 645 } |
| 645 | 646 |
| 646 TEST_F(ShellSurfaceTest, ShadowWithTransform) { | 647 TEST_F(ShellSurfaceTest, ShadowWithTransform) { |
| 647 gfx::Size buffer_size(64, 64); | 648 gfx::Size buffer_size(64, 64); |
| 648 std::unique_ptr<Buffer> buffer( | 649 std::unique_ptr<Buffer> buffer( |
| 649 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 650 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 650 std::unique_ptr<Surface> surface(new Surface); | 651 std::unique_ptr<Surface> surface(new Surface); |
| 651 // Set the bounds to disable auto managed mode. | 652 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( |
| 652 std::unique_ptr<ShellSurface> shell_surface( | 653 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 653 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 400), true, false, | 654 true, false, ash::kShellWindowId_DefaultContainer)); |
| 654 ash::kShellWindowId_DefaultContainer)); | |
| 655 | 655 |
| 656 // Postion the widget at 10,10 so that we get non zero offset. | 656 // Postion the widget at 10,10 so that we get non zero offset. |
| 657 const gfx::Size content_size(100, 100); | 657 const gfx::Size content_size(100, 100); |
| 658 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); | 658 const gfx::Rect original_bounds(gfx::Point(10, 10), content_size); |
| 659 shell_surface->SetGeometry(original_bounds); | 659 shell_surface->SetGeometry(original_bounds); |
| 660 surface->Attach(buffer.get()); | 660 surface->Attach(buffer.get()); |
| 661 surface->Commit(); | 661 surface->Commit(); |
| 662 | 662 |
| 663 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); | 663 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); |
| 664 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 664 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
| 665 | 665 |
| 666 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). | 666 // Placing a shadow at screen origin will make the shadow's origin (-10, -10). |
| 667 const gfx::Rect shadow_bounds(content_size); | 667 const gfx::Rect shadow_bounds(content_size); |
| 668 | 668 |
| 669 // Shadow bounds relative to its parent should not be affected by a transform. | 669 // Shadow bounds relative to its parent should not be affected by a transform. |
| 670 gfx::Transform transform; | 670 gfx::Transform transform; |
| 671 transform.Translate(50, 50); | 671 transform.Translate(50, 50); |
| 672 window->SetTransform(transform); | 672 window->SetTransform(transform); |
| 673 shell_surface->SetRectangularShadow(true); | 673 shell_surface->SetRectangularShadow(true); |
| 674 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); | 674 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); |
| 675 surface->Commit(); | 675 surface->Commit(); |
| 676 EXPECT_TRUE(shadow->layer()->visible()); | 676 EXPECT_TRUE(shadow->layer()->visible()); |
| 677 EXPECT_EQ(gfx::Rect(-10, -10, 100, 100), shadow->layer()->parent()->bounds()); | 677 EXPECT_EQ(gfx::Rect(-10, -10, 100, 100), shadow->layer()->parent()->bounds()); |
| 678 } | 678 } |
| 679 | 679 |
| 680 TEST_F(ShellSurfaceTest, ShadowStartMaximized) { | 680 TEST_F(ShellSurfaceTest, ShadowStartMaximized) { |
| 681 std::unique_ptr<Surface> surface(new Surface); | 681 std::unique_ptr<Surface> surface(new Surface); |
| 682 std::unique_ptr<ShellSurface> shell_surface( | 682 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( |
| 683 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, | 683 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 684 ash::kShellWindowId_DefaultContainer)); | 684 true, false, ash::kShellWindowId_DefaultContainer)); |
| 685 shell_surface->Maximize(); | 685 shell_surface->Maximize(); |
| 686 views::Widget* widget = shell_surface->GetWidget(); | 686 views::Widget* widget = shell_surface->GetWidget(); |
| 687 aura::Window* window = widget->GetNativeWindow(); | 687 aura::Window* window = widget->GetNativeWindow(); |
| 688 | 688 |
| 689 // There is no shadow when started in maximized state. | 689 // There is no shadow when started in maximized state. |
| 690 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); | 690 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); |
| 691 | 691 |
| 692 // Sending a shadow bounds in maximized state won't create a shaodw. | 692 // Sending a shadow bounds in maximized state won't create a shaodw. |
| 693 shell_surface->SetRectangularShadow(true); | 693 shell_surface->SetRectangularShadow(true); |
| 694 shell_surface->SetRectangularShadowContentBounds(gfx::Rect(10, 10, 100, 100)); | 694 shell_surface->SetRectangularShadowContentBounds(gfx::Rect(10, 10, 100, 100)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // Check that shell surface is maximized. | 741 // Check that shell surface is maximized. |
| 742 EXPECT_EQ(CurrentContext()->bounds().width(), | 742 EXPECT_EQ(CurrentContext()->bounds().width(), |
| 743 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); | 743 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
| 744 } | 744 } |
| 745 | 745 |
| 746 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) { | 746 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) { |
| 747 gfx::Size buffer_size(256, 256); | 747 gfx::Size buffer_size(256, 256); |
| 748 std::unique_ptr<Buffer> buffer( | 748 std::unique_ptr<Buffer> buffer( |
| 749 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 749 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 750 std::unique_ptr<Surface> surface(new Surface); | 750 std::unique_ptr<Surface> surface(new Surface); |
| 751 std::unique_ptr<ShellSurface> shell_surface( | 751 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( |
| 752 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, | 752 surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 753 ash::kShellWindowId_DefaultContainer)); | 753 true, false, ash::kShellWindowId_DefaultContainer)); |
| 754 | 754 |
| 755 surface->Attach(buffer.get()); | 755 surface->Attach(buffer.get()); |
| 756 | 756 |
| 757 gfx::Rect shadow_bounds(10, 10, 100, 100); | 757 gfx::Rect shadow_bounds(10, 10, 100, 100); |
| 758 shell_surface->SetRectangularShadow(true); | 758 shell_surface->SetRectangularShadow(true); |
| 759 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); | 759 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); |
| 760 surface->Commit(); | 760 surface->Commit(); |
| 761 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); | 761 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); |
| 762 | 762 |
| 763 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); | 763 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 777 // Leave fullscreen mode. Shadow underlay is restored. | 777 // Leave fullscreen mode. Shadow underlay is restored. |
| 778 window->GetWindowState()->OnWMEvent(&event); | 778 window->GetWindowState()->OnWMEvent(&event); |
| 779 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | 779 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
| 780 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); | 780 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay()->bounds()); |
| 781 } | 781 } |
| 782 | 782 |
| 783 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) { | 783 TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) { |
| 784 gfx::Size buffer_size(256, 256); | 784 gfx::Size buffer_size(256, 256); |
| 785 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); | 785 Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); |
| 786 Surface surface; | 786 Surface surface; |
| 787 ShellSurface shell_surface(&surface, nullptr, gfx::Rect(640, 480), true, | 787 ShellSurface shell_surface(&surface, nullptr, |
| 788 false, ash::kShellWindowId_DefaultContainer); | 788 ShellSurface::BoundsMode::CLIENT, gfx::Point(), |
| 789 true, false, ash::kShellWindowId_DefaultContainer); |
| 789 | 790 |
| 790 surface.Attach(&buffer); | 791 surface.Attach(&buffer); |
| 791 | 792 |
| 792 gfx::Rect shadow_bounds(10, 10, 100, 100); | 793 gfx::Rect shadow_bounds(10, 10, 100, 100); |
| 793 shell_surface.SetRectangularShadow(true); | 794 shell_surface.SetRectangularShadow(true); |
| 794 shell_surface.SetRectangularShadowContentBounds(shadow_bounds); | 795 shell_surface.SetRectangularShadowContentBounds(shadow_bounds); |
| 795 surface.Commit(); | 796 surface.Commit(); |
| 796 ASSERT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 797 ASSERT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
| 797 | 798 |
| 798 aura::Window* shell_window = shell_surface.GetWidget()->GetNativeWindow(); | 799 aura::Window* shell_window = shell_surface.GetWidget()->GetNativeWindow(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 824 EXPECT_EQ(shell_surface.shadow_underlay(), | 825 EXPECT_EQ(shell_surface.shadow_underlay(), |
| 825 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( | 826 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( |
| 826 shell_window, &ev_out)); | 827 shell_window, &ev_out)); |
| 827 EXPECT_NE(shell_surface.shadow_underlay(), | 828 EXPECT_NE(shell_surface.shadow_underlay(), |
| 828 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( | 829 static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent( |
| 829 shell_window, &ev_in)); | 830 shell_window, &ev_in)); |
| 830 | 831 |
| 831 // Create a new surface | 832 // Create a new surface |
| 832 Buffer buffer2(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); | 833 Buffer buffer2(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); |
| 833 Surface surface2; | 834 Surface surface2; |
| 834 ShellSurface shell_surface2(&surface2, nullptr, gfx::Rect(640, 480), true, | 835 ShellSurface shell_surface2( |
| 835 false, ash::kShellWindowId_DefaultContainer); | 836 &surface2, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), true, |
| 837 false, ash::kShellWindowId_DefaultContainer); |
| 836 surface2.Attach(&buffer2); | 838 surface2.Attach(&buffer2); |
| 837 shell_surface2.SetRectangularShadow(true); | 839 shell_surface2.SetRectangularShadow(true); |
| 838 shell_surface2.SetRectangularShadowContentBounds(shadow_bounds); | 840 shell_surface2.SetRectangularShadowContentBounds(shadow_bounds); |
| 839 surface2.Commit(); | 841 surface2.Commit(); |
| 840 | 842 |
| 841 // spoken-feedback was already on, so underlay should fill screen | 843 // spoken-feedback was already on, so underlay should fill screen |
| 842 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | 844 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), |
| 843 shell_surface2.shadow_underlay()->bounds()); | 845 shell_surface2.shadow_underlay()->bounds()); |
| 844 | 846 |
| 845 // De-activated shell-surface should NOT have fullscreen underlay | 847 // De-activated shell-surface should NOT have fullscreen underlay |
| 846 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 848 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
| 847 | 849 |
| 848 // Disable spoken feedback. Shadow underlay is restored. | 850 // Disable spoken feedback. Shadow underlay is restored. |
| 849 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( | 851 ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( |
| 850 ash::A11Y_NOTIFICATION_NONE); | 852 ash::A11Y_NOTIFICATION_NONE); |
| 851 shell_surface.OnAccessibilityModeChanged(); | 853 shell_surface.OnAccessibilityModeChanged(); |
| 852 shell_surface2.OnAccessibilityModeChanged(); | 854 shell_surface2.OnAccessibilityModeChanged(); |
| 853 | 855 |
| 854 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); | 856 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); |
| 855 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 857 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
| 856 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); | 858 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); |
| 857 } | 859 } |
| 858 | 860 |
| 859 } // namespace | 861 } // namespace |
| 860 } // namespace exo | 862 } // namespace exo |
| OLD | NEW |