Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 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 | |
| 5 | #ifndef ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_ |
| 6 | #define ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_ |
| 7 | |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 8 | #include "ash/public/cpp/accessibility_controller_client.h" |
| 9 | #include "ash/public/cpp/accessibility_controller_enums.h" |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 10 | #include "base/macros.h" |
Qiang Xu | c4b0575 | 2018-02-13 20:10:28 | [diff] [blame] | 11 | #include "ui/accessibility/ax_enums.mojom.h" |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 12 | |
| 13 | namespace ash { |
| 14 | |
| 15 | // Implement AccessibilityControllerClient mojo interface to simulate chrome |
| 16 | // behavior in tests. This breaks the ash/chrome dependency to allow testing ash |
| 17 | // code in isolation. |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 18 | class TestAccessibilityControllerClient : public AccessibilityControllerClient { |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 19 | public: |
| 20 | TestAccessibilityControllerClient(); |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 21 | ~TestAccessibilityControllerClient(); |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 22 | |
Qiang Xu | 89af823e | 2017-12-05 04:04:47 | [diff] [blame] | 23 | static constexpr base::TimeDelta kShutdownSoundDuration = |
| 24 | base::TimeDelta::FromMilliseconds(1000); |
| 25 | |
Min Chen | edffb527 | 2019-07-25 23:53:18 | [diff] [blame] | 26 | // AccessibilityControllerClient: |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 27 | void TriggerAccessibilityAlert(AccessibilityAlert alert) override; |
Min Chen | edffb527 | 2019-07-25 23:53:18 | [diff] [blame] | 28 | void TriggerAccessibilityAlertWithMessage( |
| 29 | const std::string& message) override; |
Qiang Xu | 89af823e | 2017-12-05 04:04:47 | [diff] [blame] | 30 | void PlayEarcon(int32_t sound_key) override; |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 31 | base::TimeDelta PlayShutdownSound() override; |
Qiang Xu | c4b0575 | 2018-02-13 20:10:28 | [diff] [blame] | 32 | void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override; |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 33 | bool ToggleDictation() override; |
Qiang Xu | d9f289a | 2018-02-21 00:31:24 | [diff] [blame] | 34 | void SilenceSpokenFeedback() override; |
| 35 | void OnTwoFingerTouchStart() override; |
| 36 | void OnTwoFingerTouchStop() override; |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 37 | bool ShouldToggleSpokenFeedbackViaTouch() const override; |
Qiang Xu | c1b3e7ea | 2018-02-12 19:57:38 | [diff] [blame] | 38 | void PlaySpokenFeedbackToggleCountdown(int tick_count) override; |
Katie D | 30e0841 | 2018-05-02 17:24:22 | [diff] [blame] | 39 | void RequestSelectToSpeakStateChange() override; |
Katie D | b16cab0 | 2019-07-08 23:36:08 | [diff] [blame] | 40 | void RequestAutoclickScrollableBoundsForPoint( |
| 41 | gfx::Point& point_in_screen) override; |
Qiang Xu | 89af823e | 2017-12-05 04:04:47 | [diff] [blame] | 42 | |
| 43 | int32_t GetPlayedEarconAndReset(); |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 44 | |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 45 | AccessibilityAlert last_a11y_alert() const { return last_a11y_alert_; } |
Qiang Xu | c4b0575 | 2018-02-13 20:10:28 | [diff] [blame] | 46 | ax::mojom::Gesture last_a11y_gesture() const { return last_a11y_gesture_; } |
Katie D | 2dd9ae1 | 2018-05-03 19:02:16 | [diff] [blame] | 47 | int select_to_speak_change_change_requests() const { |
| 48 | return select_to_speak_state_change_requests_; |
| 49 | } |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 50 | |
| 51 | private: |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 52 | AccessibilityAlert last_a11y_alert_ = AccessibilityAlert::NONE; |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 53 | |
Qiang Xu | 89af823e | 2017-12-05 04:04:47 | [diff] [blame] | 54 | int32_t sound_key_ = -1; |
Zach Helfinstein | bbb6bad | 2018-05-02 18:21:51 | [diff] [blame] | 55 | bool is_dictation_active_ = false; |
Qiang Xu | 89af823e | 2017-12-05 04:04:47 | [diff] [blame] | 56 | |
Qiang Xu | c4b0575 | 2018-02-13 20:10:28 | [diff] [blame] | 57 | ax::mojom::Gesture last_a11y_gesture_ = ax::mojom::Gesture::kNone; |
Qiang Xu | 9e12fa76 | 2017-12-19 03:27:49 | [diff] [blame] | 58 | |
Katie D | 2dd9ae1 | 2018-05-03 19:02:16 | [diff] [blame] | 59 | int select_to_speak_state_change_requests_ = 0; |
| 60 | |
Qiang Xu | 0133ccb | 2017-11-13 23:32:06 | [diff] [blame] | 61 | DISALLOW_COPY_AND_ASSIGN(TestAccessibilityControllerClient); |
| 62 | }; |
| 63 | |
| 64 | } // namespace ash |
| 65 | |
| 66 | #endif // ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_ |