blob: e1ff73f0c70740e1da638a2df3bf2063dcc8b1b6 [file] [log] [blame]
Qiang Xu0133ccb2017-11-13 23:32:061// 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 Wassermand13e95a2019-06-28 23:29:488#include "ash/public/cpp/accessibility_controller_client.h"
9#include "ash/public/cpp/accessibility_controller_enums.h"
Qiang Xu0133ccb2017-11-13 23:32:0610#include "base/macros.h"
Qiang Xuc4b05752018-02-13 20:10:2811#include "ui/accessibility/ax_enums.mojom.h"
Qiang Xu0133ccb2017-11-13 23:32:0612
13namespace 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 Wassermand13e95a2019-06-28 23:29:4818class TestAccessibilityControllerClient : public AccessibilityControllerClient {
Qiang Xu0133ccb2017-11-13 23:32:0619 public:
20 TestAccessibilityControllerClient();
Mike Wassermand13e95a2019-06-28 23:29:4821 ~TestAccessibilityControllerClient();
Qiang Xu0133ccb2017-11-13 23:32:0622
Qiang Xu89af823e2017-12-05 04:04:4723 static constexpr base::TimeDelta kShutdownSoundDuration =
24 base::TimeDelta::FromMilliseconds(1000);
25
Min Chenedffb5272019-07-25 23:53:1826 // AccessibilityControllerClient:
Mike Wassermand13e95a2019-06-28 23:29:4827 void TriggerAccessibilityAlert(AccessibilityAlert alert) override;
Min Chenedffb5272019-07-25 23:53:1828 void TriggerAccessibilityAlertWithMessage(
29 const std::string& message) override;
Qiang Xu89af823e2017-12-05 04:04:4730 void PlayEarcon(int32_t sound_key) override;
Mike Wassermand13e95a2019-06-28 23:29:4831 base::TimeDelta PlayShutdownSound() override;
Qiang Xuc4b05752018-02-13 20:10:2832 void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override;
Mike Wassermand13e95a2019-06-28 23:29:4833 bool ToggleDictation() override;
Qiang Xud9f289a2018-02-21 00:31:2434 void SilenceSpokenFeedback() override;
35 void OnTwoFingerTouchStart() override;
36 void OnTwoFingerTouchStop() override;
Mike Wassermand13e95a2019-06-28 23:29:4837 bool ShouldToggleSpokenFeedbackViaTouch() const override;
Qiang Xuc1b3e7ea2018-02-12 19:57:3838 void PlaySpokenFeedbackToggleCountdown(int tick_count) override;
Katie D30e08412018-05-02 17:24:2239 void RequestSelectToSpeakStateChange() override;
Katie Db16cab02019-07-08 23:36:0840 void RequestAutoclickScrollableBoundsForPoint(
41 gfx::Point& point_in_screen) override;
Qiang Xu89af823e2017-12-05 04:04:4742
43 int32_t GetPlayedEarconAndReset();
Qiang Xu0133ccb2017-11-13 23:32:0644
Mike Wassermand13e95a2019-06-28 23:29:4845 AccessibilityAlert last_a11y_alert() const { return last_a11y_alert_; }
Qiang Xuc4b05752018-02-13 20:10:2846 ax::mojom::Gesture last_a11y_gesture() const { return last_a11y_gesture_; }
Katie D2dd9ae12018-05-03 19:02:1647 int select_to_speak_change_change_requests() const {
48 return select_to_speak_state_change_requests_;
49 }
Qiang Xu0133ccb2017-11-13 23:32:0650
51 private:
Mike Wassermand13e95a2019-06-28 23:29:4852 AccessibilityAlert last_a11y_alert_ = AccessibilityAlert::NONE;
Qiang Xu0133ccb2017-11-13 23:32:0653
Qiang Xu89af823e2017-12-05 04:04:4754 int32_t sound_key_ = -1;
Zach Helfinsteinbbb6bad2018-05-02 18:21:5155 bool is_dictation_active_ = false;
Qiang Xu89af823e2017-12-05 04:04:4756
Qiang Xuc4b05752018-02-13 20:10:2857 ax::mojom::Gesture last_a11y_gesture_ = ax::mojom::Gesture::kNone;
Qiang Xu9e12fa762017-12-19 03:27:4958
Katie D2dd9ae12018-05-03 19:02:1659 int select_to_speak_state_change_requests_ = 0;
60
Qiang Xu0133ccb2017-11-13 23:32:0661 DISALLOW_COPY_AND_ASSIGN(TestAccessibilityControllerClient);
62};
63
64} // namespace ash
65
66#endif // ASH_ACCESSIBILITY_TEST_ACCESSIBILITY_CONTROLLER_CLEINT_H_