| 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/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
| 6 #include "ash/common/shell_window_ids.h" | 6 #include "ash/common/shell_window_ids.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/wm/window_state_aura.h" | 10 #include "ash/wm/window_state_aura.h" |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); | 640 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); |
| 641 | 641 |
| 642 // Leave fullscreen mode. | 642 // Leave fullscreen mode. |
| 643 window->GetWindowState()->OnWMEvent(&event); | 643 window->GetWindowState()->OnWMEvent(&event); |
| 644 | 644 |
| 645 // Check that shell surface is maximized. | 645 // Check that shell surface is maximized. |
| 646 EXPECT_EQ(CurrentContext()->bounds().width(), | 646 EXPECT_EQ(CurrentContext()->bounds().width(), |
| 647 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); | 647 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
| 648 } | 648 } |
| 649 | 649 |
| 650 TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) { |
| 651 gfx::Size buffer_size(256, 256); |
| 652 std::unique_ptr<Buffer> buffer( |
| 653 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 654 std::unique_ptr<Surface> surface(new Surface); |
| 655 std::unique_ptr<ShellSurface> shell_surface( |
| 656 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, |
| 657 ash::kShellWindowId_DefaultContainer)); |
| 658 |
| 659 surface->Attach(buffer.get()); |
| 660 |
| 661 gfx::Rect shadow_bounds(10, 10, 100, 100); |
| 662 shell_surface->SetRectangularShadow(shadow_bounds); |
| 663 surface->Commit(); |
| 664 ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds()); |
| 665 |
| 666 ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); |
| 667 ash::WmWindow* window = |
| 668 ash::WmWindowAura::Get(shell_surface->GetWidget()->GetNativeWindow()); |
| 669 |
| 670 // Enter immersive fullscreen mode. Shadow underlay is fullscreen. |
| 671 window->GetWindowState()->OnWMEvent(&event); |
| 672 |
| 673 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), |
| 674 shell_surface->shadow_underlay_for_test()->bounds()); |
| 675 EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible()); |
| 676 EXPECT_EQ(1.f, shell_surface->shadow_underlay_for_test()->layer()->opacity()); |
| 677 EXPECT_NE(shell_surface->GetWidget()->GetWindowBoundsInScreen(), |
| 678 shell_surface->shadow_underlay_for_test()->bounds()); |
| 679 |
| 680 // Leave fullscreen mode. Shadow underlay is restored. |
| 681 window->GetWindowState()->OnWMEvent(&event); |
| 682 EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible()); |
| 683 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds()); |
| 684 } |
| 685 |
| 650 } // namespace | 686 } // namespace |
| 651 } // namespace exo | 687 } // namespace exo |
| OLD | NEW |