| Index: components/exo/shell_surface_unittest.cc
|
| diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc
|
| index cfeffaaeec4239882414c3bd42dd905b85d0cb46..ab570157bd29711d63a3eaafbb378c6c1a548729 100644
|
| --- a/components/exo/shell_surface_unittest.cc
|
| +++ b/components/exo/shell_surface_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "ash/aura/wm_window_aura.h"
|
| +#include "ash/common/accessibility_delegate.h"
|
| #include "ash/common/shell_window_ids.h"
|
| #include "ash/common/wm/window_state.h"
|
| #include "ash/common/wm/wm_event.h"
|
| @@ -20,9 +21,11 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/window.h"
|
| +#include "ui/aura/window_targeter.h"
|
| #include "ui/base/hit_test.h"
|
| #include "ui/display/display.h"
|
| #include "ui/display/screen.h"
|
| +#include "ui/events/base_event_utils.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/wm/core/shadow.h"
|
| #include "ui/wm/core/shadow_controller.h"
|
| @@ -683,5 +686,63 @@ TEST_F(ShellSurfaceTest, ImmersiveFullscreenBackground) {
|
| EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds());
|
| }
|
|
|
| +TEST_F(ShellSurfaceTest, SpokenFeedbackFullscreenBackground) {
|
| + gfx::Size buffer_size(256, 256);
|
| + std::unique_ptr<Buffer> buffer(
|
| + new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
|
| + std::unique_ptr<Surface> surface(new Surface);
|
| + std::unique_ptr<ShellSurface> shell_surface(
|
| + new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true,
|
| + ash::kShellWindowId_DefaultContainer));
|
| +
|
| + surface->Attach(buffer.get());
|
| +
|
| + gfx::Rect shadow_bounds(10, 10, 100, 100);
|
| + shell_surface->SetRectangularShadow(shadow_bounds);
|
| + surface->Commit();
|
| + ASSERT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds());
|
| +
|
| + aura::Window* shell_window = shell_surface->GetWidget()->GetNativeWindow();
|
| + aura::WindowTargeter* targeter = static_cast<aura::WindowTargeter*>(
|
| + static_cast<ui::EventTarget*>(shell_window)->GetEventTargeter());
|
| +
|
| + gfx::Point pt(300, 300);
|
| + ui::MouseEvent ev_out(ui::ET_MOUSE_PRESSED, pt, pt, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| + pt = gfx::Point(250, 250);
|
| + ui::MouseEvent ev_in(ui::ET_MOUSE_PRESSED, pt, pt, ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
|
| +
|
| + EXPECT_FALSE(targeter->SubtreeShouldBeExploredForEvent(shell_window, ev_out));
|
| +
|
| + // Enable spoken feedback.
|
| + ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
|
| + ash::A11Y_NOTIFICATION_NONE);
|
| + shell_surface->OnAccessibilityModeChanged(ash::A11Y_NOTIFICATION_NONE);
|
| +
|
| + EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
|
| + shell_surface->shadow_underlay_for_test()->bounds());
|
| + EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible());
|
| + EXPECT_NE(shell_surface->GetWidget()->GetWindowBoundsInScreen(),
|
| + shell_surface->shadow_underlay_for_test()->bounds());
|
| +
|
| + // Test event capture
|
| + EXPECT_TRUE(targeter->SubtreeShouldBeExploredForEvent(shell_window, ev_out));
|
| + EXPECT_EQ(shell_surface->shadow_underlay_for_test(),
|
| + static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent(
|
| + shell_window, &ev_out));
|
| + EXPECT_NE(shell_surface->shadow_underlay_for_test(),
|
| + static_cast<ui::EventTargeter*>(targeter)->FindTargetForEvent(
|
| + shell_window, &ev_in));
|
| +
|
| + // Disable spoken feedback. Shadow underlay is restored.
|
| + ash::WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
|
| + ash::A11Y_NOTIFICATION_SHOW);
|
| + shell_surface->OnAccessibilityModeChanged(ash::A11Y_NOTIFICATION_NONE);
|
| +
|
| + EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible());
|
| + EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace exo
|
|
|