1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MOCK_ACCESSIBLE_ABILITY_CHANNEL_IMPL_H 17 #define MOCK_ACCESSIBLE_ABILITY_CHANNEL_IMPL_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 #include "accessibility_element_info.h" 24 #include "accessibility_element_operator_callback_interface.h" 25 #include "accessibility_window_info.h" 26 #include "accessible_ability_channel_interface.h" 27 #include "gesture_simulation.h" 28 #include "iremote_broker.h" 29 #include "refbase.h" 30 31 namespace OHOS { 32 namespace Accessibility { 33 class MockAccessibleAbilityChannel : public IAccessibleAbilityChannel { 34 public: MockAccessibleAbilityChannel()35 MockAccessibleAbilityChannel() {} ~MockAccessibleAbilityChannel()36 virtual ~MockAccessibleAbilityChannel() {} 37 bool SearchElementInfoByAccessibilityId(const int accessibilityWindowId, 38 const long elementId, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, 39 const int mode) override; 40 41 bool SearchElementInfosByText(const int accessibilityWindowId, const long elementId, 42 const std::string &text, const int requestId, 43 const sptr<IAccessibilityElementOperatorCallback> &callback) override; 44 45 bool FindFocusedElementInfo(const int accessibilityWindowId, const long elementId, 46 const int focusType, const int requestId, 47 const sptr<IAccessibilityElementOperatorCallback> &callback) override; 48 49 bool FocusMoveSearch(const int accessibilityWindowId, const long elementId, 50 const int direction, const int requestId, 51 const sptr<IAccessibilityElementOperatorCallback> &callback) override; 52 53 bool ExecuteAction(const int accessibilityWindowId, const long elementId, const int action, 54 std::map<std::string, std::string> &actionArguments, const int requestId, 55 const sptr<IAccessibilityElementOperatorCallback> &callback) override; 56 57 std::vector<AccessibilityWindowInfo> GetWindows() override; 58 59 bool ExecuteCommonAction(const int action) override; 60 61 void SetOnKeyPressEventResult(const bool handled, const int sequence) override; 62 63 float GetDisplayResizeScale(const int displayId) override; 64 65 float GetDisplayResizeCenterX(const int displayId) override; 66 67 float GetDisplayResizeCenterY(const int displayId) override; 68 69 Rect GetDisplayResizeRect(const int displayId) override; 70 71 bool ResetDisplayResize(const int displayId, const bool animate) override; 72 73 bool SetDisplayResizeScaleAndCenter(const int displayId, const float scale, const float centerX, 74 const float centerY, const bool animate) override; 75 76 void SendSimulateGesture(const int requestId, const std::vector<GesturePathDefine> &gestureSteps) override; 77 78 sptr<IRemoteObject> AsObject() override; 79 }; 80 } // namespace Accessibility 81 } // namespace OHOS 82 #endif // MOCK_ACCESSIBLE_ABILITY_CHANNEL_IMPL_H