• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <gtest/gtest.h>
17 #include <vector>
18 #include "mock_accessible_ability_channel_impl.h"
19 
20 using namespace std;
21 
22 namespace OHOS {
23 namespace Accessibility {
24 const int RECT_ONE = 1;
25 const int RECT_TWO = 2;
26 const int RECT_THREE = 3;
27 const int RECT_FOUR = 4;
SearchElementInfoByAccessibilityId(const int accessibilityWindowId,const long elementId,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback,const int mode)28 bool MockAccessibleAbilityChannel::SearchElementInfoByAccessibilityId(const int accessibilityWindowId,
29     const long elementId, const int requestId,
30     const sptr<IAccessibilityElementOperatorCallback> &callback, const int mode)
31 {
32     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::SearchElementInfoByAccessibilityId start";
33     (void)accessibilityWindowId;
34     (void)elementId;
35     (void)requestId;
36     (void)callback;
37     (void)mode;
38     return true;
39 }
40 
SearchElementInfosByText(const int accessibilityWindowId,const long elementId,const std::string & text,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)41 bool MockAccessibleAbilityChannel::SearchElementInfosByText(const int accessibilityWindowId, const long elementId,
42     const std::string &text, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
43 {
44     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::SearchElementInfosByText start";
45     (void)accessibilityWindowId;
46     (void)elementId;
47     (void)text;
48     (void)requestId;
49     (void)callback;
50     return true;
51 }
52 
FindFocusedElementInfo(const int accessibilityWindowId,const long elementId,const int focusType,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)53 bool MockAccessibleAbilityChannel::FindFocusedElementInfo(const int accessibilityWindowId, const long elementId,
54     const int focusType, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
55 {
56     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::FindFocusedElementInfo start";
57     (void)accessibilityWindowId;
58     (void)elementId;
59     (void)focusType;
60     (void)requestId;
61     (void)callback;
62     return true;
63 }
64 
FocusMoveSearch(const int accessibilityWindowId,const long elementId,const int direction,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)65 bool MockAccessibleAbilityChannel::FocusMoveSearch(const int accessibilityWindowId, const long elementId,
66     const int direction, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
67 {
68     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::FocusMoveSearch start";
69     (void)accessibilityWindowId;
70     (void)elementId;
71     (void)direction;
72     (void)requestId;
73     (void)callback;
74     return true;
75 }
76 
ExecuteAction(const int accessibilityWindowId,const long elementId,const int action,std::map<std::string,std::string> & actionArguments,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)77 bool MockAccessibleAbilityChannel::ExecuteAction(const int accessibilityWindowId, const long elementId,
78     const int action, std::map<std::string, std::string> &actionArguments,
79     const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
80 {
81     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::ExecuteAction start";
82     (void)accessibilityWindowId;
83     (void)elementId;
84     (void)action;
85     (void)actionArguments;
86     (void)requestId;
87     (void)callback;
88     return true;
89 }
90 
GetWindows()91 std::vector<AccessibilityWindowInfo> MockAccessibleAbilityChannel::GetWindows()
92 {
93     vector<AccessibilityWindowInfo> windows;
94     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::GetWindows start";
95     return windows;
96 }
97 
ExecuteCommonAction(const int action)98 bool MockAccessibleAbilityChannel::ExecuteCommonAction(const int action)
99 {
100     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::ExecuteCommonAction start";
101     (void)action;
102     return true;
103 }
104 
SetOnKeyPressEventResult(const bool handled,const int sequence)105 void MockAccessibleAbilityChannel::SetOnKeyPressEventResult(const bool handled, const int sequence)
106 {
107     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::SetOnKeyPressEventResult start";
108     (void)handled;
109     (void)sequence;
110 }
111 
GetDisplayResizeScale(const int displayId)112 float MockAccessibleAbilityChannel::GetDisplayResizeScale(const int displayId)
113 {
114     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::GetDisplayResizeScale start";
115     (void)displayId;
116     return 1.0f;
117 }
118 
GetDisplayResizeCenterX(const int displayId)119 float MockAccessibleAbilityChannel::GetDisplayResizeCenterX(const int displayId)
120 {
121     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::GetDisplayResizeCenterX start";
122     (void)displayId;
123     return 1.0f;
124 }
125 
GetDisplayResizeCenterY(const int displayId)126 float MockAccessibleAbilityChannel::GetDisplayResizeCenterY(const int displayId)
127 {
128     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::GetDisplayResizeCenterY start";
129     (void)displayId;
130     return 1.0f;
131 }
132 
GetDisplayResizeRect(const int displayId)133 Rect MockAccessibleAbilityChannel::GetDisplayResizeRect(const int displayId)
134 {
135     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::GetDisplayResizeRect start";
136     (void)displayId;
137     Rect rect(RECT_ONE,  RECT_TWO,  RECT_THREE,  RECT_FOUR);
138     return rect;
139 }
140 
ResetDisplayResize(const int displayId,const bool animate)141 bool MockAccessibleAbilityChannel::ResetDisplayResize(const int displayId, const bool animate)
142 {
143     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::ResetDisplayResize start";
144     (void)displayId;
145     (void)animate;
146     return true;
147 }
148 
SetDisplayResizeScaleAndCenter(const int displayId,const float scale,const float centerX,const float centerY,const bool animate)149 bool MockAccessibleAbilityChannel::SetDisplayResizeScaleAndCenter(const int displayId,
150     const float scale, const float centerX, const float centerY, const bool animate)
151 {
152     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::SetDisplayResizeScaleAndCenter start";
153     (void)displayId;
154     (void)scale;
155     (void)centerX;
156     (void)centerY;
157     (void)animate;
158     return true;
159 }
160 
SendSimulateGesture(const int requestId,const std::vector<GesturePathDefine> & gestureSteps)161 void MockAccessibleAbilityChannel::SendSimulateGesture(const int requestId,
162     const std::vector<GesturePathDefine> &gestureSteps)
163 {
164     GTEST_LOG_(INFO) << "MockAccessibleAbilityChannel::SendSimulateGesture start";
165     (void)requestId;
166     (void)gestureSteps;
167 }
168 
AsObject()169 sptr<IRemoteObject> MockAccessibleAbilityChannel::AsObject()
170 {
171     sptr<IRemoteObject> object;
172     return object;
173 }
174 } // namespace Accessibility
175 } // namespace OHOS