test_accessibility_controller_client.cc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/accessibility/test_accessibility_controller_client.h"
  5. #include <utility>
  6. #include "ash/public/cpp/accessibility_controller.h"
  7. #include "base/time/time.h"
  8. #include "ui/gfx/geometry/point_f.h"
  9. namespace ash {
  10. constexpr base::TimeDelta
  11. TestAccessibilityControllerClient::kShutdownSoundDuration;
  12. TestAccessibilityControllerClient::TestAccessibilityControllerClient() {
  13. AccessibilityController::Get()->SetClient(this);
  14. }
  15. TestAccessibilityControllerClient::~TestAccessibilityControllerClient() {
  16. AccessibilityController::Get()->SetClient(nullptr);
  17. }
  18. void TestAccessibilityControllerClient::TriggerAccessibilityAlert(
  19. AccessibilityAlert alert) {
  20. last_a11y_alert_ = alert;
  21. }
  22. void TestAccessibilityControllerClient::TriggerAccessibilityAlertWithMessage(
  23. const std::string& message) {
  24. last_alert_message_ = message;
  25. }
  26. void TestAccessibilityControllerClient::PlayEarcon(Sound sound_key) {
  27. sound_key_ = sound_key;
  28. }
  29. base::TimeDelta TestAccessibilityControllerClient::PlayShutdownSound() {
  30. return kShutdownSoundDuration;
  31. }
  32. void TestAccessibilityControllerClient::HandleAccessibilityGesture(
  33. ax::mojom::Gesture gesture,
  34. gfx::PointF location) {
  35. last_a11y_gesture_ = gesture;
  36. }
  37. bool TestAccessibilityControllerClient::ToggleDictation() {
  38. is_dictation_active_ = !is_dictation_active_;
  39. return is_dictation_active_;
  40. }
  41. void TestAccessibilityControllerClient::SilenceSpokenFeedback() {}
  42. void TestAccessibilityControllerClient::OnTwoFingerTouchStart() {}
  43. void TestAccessibilityControllerClient::OnTwoFingerTouchStop() {}
  44. bool TestAccessibilityControllerClient::ShouldToggleSpokenFeedbackViaTouch()
  45. const {
  46. return true;
  47. }
  48. void TestAccessibilityControllerClient::PlaySpokenFeedbackToggleCountdown(
  49. int tick_count) {}
  50. void TestAccessibilityControllerClient::RequestSelectToSpeakStateChange() {
  51. ++select_to_speak_state_change_requests_;
  52. }
  53. void TestAccessibilityControllerClient::
  54. RequestAutoclickScrollableBoundsForPoint(gfx::Point& point_in_screen) {}
  55. void TestAccessibilityControllerClient::MagnifierBoundsChanged(
  56. const gfx::Rect& bounds_in_screen) {}
  57. void TestAccessibilityControllerClient::OnSwitchAccessDisabled() {}
  58. void TestAccessibilityControllerClient::OnSelectToSpeakPanelAction(
  59. SelectToSpeakPanelAction action,
  60. double value) {
  61. last_select_to_speak_panel_action_ = action;
  62. last_select_to_speak_panel_action_value_ = value;
  63. }
  64. void TestAccessibilityControllerClient::SetA11yOverrideWindow(
  65. aura::Window* a11y_override_window) {}
  66. absl::optional<Sound>
  67. TestAccessibilityControllerClient::GetPlayedEarconAndReset() {
  68. return std::exchange(sound_key_, absl::nullopt);
  69. }
  70. } // namespace ash