• 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 "accessible_ability_channel_client.h"
18 #include "mock_accessible_ability_channel_proxy.h"
19 #include "mock_accessible_ability_channel_stub.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace Accessibility {
26 namespace {
27     const std::string TEST = "test";
28     constexpr int32_t SEQUENCE = 1;
29     constexpr int32_t ACCESSIBILITY_WINDOW_ID = 1;
30     constexpr int32_t ELEMENT_ID = 1;
31     constexpr int32_t MODE = 1;
32     constexpr int32_t CHANNEL_ID = 1;
33 } // namespace
34 
35 class AccessibleAbilityChannelClientTest : public ::testing::Test {
36 public:
AccessibleAbilityChannelClientTest()37     AccessibleAbilityChannelClientTest()
38     {}
~AccessibleAbilityChannelClientTest()39     ~AccessibleAbilityChannelClientTest()
40     {}
41 
42     sptr<MockAccessibleAbilityChannelStub> stub_ = nullptr;
43     sptr<IAccessibleAbilityChannel> channel_ = nullptr;
44     std::shared_ptr<AccessibleAbilityChannelClient> instance_ = nullptr;
45 
SetUpTestCase()46     static void SetUpTestCase()
47     {
48         GTEST_LOG_(INFO) << "AccessibleAbilityChannelClientTest Start";
49     }
TearDownTestCase()50     static void TearDownTestCase()
51     {
52         GTEST_LOG_(INFO) << "AccessibleAbilityChannelClientTest End";
53     }
SetUp()54     void SetUp()
55     {
56         GTEST_LOG_(INFO) << "AccessibleAbilityChannelClientTest SetUp()";
57         stub_ = new MockAccessibleAbilityChannelStub();
58         ASSERT_TRUE(stub_);
59         channel_ = iface_cast<IAccessibleAbilityChannel>(stub_);
60         ASSERT_TRUE(channel_);
61         instance_ = std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, channel_);
62         ASSERT_TRUE(instance_);
63     };
TearDown()64     void TearDown()
65     {
66         GTEST_LOG_(INFO) << "AccessibleAbilityChannelClientTest TearDown()";
67         stub_ = nullptr;
68         channel_ = nullptr;
69         instance_ = nullptr;
70     }
71 };
72 
73 /**
74  * @tc.number: GetRemote_001
75  * @tc.name: GetRemote
76  * @tc.desc: Test function GetRemote
77  */
78 HWTEST_F(AccessibleAbilityChannelClientTest, GetRemote_001, TestSize.Level1)
79 {
80     GTEST_LOG_(INFO) << "GetRemote_001 start";
81     EXPECT_TRUE(instance_->GetRemote());
82     GTEST_LOG_(INFO) << "GetRemote_001 end";
83 }
84 
85 /**
86  * @tc.number: SetOnKeyPressEventResult_001
87  * @tc.name: SetOnKeyPressEventResult
88  * @tc.desc: Test function SetOnKeyPressEventResult
89  */
90 HWTEST_F(AccessibleAbilityChannelClientTest, SetOnKeyPressEventResult, TestSize.Level1)
91 {
92     GTEST_LOG_(INFO) << "SetOnKeyPressEventResult_001 start";
93 
94     if (!instance_) {
95         GTEST_LOG_(INFO) << "Cann't get AccessibleAbilityChannelClient instance_";
96         return;
97     }
98 
99     instance_->SetOnKeyPressEventResult(true, SEQUENCE);
100 
101     GTEST_LOG_(INFO) << "SetOnKeyPressEventResult_001 end";
102 }
103 
104 /**
105  * @tc.number: FindFocusedElementInfo_001
106  * @tc.name: FindFocusedElementInfo
107  * @tc.desc: Test function FindFocusedElementInfo
108  */
109 HWTEST_F(AccessibleAbilityChannelClientTest, FindFocusedElementInfo_001, TestSize.Level1)
110 {
111     GTEST_LOG_(INFO) << "FindFocusedElementInfo_001 start";
112     EXPECT_CALL(*stub_, FindFocusedElementInfo(_, _, _, _, _)).Times(1).WillOnce(Return(RET_ERR_FAILED));
113     AccessibilityElementInfo info {};
114     EXPECT_EQ(instance_->FindFocusedElementInfo(ACCESSIBILITY_WINDOW_ID,
115         ELEMENT_ID, FOCUS_TYPE_INPUT, info), RET_ERR_FAILED);
116     GTEST_LOG_(INFO) << "FindFocusedElementInfo_001 end";
117 }
118 
119 /**
120  * @tc.number: FindFocusedElementInfo_002
121  * @tc.name: FindFocusedElementInfo
122  * @tc.desc: Test function FindFocusedElementInfo
123  */
124 HWTEST_F(AccessibleAbilityChannelClientTest, FindFocusedElementInfo_002, TestSize.Level1)
125 {
126     GTEST_LOG_(INFO) << "FindFocusedElementInfo_002 start";
127     std::shared_ptr<AccessibleAbilityChannelClient> client =
128         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
129     ASSERT_TRUE(client);
130     AccessibilityElementInfo info {};
131     EXPECT_EQ(client->FindFocusedElementInfo(
132         ACCESSIBILITY_WINDOW_ID, ELEMENT_ID, FOCUS_TYPE_INPUT, info), RET_ERR_SAMGR);
133     GTEST_LOG_(INFO) << "FindFocusedElementInfo_002 end";
134 }
135 
136 /**
137  * @tc.number: FindFocusedElementInfo_003
138  * @tc.name: FindFocusedElementInfo
139  * @tc.desc: Test function FindFocusedElementInfo
140  */
141 HWTEST_F(AccessibleAbilityChannelClientTest, FindFocusedElementInfo_003, TestSize.Level1)
142 {
143     GTEST_LOG_(INFO) << "FindFocusedElementInfo_003 start";
144     EXPECT_CALL(*stub_, FindFocusedElementInfo(_, _, _, _, _)).Times(1).WillOnce(Return(RET_OK));
145     AccessibilityElementInfo info {};
146     EXPECT_EQ(instance_->FindFocusedElementInfo(
147         ACCESSIBILITY_WINDOW_ID, ELEMENT_ID, FOCUS_TYPE_INPUT, info), RET_ERR_TIME_OUT);
148     GTEST_LOG_(INFO) << "FindFocusedElementInfo_003 end";
149 }
150 
151 /**
152  * @tc.number: SendSimulateGesture_001
153  * @tc.name: SendSimulateGesture
154  * @tc.desc: Test function SendSimulateGesture
155  */
156 HWTEST_F(AccessibleAbilityChannelClientTest, SendSimulateGesture_001, TestSize.Level1)
157 {
158     GTEST_LOG_(INFO) << "SendSimulateGesture_001 start";
159     EXPECT_CALL(*stub_, SendSimulateGesture(_)).Times(1).WillOnce(Return(RET_OK));
160     std::shared_ptr<AccessibilityGestureInjectPath> gesturePath = std::make_shared<AccessibilityGestureInjectPath>();
161     EXPECT_EQ(instance_->SendSimulateGesture(gesturePath), RET_OK);
162     GTEST_LOG_(INFO) << "SendSimulateGesture_001 end";
163 }
164 
165 /**
166  * @tc.number: SendSimulateGesture_002
167  * @tc.name: SendSimulateGesture
168  * @tc.desc: Test function SendSimulateGesture
169  */
170 HWTEST_F(AccessibleAbilityChannelClientTest, SendSimulateGesture_002, TestSize.Level1)
171 {
172     GTEST_LOG_(INFO) << "SendSimulateGesture_002 start";
173     std::shared_ptr<AccessibleAbilityChannelClient> client =
174         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
175     ASSERT_TRUE(client);
176     std::shared_ptr<AccessibilityGestureInjectPath> gesturePath = std::make_shared<AccessibilityGestureInjectPath>();
177     EXPECT_EQ(client->SendSimulateGesture(gesturePath), RET_ERR_SAMGR);
178     GTEST_LOG_(INFO) << "SendSimulateGesture_002 end";
179 }
180 
181 /**
182  * @tc.number: ExecuteAction_001
183  * @tc.name: ExecuteAction
184  * @tc.desc: Test function ExecuteAction
185  */
186 HWTEST_F(AccessibleAbilityChannelClientTest, ExecuteAction_001, TestSize.Level1)
187 {
188     GTEST_LOG_(INFO) << "ExecuteAction_001 start";
189     EXPECT_CALL(*stub_, ExecuteAction(_, _, _, _, _, _)).Times(1).WillOnce(Return(RET_ERR_FAILED));
190     std::map<std::string, std::string> actionArguments;
191     EXPECT_EQ(instance_->ExecuteAction(ACCESSIBILITY_WINDOW_ID,
192         ELEMENT_ID, ActionType::ACCESSIBILITY_ACTION_SELECT, actionArguments), RET_ERR_FAILED);
193     GTEST_LOG_(INFO) << "ExecuteAction_001 end";
194 }
195 
196 /**
197  * @tc.number: ExecuteAction_002
198  * @tc.name: ExecuteAction
199  * @tc.desc: Test function ExecuteAction
200  */
201 HWTEST_F(AccessibleAbilityChannelClientTest, ExecuteAction_002, TestSize.Level1)
202 {
203     GTEST_LOG_(INFO) << "ExecuteAction_002 start";
204     std::shared_ptr<AccessibleAbilityChannelClient> client =
205         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
206     ASSERT_TRUE(client);
207     std::map<std::string, std::string> actionArguments;
208     EXPECT_EQ(client->ExecuteAction(ACCESSIBILITY_WINDOW_ID,
209         ELEMENT_ID, ActionType::ACCESSIBILITY_ACTION_SELECT, actionArguments), RET_ERR_SAMGR);
210     GTEST_LOG_(INFO) << "ExecuteAction_002 end";
211 }
212 
213 /**
214  * @tc.number: ExecuteAction_003
215  * @tc.name: ExecuteAction
216  * @tc.desc: Test function ExecuteAction
217  */
218 HWTEST_F(AccessibleAbilityChannelClientTest, ExecuteAction_003, TestSize.Level1)
219 {
220     GTEST_LOG_(INFO) << "ExecuteAction_003 start";
221     EXPECT_CALL(*stub_, ExecuteAction(_, _, _, _, _, _)).Times(1).WillOnce(Return(RET_OK));
222     std::map<std::string, std::string> actionArguments;
223     EXPECT_EQ(instance_->ExecuteAction(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID,
224         ActionType::ACCESSIBILITY_ACTION_SELECT, actionArguments), RET_ERR_TIME_OUT);
225     GTEST_LOG_(INFO) << "ExecuteAction_003 end";
226 }
227 
228 /**
229  * @tc.number: GetWindow_001
230  * @tc.name: GetWindow
231  * @tc.desc: Test function GetWindow
232  */
233 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindow_001, TestSize.Level1)
234 {
235     GTEST_LOG_(INFO) << "GetWindow_001 start";
236     std::shared_ptr<AccessibleAbilityChannelClient> client =
237         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
238     ASSERT_TRUE(client);
239     AccessibilityWindowInfo windowInfo;
240     EXPECT_EQ(client->GetWindow(0, windowInfo), RET_ERR_SAMGR);
241     GTEST_LOG_(INFO) << "GetWindow_001 end";
242 }
243 
244 /**
245  * @tc.number: GetWindow_002
246  * @tc.name: GetWindow
247  * @tc.desc: Test function GetWindow
248  */
249 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindow_002, TestSize.Level1)
250 {
251     GTEST_LOG_(INFO) << "GetWindow_002 start";
252     EXPECT_CALL(*stub_, GetWindow(_, _)).Times(1).WillOnce(Return(RET_OK));
253     AccessibilityWindowInfo windowInfo;
254     EXPECT_EQ(instance_->GetWindow(0, windowInfo), RET_OK);
255     GTEST_LOG_(INFO) << "GetWindow_002 end";
256 }
257 
258 /**
259  * @tc.number: GetWindows_001
260  * @tc.name: GetWindows
261  * @tc.desc: Test function GetWindows
262  */
263 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindows_001, TestSize.Level1)
264 {
265     GTEST_LOG_(INFO) << "GetWindows_001 start";
266     std::shared_ptr<AccessibleAbilityChannelClient> client =
267         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
268     ASSERT_TRUE(client);
269     std::vector<AccessibilityWindowInfo> windowInfo {};
270     EXPECT_EQ(client->GetWindows(windowInfo), RET_ERR_SAMGR);
271     GTEST_LOG_(INFO) << "GetWindows_001 end";
272 }
273 
274 /**
275  * @tc.number: GetWindows_002
276  * @tc.name: GetWindows
277  * @tc.desc: Test function GetWindows
278  */
279 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindows_002, TestSize.Level1)
280 {
281     GTEST_LOG_(INFO) << "GetWindows_002 start";
282     EXPECT_CALL(*stub_, GetWindows(_)).Times(1).WillOnce(Return(RET_OK));
283     std::vector<AccessibilityWindowInfo> windowInfo {};
284     EXPECT_EQ(instance_->GetWindows(windowInfo), RET_OK);
285     GTEST_LOG_(INFO) << "GetWindows_002 end";
286 }
287 
288 /**
289  * @tc.number: GetWindows_003
290  * @tc.name: GetWindows
291  * @tc.desc: Test function GetWindows
292  */
293 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindows_003, TestSize.Level1)
294 {
295     GTEST_LOG_(INFO) << "GetWindows_003 start";
296     std::shared_ptr<AccessibleAbilityChannelClient> client =
297         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
298     ASSERT_TRUE(client);
299     std::vector<AccessibilityWindowInfo> windowInfo {};
300     EXPECT_EQ(client->GetWindows(0, windowInfo), RET_ERR_SAMGR);
301     GTEST_LOG_(INFO) << "GetWindows_003 end";
302 }
303 
304 /**
305  * @tc.number: GetWindows_004
306  * @tc.name: GetWindows
307  * @tc.desc: Test function GetWindows
308  */
309 HWTEST_F(AccessibleAbilityChannelClientTest, GetWindows_004, TestSize.Level1)
310 {
311     GTEST_LOG_(INFO) << "GetWindows_004 start";
312     EXPECT_CALL(*stub_, GetWindowsByDisplayId(_, _)).Times(1).WillOnce(Return(RET_OK));
313     std::vector<AccessibilityWindowInfo> windowInfo {};
314     EXPECT_EQ(instance_->GetWindows(0, windowInfo), RET_OK);
315     GTEST_LOG_(INFO) << "GetWindows_004 end";
316 }
317 
318 /**
319  * @tc.number: SearchElementInfosByText_001
320  * @tc.name: SearchElementInfosByText
321  * @tc.desc: Test function SearchElementInfosByText
322  */
323 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByText_001, TestSize.Level1)
324 {
325     GTEST_LOG_(INFO) << "SearchElementInfosByText_001 start";
326     std::shared_ptr<AccessibleAbilityChannelClient> client =
327         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
328     ASSERT_TRUE(client);
329     std::vector<AccessibilityElementInfo> infos;
330     EXPECT_EQ(client->SearchElementInfosByText(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID, TEST, infos), RET_ERR_SAMGR);
331     GTEST_LOG_(INFO) << "SearchElementInfosByText_001 end";
332 }
333 
334 /**
335  * @tc.number: SearchElementInfosByText_002
336  * @tc.name: SearchElementInfosByText
337  * @tc.desc: Test function SearchElementInfosByText
338  */
339 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByText_002, TestSize.Level1)
340 {
341     GTEST_LOG_(INFO) << "SearchElementInfosByText_002 start";
342     EXPECT_CALL(*stub_, SearchElementInfosByText(_, _, _, _, _)).Times(1).WillOnce(Return(RET_ERR_FAILED));
343     std::vector<AccessibilityElementInfo> infos;
344     EXPECT_EQ(instance_->SearchElementInfosByText(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID, TEST, infos), RET_ERR_FAILED);
345     GTEST_LOG_(INFO) << "SearchElementInfosByText_002 end";
346 }
347 
348 /**
349  * @tc.number: SearchElementInfosByText_003
350  * @tc.name: SearchElementInfosByText
351  * @tc.desc: Test function SearchElementInfosByText
352  */
353 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByText_003, TestSize.Level1)
354 {
355     GTEST_LOG_(INFO) << "SearchElementInfosByText_003 start";
356     EXPECT_CALL(*stub_, SearchElementInfosByText(_, _, _, _, _)).Times(1).WillOnce(Return(RET_OK));
357     std::vector<AccessibilityElementInfo> infos;
358     EXPECT_EQ(instance_->SearchElementInfosByText(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID, TEST, infos), RET_ERR_TIME_OUT);
359     GTEST_LOG_(INFO) << "SearchElementInfosByText_003 end";
360 }
361 
362 /**
363  * @tc.number: FocusMoveSearch_001
364  * @tc.name: FocusMoveSearch
365  * @tc.desc: Test function FocusMoveSearch
366  */
367 HWTEST_F(AccessibleAbilityChannelClientTest, FocusMoveSearch_001, TestSize.Level1)
368 {
369     GTEST_LOG_(INFO) << "FocusMoveSearch_001 start";
370     std::shared_ptr<AccessibleAbilityChannelClient> client =
371         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
372     ASSERT_TRUE(client);
373     AccessibilityElementInfo info {};
374     EXPECT_EQ(client->FocusMoveSearch(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID,
375         FocusMoveDirection::DOWN, info), RET_ERR_SAMGR);
376     GTEST_LOG_(INFO) << "FocusMoveSearch_001 end";
377 }
378 
379 /**
380  * @tc.number: FocusMoveSearch_002
381  * @tc.name: FocusMoveSearch
382  * @tc.desc: Test function FocusMoveSearch
383  */
384 HWTEST_F(AccessibleAbilityChannelClientTest, FocusMoveSearch_002, TestSize.Level1)
385 {
386     GTEST_LOG_(INFO) << "FocusMoveSearch_002 start";
387     EXPECT_CALL(*stub_, FocusMoveSearch(_, _, _, _, _)).Times(1).WillOnce(Return(RET_ERR_FAILED));
388     AccessibilityElementInfo info {};
389     EXPECT_EQ(instance_->FocusMoveSearch(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID,
390         FocusMoveDirection::DOWN, info), RET_ERR_FAILED);
391     GTEST_LOG_(INFO) << "FocusMoveSearch_002 end";
392 }
393 
394 /**
395  * @tc.number: FocusMoveSearch_003
396  * @tc.name: FocusMoveSearch
397  * @tc.desc: Test function FocusMoveSearch
398  */
399 HWTEST_F(AccessibleAbilityChannelClientTest, FocusMoveSearch_003, TestSize.Level1)
400 {
401     GTEST_LOG_(INFO) << "FocusMoveSearch_003 start";
402     EXPECT_CALL(*stub_, FocusMoveSearch(_, _, _, _, _)).Times(1).WillOnce(Return(RET_OK));
403     AccessibilityElementInfo info {};
404     EXPECT_EQ(instance_->FocusMoveSearch(ACCESSIBILITY_WINDOW_ID, ELEMENT_ID,
405         FocusMoveDirection::DOWN, info), RET_ERR_TIME_OUT);
406     GTEST_LOG_(INFO) << "FocusMoveSearch_003 end";
407 }
408 
409 /**
410  * @tc.number: SetTargetBundleName_001
411  * @tc.name: SetTargetBundleName
412  * @tc.desc: Test function SetTargetBundleName
413  */
414 HWTEST_F(AccessibleAbilityChannelClientTest, SetTargetBundleName_001, TestSize.Level1)
415 {
416     GTEST_LOG_(INFO) << "SetTargetBundleName_001 start";
417     std::shared_ptr<AccessibleAbilityChannelClient> client =
418         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
419     ASSERT_TRUE(client);
420     std::vector<std::string> targetBundleNames;
421     EXPECT_EQ(client->SetTargetBundleName(targetBundleNames), RET_ERR_SAMGR);
422     GTEST_LOG_(INFO) << "SetTargetBundleName_001 end";
423 }
424 
425 /**
426  * @tc.number: SetTargetBundleName_002
427  * @tc.name: SetTargetBundleName
428  * @tc.desc: Test function SetTargetBundleName
429  */
430 HWTEST_F(AccessibleAbilityChannelClientTest, SetTargetBundleName_002, TestSize.Level1)
431 {
432     GTEST_LOG_(INFO) << "SetTargetBundleName_002 start";
433     EXPECT_CALL(*stub_, SetTargetBundleName(_)).Times(1).WillOnce(Return(RET_OK));
434     std::vector<std::string> targetBundleNames;
435     EXPECT_EQ(instance_->SetTargetBundleName(targetBundleNames), RET_OK);
436     GTEST_LOG_(INFO) << "SetTargetBundleName_002 end";
437 }
438 
439 /**
440  * @tc.number: SearchElementInfosByAccessibilityId_001
441  * @tc.name: SearchElementInfosByAccessibilityId
442  * @tc.desc: Test function SearchElementInfosByAccessibilityId
443  */
444 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByAccessibilityId_001, TestSize.Level1)
445 {
446     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_001 start";
447     EXPECT_CALL(*stub_, SearchElementInfoByAccessibilityId(_, _, _, _, _)).Times(1).WillOnce(Return(RET_ERR_FAILED));
448     std::vector<AccessibilityElementInfo> infos;
449     EXPECT_EQ(instance_->SearchElementInfosByAccessibilityId(ACCESSIBILITY_WINDOW_ID,
450         ELEMENT_ID, MODE, infos), RET_ERR_FAILED);
451     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_001 end";
452 }
453 
454 /**
455  * @tc.number: SearchElementInfosByAccessibilityId_002
456  * @tc.name: SearchElementInfosByAccessibilityId
457  * @tc.desc: Test function SearchElementInfosByAccessibilityId
458  */
459 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByAccessibilityId_002, TestSize.Level1)
460 {
461     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_002 start";
462     std::shared_ptr<AccessibleAbilityChannelClient> client =
463         std::make_shared<AccessibleAbilityChannelClient>(CHANNEL_ID, nullptr);
464     ASSERT_TRUE(client);
465     std::vector<AccessibilityElementInfo> infos;
466     EXPECT_EQ(client->SearchElementInfosByAccessibilityId(ACCESSIBILITY_WINDOW_ID,
467         ELEMENT_ID, MODE, infos), RET_ERR_SAMGR);
468     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_002 end";
469 }
470 
471 /**
472  * @tc.number: SearchElementInfosByAccessibilityId_003
473  * @tc.name: SearchElementInfosByAccessibilityId
474  * @tc.desc: Test function SearchElementInfosByAccessibilityId
475  */
476 HWTEST_F(AccessibleAbilityChannelClientTest, SearchElementInfosByAccessibilityId_003, TestSize.Level1)
477 {
478     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_003 start";
479     EXPECT_CALL(*stub_, SearchElementInfoByAccessibilityId(_, _, _, _, _)).Times(1).WillOnce(Return(RET_OK));
480     std::vector<AccessibilityElementInfo> infos;
481     EXPECT_EQ(instance_->SearchElementInfosByAccessibilityId(ACCESSIBILITY_WINDOW_ID,
482         ELEMENT_ID, MODE, infos), RET_ERR_TIME_OUT);
483     GTEST_LOG_(INFO) << "SearchElementInfosByAccessibilityId_003 end";
484 }
485 } // namespace Accessibility
486 } // namespace OHOS