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 "accessibility_element_operator_proxy.h"
17 #include "hilog_wrapper.h"
18 #include "ipc_types.h"
19 #include "iremote_object.h"
20
21 int g_testElementId = -1;
22 int g_testClearFocus = -1;
23 int g_testOutsideTouch = -1;
24
25 int g_testChannelElementId = -1;
26 int g_testChannelrequestId = -1;
27 int g_testChannelmode = -1;
28
29 namespace OHOS {
30 namespace Accessibility {
AccessibilityElementOperatorProxy(const sptr<IRemoteObject> & impl)31 AccessibilityElementOperatorProxy::AccessibilityElementOperatorProxy(
32 const sptr<IRemoteObject> &impl) : IRemoteProxy<IAccessibilityElementOperator>(impl)
33 {
34 printf("AccessibilityElementOperatorProxymock");
35 }
36
~AccessibilityElementOperatorProxy()37 AccessibilityElementOperatorProxy::~AccessibilityElementOperatorProxy()
38 {
39 }
40
WriteInterfaceToken(MessageParcel & data)41 bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data)
42 {
43 return true;
44 }
45
SearchElementInfoByAccessibilityId(const long elementId,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback,const int mode)46 void AccessibilityElementOperatorProxy::SearchElementInfoByAccessibilityId(const long elementId,
47 const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int mode)
48 {
49 printf("AccessibilityElementOperatorProxymock SearchElementInfoByAccessibilityId");
50 g_testElementId = elementId;
51 g_testChannelElementId = elementId;
52 g_testChannelrequestId = requestId;
53 g_testChannelmode = mode;
54 }
55
SearchElementInfosByText(const long elementId,const std::string & text,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)56 void AccessibilityElementOperatorProxy::SearchElementInfosByText(const long elementId,
57 const std::string &text, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
58 {
59 g_testElementId = elementId;
60 }
61
FindFocusedElementInfo(const long elementId,const int focusType,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)62 void AccessibilityElementOperatorProxy::FindFocusedElementInfo(const long elementId,
63 const int focusType, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
64 {
65 g_testElementId = elementId;
66 }
67
FocusMoveSearch(const long elementId,const int direction,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)68 void AccessibilityElementOperatorProxy::FocusMoveSearch(const long elementId,
69 const int direction, const int requestId, const sptr<IAccessibilityElementOperatorCallback> &callback)
70 {
71 g_testElementId = elementId;
72 }
73
ExecuteAction(const long elementId,const int action,const std::map<std::string,std::string> arguments,const int requestId,const sptr<IAccessibilityElementOperatorCallback> & callback)74 void AccessibilityElementOperatorProxy::ExecuteAction(const long elementId, const int action,
75 const std::map<std::string, std::string> arguments, const int requestId,
76 const sptr<IAccessibilityElementOperatorCallback> &callback)
77 {
78 g_testElementId = elementId;
79 }
80
ClearFocus()81 void AccessibilityElementOperatorProxy::ClearFocus()
82 {
83 g_testClearFocus = 1;
84 }
85
OutsideTouch()86 void AccessibilityElementOperatorProxy::OutsideTouch()
87 {
88 g_testOutsideTouch = 1;
89 }
90 } // namespace Accessibility
91 } // namespace OHOS