Commit 0133ccb0 authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

mash: move TriggerAccessibilityAlert to AccessibilityController

changes:
move TriggerAccessibilityAlert from AccessibilityDelegate to
AccessibilityController. This is part of mash work aimed at removing
AccessibilityDelegate.

Bug: 618070
Test: covered by tests
Change-Id: Ic5c026df5a33516e135be5edf38f6fea4cf1d9dc
Reviewed-on: https://chromium-review.googlesource.com/764597
Commit-Queue: Qiang(Joe) Xu <warx@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516097}
parent 3b537802
......@@ -1631,6 +1631,8 @@ static_library("test_support_common") {
testonly = true
visibility = [ ":*" ]
sources = [
"accessibility/test_accessibility_controller_client.cc",
"accessibility/test_accessibility_controller_client.h",
"accessibility/test_accessibility_delegate.cc",
"accessibility/test_accessibility_delegate.h",
"app_list/test_app_list_presenter_impl.cc",
......
......@@ -19,7 +19,6 @@
#include "ash/media_controller.h"
#include "ash/multi_profile_uma.h"
#include "ash/new_window_controller.h"
#include "ash/public/cpp/accessibility_types.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/root_window_controller.h"
#include "ash/rotator/window_rotation.h"
......@@ -1514,8 +1513,8 @@ AcceleratorController::GetAcceleratorProcessingRestriction(int action) const {
}
if (Shell::Get()->mru_window_tracker()->BuildMruWindowList().empty() &&
actions_needing_window_.find(action) != actions_needing_window_.end()) {
Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
A11Y_ALERT_WINDOW_NEEDED);
Shell::Get()->accessibility_controller()->TriggerAccessibilityAlert(
mojom::AccessibilityAlert::WINDOW_NEEDED);
return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
}
return RESTRICTION_NONE;
......
......@@ -5,10 +5,11 @@
#include "ash/accelerators/accelerator_controller.h"
#include "ash/accelerators/accelerator_table.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/ime/ime_controller.h"
#include "ash/media_controller.h"
#include "ash/public/cpp/accessibility_types.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/config.h"
#include "ash/public/cpp/shell_window_ids.h"
......@@ -1196,13 +1197,19 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
}
TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) {
AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate();
TestAccessibilityControllerClient client;
AccessibilityController* controller =
Shell::Get()->accessibility_controller();
controller->SetClient(client.CreateInterfacePtrAndBind());
for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
controller->TriggerAccessibilityAlert(mojom::AccessibilityAlert::NONE);
controller->FlushMojoForTest();
EXPECT_TRUE(
GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i]));
EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::WINDOW_NEEDED,
client.last_a11y_alert());
}
// Make sure we don't alert if we do have a window.
......@@ -1210,9 +1217,12 @@ TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) {
for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
wm::ActivateWindow(window.get());
delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
controller->TriggerAccessibilityAlert(mojom::AccessibilityAlert::NONE);
controller->FlushMojoForTest();
GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i]);
EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
controller->FlushMojoForTest();
EXPECT_NE(mojom::AccessibilityAlert::WINDOW_NEEDED,
client.last_a11y_alert());
}
// Don't alert if we have a minimized window either.
......@@ -1220,9 +1230,12 @@ TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) {
window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
wm::ActivateWindow(window.get());
GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE);
delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
controller->TriggerAccessibilityAlert(mojom::AccessibilityAlert::NONE);
controller->FlushMojoForTest();
GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i]);
EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
controller->FlushMojoForTest();
EXPECT_NE(mojom::AccessibilityAlert::WINDOW_NEEDED,
client.last_a11y_alert());
}
}
......
......@@ -41,7 +41,7 @@ PrefService* GetActivePrefService() {
AccessibilityController::AccessibilityController(
service_manager::Connector* connector)
: connector_(connector) {
: connector_(connector), binding_(this) {
Shell::Get()->session_controller()->AddObserver(this);
}
......@@ -73,6 +73,11 @@ void AccessibilityController::RegisterProfilePrefs(PrefRegistrySimple* registry,
registry->RegisterForeignPref(prefs::kAccessibilityScreenMagnifierEnabled);
}
void AccessibilityController::BindRequest(
mojom::AccessibilityControllerRequest request) {
binding_.Bind(std::move(request));
}
void AccessibilityController::SetLargeCursorEnabled(bool enabled) {
PrefService* prefs = GetActivePrefService();
if (!prefs)
......@@ -97,6 +102,17 @@ bool AccessibilityController::IsHighContrastEnabled() const {
return high_contrast_enabled_;
}
void AccessibilityController::TriggerAccessibilityAlert(
mojom::AccessibilityAlert alert) {
if (client_)
client_->TriggerAccessibilityAlert(alert);
}
void AccessibilityController::SetClient(
mojom::AccessibilityControllerClientPtr client) {
client_ = std::move(client);
}
void AccessibilityController::OnSigninScreenPrefServiceInitialized(
PrefService* prefs) {
ObservePrefs(prefs);
......@@ -107,6 +123,10 @@ void AccessibilityController::OnActiveUserPrefServiceChanged(
ObservePrefs(prefs);
}
void AccessibilityController::FlushMojoForTest() {
client_.FlushForTesting();
}
void AccessibilityController::ObservePrefs(PrefService* prefs) {
// Watch for pref updates from webui settings and policy.
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
......
......@@ -9,8 +9,10 @@
#include "ash/ash_constants.h"
#include "ash/ash_export.h"
#include "ash/public/interfaces/accessibility_controller.mojom.h"
#include "ash/session/session_observer.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding.h"
class PrefChangeRegistrar;
class PrefRegistrySimple;
......@@ -25,7 +27,9 @@ namespace ash {
// The controller for accessibility features in ash. Features can be enabled
// in chrome's webui settings or the system tray menu (see TrayAccessibility).
// Uses preferences to communicate with chrome to support mash.
class ASH_EXPORT AccessibilityController : public SessionObserver {
class ASH_EXPORT AccessibilityController
: public mojom::AccessibilityController,
public SessionObserver {
public:
explicit AccessibilityController(service_manager::Connector* connector);
~AccessibilityController() override;
......@@ -33,16 +37,28 @@ class ASH_EXPORT AccessibilityController : public SessionObserver {
// See Shell::RegisterProfilePrefs().
static void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test);
// Binds the mojom::AccessibilityController interface to this object.
void BindRequest(mojom::AccessibilityControllerRequest request);
void SetLargeCursorEnabled(bool enabled);
bool IsLargeCursorEnabled() const;
void SetHighContrastEnabled(bool enabled);
bool IsHighContrastEnabled() const;
// Triggers an accessibility alert to give the user feedback.
void TriggerAccessibilityAlert(mojom::AccessibilityAlert alert);
// mojom::AccessibilityController:
void SetClient(mojom::AccessibilityControllerClientPtr client) override;
// SessionObserver:
void OnSigninScreenPrefServiceInitialized(PrefService* prefs) override;
void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
// Test helpers:
void FlushMojoForTest();
private:
// Observes either the signin screen prefs or active user prefs and loads
// initial settings.
......@@ -54,6 +70,12 @@ class ASH_EXPORT AccessibilityController : public SessionObserver {
service_manager::Connector* connector_ = nullptr;
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
// Binding for mojom::AccessibilityController interface.
mojo::Binding<mojom::AccessibilityController> binding_;
// Client interface in chrome browser.
mojom::AccessibilityControllerClientPtr client_;
bool large_cursor_enabled_ = false;
int large_cursor_size_in_dip_ = kDefaultLargeCursorSize;
bool high_contrast_enabled_ = false;
......
......@@ -110,12 +110,6 @@ class ASH_EXPORT AccessibilityDelegate {
// is not saved, return a negative value.
virtual double GetSavedScreenMagnifierScale() = 0;
// Triggers an accessibility alert to give the user feedback.
virtual void TriggerAccessibilityAlert(AccessibilityAlert alert) = 0;
// Gets the last accessibility alert that was triggered.
virtual AccessibilityAlert GetLastAccessibilityAlert() = 0;
// Called when we first detect two fingers are held down, which can be
// used to toggle spoken feedback on some touch-only devices.
virtual void OnTwoFingerTouchStart() {}
......
......@@ -133,15 +133,6 @@ double DefaultAccessibilityDelegate::GetSavedScreenMagnifierScale() {
return std::numeric_limits<double>::min();
}
void DefaultAccessibilityDelegate::TriggerAccessibilityAlert(
AccessibilityAlert alert) {
accessibility_alert_ = alert;
}
AccessibilityAlert DefaultAccessibilityDelegate::GetLastAccessibilityAlert() {
return accessibility_alert_;
}
bool DefaultAccessibilityDelegate::ShouldToggleSpokenFeedbackViaTouch() {
return false;
}
......
......@@ -47,8 +47,6 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
AccessibilityNotificationVisibility notify) override;
void SaveScreenMagnifierScale(double scale) override;
double GetSavedScreenMagnifierScale() override;
void TriggerAccessibilityAlert(AccessibilityAlert alert) override;
AccessibilityAlert GetLastAccessibilityAlert() override;
bool ShouldToggleSpokenFeedbackViaTouch() override;
void PlaySpokenFeedbackToggleCountdown(int tick_count) override;
void PlayEarcon(int sound_key) override;
......@@ -68,7 +66,6 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
bool tap_dragging_enabled_ = false;
bool select_to_speak_enabled_ = false;
bool switch_access_enabled_ = false;
AccessibilityAlert accessibility_alert_ = A11Y_ALERT_NONE;
DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityDelegate);
};
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/accessibility/test_accessibility_controller_client.h"
namespace ash {
TestAccessibilityControllerClient::TestAccessibilityControllerClient()
: binding_(this) {}
TestAccessibilityControllerClient::~TestAccessibilityControllerClient() =
default;
mojom::AccessibilityControllerClientPtr
TestAccessibilityControllerClient::CreateInterfacePtrAndBind() {
mojom::AccessibilityControllerClientPtr ptr;
binding_.Bind(mojo::MakeRequest(&ptr));
return ptr;
}
void TestAccessibilityControllerClient::TriggerAccessibilityAlert(
mojom::AccessibilityAlert alert) {
last_a11y_alert_ = alert;
}
} // namespace ash
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_
#define ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_
#include "ash/public/interfaces/accessibility_controller.mojom.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace ash {
// Implement AccessibilityControllerClient mojo interface to simulate chrome
// behavior in tests. This breaks the ash/chrome dependency to allow testing ash
// code in isolation.
class TestAccessibilityControllerClient
: public mojom::AccessibilityControllerClient {
public:
TestAccessibilityControllerClient();
~TestAccessibilityControllerClient() override;
mojom::AccessibilityControllerClientPtr CreateInterfacePtrAndBind();
// mojom::AccessibilityControllerClient:
void TriggerAccessibilityAlert(mojom::AccessibilityAlert alert) override;
mojom::AccessibilityAlert last_a11y_alert() const { return last_a11y_alert_; }
private:
mojom::AccessibilityAlert last_a11y_alert_ = mojom::AccessibilityAlert::NONE;
mojo::Binding<mojom::AccessibilityControllerClient> binding_;
DISALLOW_COPY_AND_ASSIGN(TestAccessibilityControllerClient);
};
} // namespace ash
#endif // ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_
......@@ -7,6 +7,7 @@
#include <utility>
#include "ash/accelerators/accelerator_controller.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/cast_config_controller.h"
#include "ash/display/ash_display_controller.h"
#include "ash/highlighter/highlighter_controller.h"
......@@ -47,6 +48,11 @@ void BindAcceleratorControllerRequestOnMainThread(
Shell::Get()->accelerator_controller()->BindRequest(std::move(request));
}
void BindAccessibilityControllerRequestOnMainThread(
mojom::AccessibilityControllerRequest request) {
Shell::Get()->accessibility_controller()->BindRequest(std::move(request));
}
void BindAppListRequestOnMainThread(
app_list::mojom::AppListRequest request) {
Shell::Get()->app_list()->BindRequest(std::move(request));
......@@ -154,6 +160,9 @@ void RegisterInterfaces(
registry->AddInterface(
base::Bind(&BindAcceleratorControllerRequestOnMainThread),
main_thread_task_runner);
registry->AddInterface(
base::Bind(&BindAccessibilityControllerRequestOnMainThread),
main_thread_task_runner);
registry->AddInterface(base::Bind(&BindAppListRequestOnMainThread),
main_thread_task_runner);
registry->AddInterface(
......
......@@ -10,6 +10,7 @@
"system_ui": [
"app_list::mojom::AppList",
"ash::mojom::AcceleratorController",
"ash::mojom::AccessibilityController",
"ash::mojom::AshMessageCenterController",
"ash::mojom::CastConfig",
"ash::mojom::HighlighterController",
......
......@@ -12,16 +12,6 @@ enum AccessibilityNotificationVisibility {
A11Y_NOTIFICATION_SHOW,
};
enum AccessibilityAlert {
A11Y_ALERT_NONE,
A11Y_ALERT_CAPS_ON,
A11Y_ALERT_CAPS_OFF,
A11Y_ALERT_SCREEN_ON,
A11Y_ALERT_SCREEN_OFF,
A11Y_ALERT_WINDOW_NEEDED,
A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED
};
// Note: Do not change these values; UMA and prefs depend on them.
enum MagnifierType {
MAGNIFIER_DISABLED = 0, // Used by enterprise policy.
......
......@@ -13,6 +13,7 @@ mojom("interfaces_internal") {
sources = [
"accelerator_controller.mojom",
"accessibility_controller.mojom",
"ash_display_controller.mojom",
"ash_message_center_controller.mojom",
"cast_config.mojom",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.mojom;
enum AccessibilityAlert {
// Default value, indicates no accessibility alert.
NONE,
// Caps Lock is On.
CAPS_ON,
// Caps Lock is Off.
CAPS_OFF,
// Screen turned on by tablet power button.
SCREEN_ON,
// Screen turned off by tablet power button.
SCREEN_OFF,
// Alerted when no window avaiable and accelerators operated which requires at
// least one window.
WINDOW_NEEDED,
// Entered overview mode.
WINDOW_OVERVIEW_MODE_ENTERED
};
// Interface for ash client (e.g. Chrome) to control and query accessibility
// features.
interface AccessibilityController {
// Sets the client interface.
SetClient(AccessibilityControllerClient client);
};
// Interface for ash to request accessibility service from its client (e.g.
// Chrome).
interface AccessibilityControllerClient {
// Triggers an accessibility alert to give the user feedback.
TriggerAccessibilityAlert(AccessibilityAlert alert);
};
......@@ -4,7 +4,7 @@
#include "ash/system/power/power_button_display_controller.h"
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/media_controller.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/shell.h"
......@@ -69,8 +69,9 @@ void PowerButtonDisplayController::SetDisplayForcedOff(bool forced_off) {
Shell::Get()->media_controller()->SuspendMediaSessions();
// Send an a11y alert.
Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
forced_off ? A11Y_ALERT_SCREEN_OFF : A11Y_ALERT_SCREEN_ON);
Shell::Get()->accessibility_controller()->TriggerAccessibilityAlert(
forced_off ? mojom::AccessibilityAlert::SCREEN_OFF
: mojom::AccessibilityAlert::SCREEN_ON);
}
void PowerButtonDisplayController::PowerManagerRestarted() {
......
......@@ -4,6 +4,8 @@
#include "ash/system/power/tablet_power_button_controller.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/media_controller.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/session/session_controller.h"
......@@ -637,6 +639,26 @@ TEST_F(TabletPowerButtonControllerTest,
EXPECT_TRUE(power_manager_client_->backlights_forced_off());
}
// Tests that a11y alert is sent on tablet power button induced screen state
// change.
TEST_F(TabletPowerButtonControllerTest, A11yAlert) {
TestAccessibilityControllerClient client;
AccessibilityController* controller =
Shell::Get()->accessibility_controller();
controller->SetClient(client.CreateInterfacePtrAndBind());
PressPowerButton();
ReleasePowerButton();
power_manager_client_->SendBrightnessChanged(0, true);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::SCREEN_OFF, client.last_a11y_alert());
PressPowerButton();
power_manager_client_->SendBrightnessChanged(kNonZeroBrightness, true);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::SCREEN_ON, client.last_a11y_alert());
ReleasePowerButton();
}
using NoTabletModePowerButtonControllerTest = NoTabletModePowerButtonTestBase;
// Tests that tablet power button behavior should not be enabled on the device
......
......@@ -6,7 +6,7 @@
#include <memory>
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/ime/ime_controller.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/config.h"
......@@ -222,8 +222,9 @@ void TrayCapsLock::OnCapsLockChanged(bool enabled) {
caps_lock_enabled_ = enabled;
// Send an a11y alert.
Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
enabled ? A11Y_ALERT_CAPS_ON : A11Y_ALERT_CAPS_OFF);
Shell::Get()->accessibility_controller()->TriggerAccessibilityAlert(
enabled ? mojom::AccessibilityAlert::CAPS_ON
: mojom::AccessibilityAlert::CAPS_OFF);
if (tray_view())
tray_view()->SetVisible(caps_lock_enabled_);
......
......@@ -4,14 +4,34 @@
#include "ash/system/tray_caps_lock.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_test_api.h"
#include "ash/system/web_notification/web_notification_tray.h"
#include "ash/test/ash_test_base.h"
namespace ash {
namespace {
using TrayCapsLockTest = AshTestBase;
class TrayCapsLockTest : public AshTestBase {
public:
TrayCapsLockTest() = default;
~TrayCapsLockTest() override = default;
void SetUp() override {
AshTestBase::SetUp();
WebNotificationTray::DisableAnimationsForTest(true);
}
void TearDown() override {
WebNotificationTray::DisableAnimationsForTest(false);
AshTestBase::TearDown();
}
private:
DISALLOW_COPY_AND_ASSIGN(TrayCapsLockTest);
};
// Tests that the icon becomes visible when the tray controller toggles it.
TEST_F(TrayCapsLockTest, Visibility) {
......@@ -30,5 +50,25 @@ TEST_F(TrayCapsLockTest, Visibility) {
EXPECT_FALSE(caps_lock->tray_view()->visible());
}
} // namespace
// Tests that a11y alert is sent on toggling caps lock.
TEST_F(TrayCapsLockTest, A11yAlert) {
SystemTray* tray = GetPrimarySystemTray();
TrayCapsLock* caps_lock = SystemTrayTestApi(tray).tray_caps_lock();
TestAccessibilityControllerClient client;
AccessibilityController* controller =
Shell::Get()->accessibility_controller();
controller->SetClient(client.CreateInterfacePtrAndBind());
// Simulate turning on caps lock.
caps_lock->OnCapsLockChanged(true);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::CAPS_ON, client.last_a11y_alert());
// Simulate turning off caps lock.
caps_lock->OnCapsLockChanged(false);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::CAPS_OFF, client.last_a11y_alert());
}
} // namespace ash
......@@ -11,9 +11,8 @@
#include <utility>
#include <vector>
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/accessibility_types.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/screen_util.h"
#include "ash/shelf/shelf.h"
......@@ -315,8 +314,8 @@ void WindowSelector::Init(const WindowList& windows,
display::Screen::GetScreen()->AddObserver(this);
base::RecordAction(base::UserMetricsAction("WindowSelector_Overview"));
// Send an a11y alert.
Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED);
Shell::Get()->accessibility_controller()->TriggerAccessibilityAlert(
mojom::AccessibilityAlert::WINDOW_OVERVIEW_MODE_ENTERED);
UpdateShelfVisibility();
}
......
......@@ -6,12 +6,12 @@
#include <memory>
#include <vector>
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/app_list/test_app_list_presenter_impl.h"
#include "ash/display/screen_orientation_controller_chromeos.h"
#include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/drag_drop/drag_drop_controller.h"
#include "ash/public/cpp/accessibility_types.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/config.h"
#include "ash/public/cpp/window_properties.h"
......@@ -404,13 +404,17 @@ TEST_F(WindowSelectorTest, OverviewScreenRotation) {
// Tests that an a11y alert is sent on entering overview mode.
TEST_F(WindowSelectorTest, A11yAlertOnOverviewMode) {
gfx::Rect bounds(0, 0, 400, 400);
AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate();
TestAccessibilityControllerClient client;
AccessibilityController* controller =
Shell::Get()->accessibility_controller();
controller->SetClient(client.CreateInterfacePtrAndBind());
std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
EXPECT_NE(delegate->GetLastAccessibilityAlert(),
A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED);
EXPECT_NE(mojom::AccessibilityAlert::WINDOW_OVERVIEW_MODE_ENTERED,
client.last_a11y_alert());
ToggleOverview();
EXPECT_EQ(delegate->GetLastAccessibilityAlert(),
A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED);
controller->FlushMojoForTest();
EXPECT_EQ(mojom::AccessibilityAlert::WINDOW_OVERVIEW_MODE_ENTERED,
client.last_a11y_alert());
}
// Tests that there are no crashes when there is not enough screen space
......
......@@ -1161,6 +1161,8 @@ split_static_library("ui") {
"app_list/search/launcher_search/launcher_s