mock_touch_exploration_controller_delegate.cc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright 2020 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/chromevox/mock_touch_exploration_controller_delegate.h"
  5. namespace ash {
  6. MockTouchExplorationControllerDelegate::
  7. MockTouchExplorationControllerDelegate() = default;
  8. MockTouchExplorationControllerDelegate::
  9. ~MockTouchExplorationControllerDelegate() = default;
  10. void MockTouchExplorationControllerDelegate::SetOutputLevel(int volume) {
  11. volume_changes_.push_back(volume);
  12. }
  13. void MockTouchExplorationControllerDelegate::SilenceSpokenFeedback() {}
  14. void MockTouchExplorationControllerDelegate::PlayVolumeAdjustEarcon() {
  15. ++num_times_adjust_sound_played_;
  16. }
  17. void MockTouchExplorationControllerDelegate::PlayPassthroughEarcon() {
  18. ++num_times_passthrough_played_;
  19. }
  20. void MockTouchExplorationControllerDelegate::PlayLongPressRightClickEarcon() {
  21. ++num_times_long_press_right_click_played_;
  22. }
  23. void MockTouchExplorationControllerDelegate::PlayEnterScreenEarcon() {
  24. ++num_times_enter_screen_played_;
  25. }
  26. void MockTouchExplorationControllerDelegate::PlayTouchTypeEarcon() {
  27. ++num_times_touch_type_sound_played_;
  28. }
  29. void MockTouchExplorationControllerDelegate::HandleAccessibilityGesture(
  30. ax::mojom::Gesture gesture,
  31. gfx::PointF location) {
  32. last_gesture_ = gesture;
  33. if (gesture == ax::mojom::Gesture::kTouchExplore)
  34. touch_explore_points_.push_back(gfx::Point(location.x(), location.y()));
  35. }
  36. const std::vector<float> MockTouchExplorationControllerDelegate::VolumeChanges()
  37. const {
  38. return volume_changes_;
  39. }
  40. size_t MockTouchExplorationControllerDelegate::NumAdjustSounds() const {
  41. return num_times_adjust_sound_played_;
  42. }
  43. size_t MockTouchExplorationControllerDelegate::NumPassthroughSounds() const {
  44. return num_times_passthrough_played_;
  45. }
  46. size_t MockTouchExplorationControllerDelegate::NumLongPressRightClickSounds()
  47. const {
  48. return num_times_long_press_right_click_played_;
  49. }
  50. size_t MockTouchExplorationControllerDelegate::NumEnterScreenSounds() const {
  51. return num_times_enter_screen_played_;
  52. }
  53. size_t MockTouchExplorationControllerDelegate::NumTouchTypeSounds() const {
  54. return num_times_touch_type_sound_played_;
  55. }
  56. ax::mojom::Gesture MockTouchExplorationControllerDelegate::GetLastGesture()
  57. const {
  58. return last_gesture_;
  59. }
  60. void MockTouchExplorationControllerDelegate::ResetLastGesture() {
  61. last_gesture_ = ax::mojom::Gesture::kNone;
  62. }
  63. std::vector<gfx::Point>&
  64. MockTouchExplorationControllerDelegate::GetTouchExplorePoints() {
  65. return touch_explore_points_;
  66. }
  67. void MockTouchExplorationControllerDelegate::ResetCountersToZero() {
  68. num_times_adjust_sound_played_ = 0;
  69. num_times_passthrough_played_ = 0;
  70. num_times_long_press_right_click_played_ = 0;
  71. num_times_enter_screen_played_ = 0;
  72. num_times_touch_type_sound_played_ = 0;
  73. }
  74. } // namespace ash