• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "edm_errors.h"
18 #include "hilog_wrapper.h"
19 #define private public
20 #include "dev_change_callback.h"
21 #include "etx_device_mgr.h"
22 #include "ibus_extension.h"
23 #include "usb_bus_extension.h"
24 #include "bus_extension_core.h"
25 #include "driver_pkg_manager.h"
26 #undef private
27 
28 namespace OHOS {
29 namespace ExternalDeviceManager {
30 using namespace std;
31 using namespace testing::ext;
32 
33 const unordered_set<std::string> accessibleBundles = {"testBundleName1", "testBundleName2"};
34 
35 class DeviceManagerTest : public testing::Test {
36 public:
SetUp()37     void SetUp() override
38     {
39         EDM_LOGD(MODULE_DEV_MGR, "DeviceManagerTest SetUp");
40     }
TearDown()41     void TearDown() override
42     {
43         EDM_LOGD(MODULE_DEV_MGR, "DeviceManagerTest TearDown");
44     }
45 };
46 
clearDeviceMap(ExtDeviceManager & instance)47 static void clearDeviceMap(ExtDeviceManager &instance)
48 {
49     unordered_map<BusType, unordered_map<uint64_t, shared_ptr<Device>>> map;
50     instance.deviceMap_ = map;
51 }
52 
getDeviceNum(unordered_map<uint64_t,shared_ptr<Device>> map)53 static size_t getDeviceNum(unordered_map<uint64_t, shared_ptr<Device>> map)
54 {
55     size_t num = 0;
56     for (auto &[_, device] : map) {
57         if (!device->IsUnRegisted()) {
58             num++;
59         }
60     }
61     return num;
62 }
63 
64 HWTEST_F(DeviceManagerTest, BusExtensionRegisterTest, Function | MediumTest | Level1)
65 {
66     BusExtensionCore &core = BusExtensionCore::GetInstance();
67     int32_t ret = core.Register(BusType::BUS_TYPE_USB, std::make_shared<UsbBusExtension>());
68     ASSERT_EQ(ret, EDM_OK);
69     ASSERT_NE(core.busExtensions_[BusType::BUS_TYPE_USB], nullptr);
70 }
71 
72 HWTEST_F(DeviceManagerTest, InitTest, TestSize.Level1)
73 {
74     DriverPkgManager::GetInstance().Init();
75     int32_t ret = ExtDeviceManager::GetInstance().Init();
76     ASSERT_EQ(ret, EDM_OK);
77 }
78 
79 // test OnDeviceAdd and OnDeviceRemove
80 HWTEST_F(DeviceManagerTest, OnDeviceAddRemoveTest001, Function | MediumTest | Level1)
81 {
82     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
83     clearDeviceMap(extMgr);
84     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
85     std::shared_ptr<DeviceInfo> device = std::make_shared<DeviceInfo>(0);
86     device->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
87     device->devInfo_.devBusInfo.busDeviceId = 1;
88     int32_t ret = callback->OnDeviceAdd(device);
89     ASSERT_EQ(ret, EDM_OK);
90     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
91     ret = callback->OnDeviceRemove(device);
92     ASSERT_EQ(ret, EDM_OK);
93     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 0);
94 }
95 
96 // test adding device repeatedly
97 HWTEST_F(DeviceManagerTest, OnDeviceAddRemoveTest002, Function | MediumTest | Level1)
98 {
99     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
100     clearDeviceMap(extMgr);
101     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
102     std::shared_ptr<DeviceInfo> device = std::make_shared<DeviceInfo>(0);
103     device->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
104     device->devInfo_.devBusInfo.busDeviceId = 1;
105     int32_t ret = callback->OnDeviceAdd(device);
106     ASSERT_EQ(ret, EDM_OK);
107     ret = callback->OnDeviceAdd(device);
108     ASSERT_EQ(ret, EDM_OK);
109     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
110     ret = callback->OnDeviceRemove(device);
111     ASSERT_EQ(ret, EDM_OK);
112     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 0);
113     ret = callback->OnDeviceRemove(device);
114     ASSERT_EQ(ret, EDM_OK);
115 }
116 
117 HWTEST_F(DeviceManagerTest, OnDeviceAddRemoveTest003, Function | MediumTest | Level1)
118 {
119     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
120     clearDeviceMap(extMgr);
121     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
122     std::shared_ptr<DeviceInfo> device0 = std::make_shared<DeviceInfo>(0);
123     device0->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
124     device0->devInfo_.devBusInfo.busDeviceId = 1;
125     int32_t ret = callback->OnDeviceAdd(device0);
126     ASSERT_EQ(ret, EDM_OK);
127     std::shared_ptr<DeviceInfo> device1 = std::make_shared<DeviceInfo>(0);
128     device1->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
129     device1->devInfo_.devBusInfo.busDeviceId = 2;
130     ret = callback->OnDeviceAdd(device1);
131     ASSERT_EQ(ret, EDM_OK);
132     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 2);
133     ret = callback->OnDeviceRemove(device1);
134     ASSERT_EQ(ret, EDM_OK);
135     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
136     ret = callback->OnDeviceRemove(device0);
137     ASSERT_EQ(ret, EDM_OK);
138     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 0);
139 }
140 
141 HWTEST_F(DeviceManagerTest, QueryDeviceTest, Function | MediumTest | Level1)
142 {
143     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
144     clearDeviceMap(extMgr);
145     std::vector<std::shared_ptr<DeviceInfo>> devVec = extMgr.QueryDevice(BUS_TYPE_TEST);
146     ASSERT_EQ(devVec.size(), 0);
147     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
148     std::shared_ptr<DeviceInfo> device0 = std::make_shared<DeviceInfo>(0);
149     device0->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
150     device0->devInfo_.devBusInfo.busDeviceId = 1;
151     int32_t ret = callback->OnDeviceAdd(device0);
152     ASSERT_EQ(ret, EDM_OK);
153     std::shared_ptr<DeviceInfo> device1 = std::make_shared<DeviceInfo>(0);
154     device1->devInfo_.devBusInfo.busType = BusType::BUS_TYPE_TEST;
155     device1->devInfo_.devBusInfo.busDeviceId = 2;
156     ret = callback->OnDeviceAdd(device1);
157     ASSERT_EQ(ret, EDM_OK);
158     devVec = extMgr.QueryDevice(BUS_TYPE_TEST);
159     ASSERT_EQ(devVec.size(), 2);
160     ret = callback->OnDeviceRemove(device0);
161     ret = callback->OnDeviceRemove(device1);
162     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 0);
163 }
164 
165 HWTEST_F(DeviceManagerTest, GetBusExtensionByNameTest, Function | MediumTest | Level1)
166 {
167     BusExtensionCore &core = BusExtensionCore::GetInstance();
168     ASSERT_NE(core.busExtensions_[BusType::BUS_TYPE_USB], nullptr);
169     std::shared_ptr<IBusExtension> extension = core.GetBusExtensionByName("HDMI");
170     ASSERT_EQ(extension, nullptr);
171     extension = core.GetBusExtensionByName("USB");
172     ASSERT_NE(extension, nullptr);
173     core.busExtensions_.erase(BusType::BUS_TYPE_USB);
174     extension = core.GetBusExtensionByName("USB");
175     ASSERT_EQ(extension, nullptr);
176 }
177 
178 class TestRemoteObjectStub : public IRemoteObject {
179 public:
TestRemoteObjectStub()180     TestRemoteObjectStub() : IRemoteObject(u"IRemoteObject") {}
GetObjectRefCount()181     int32_t GetObjectRefCount() { return 0; };
SendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)182     int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { return 0; };
AddDeathRecipient(const sptr<DeathRecipient> & recipient)183     bool AddDeathRecipient(const sptr<DeathRecipient> &recipient) { return true; };
RemoveDeathRecipient(const sptr<DeathRecipient> & recipient)184     bool RemoveDeathRecipient(const sptr<DeathRecipient> &recipient) { return true; };
Dump(int fd,const std::vector<std::u16string> & args)185     int Dump(int fd, const std::vector<std::u16string> &args) { return 0; };
186 };
187 
188 class TestDriverExtMgrCallback : public IDriverExtMgrCallback {
189 public:
TestDriverExtMgrCallback()190     TestDriverExtMgrCallback() {}
AsObject()191     sptr<IRemoteObject> AsObject()
192     {
193         return sptr<TestRemoteObjectStub>::MakeSptr();
194     };
OnConnect(uint64_t deviceId,const sptr<IRemoteObject> & drvExtObj,const ErrMsg & errMsg)195     ErrCode OnConnect(uint64_t deviceId, const sptr<IRemoteObject> &drvExtObj, const ErrMsg &errMsg)
196     {
197         EDM_LOGD(MODULE_DEV_MGR, "TestDriverExtMgrCallback::OnConnect entry");
198         return EDM_OK;
199     };
OnDisconnect(uint64_t deviceId,const ErrMsg & errMsg)200     ErrCode OnDisconnect(uint64_t deviceId, const ErrMsg &errMsg)
201     {
202         EDM_LOGD(MODULE_DEV_MGR, "TestDriverExtMgrCallback::OnConnect entry");
203         return EDM_OK;
204     };
OnUnBind(uint64_t deviceId,const ErrMsg & errMsg)205     ErrCode OnUnBind(uint64_t deviceId, const ErrMsg &errMsg)
206     {
207         EDM_LOGD(MODULE_DEV_MGR, "TestDriverExtMgrCallback::OnConnect entry");
208         return EDM_OK;
209     };
210 };
211 
212 HWTEST_F(DeviceManagerTest, ConnectDeviceTest, Function | MediumTest | Level1)
213 {
214     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
215     clearDeviceMap(extMgr);
216     uint64_t deviceId = 3;
217     const uint32_t tokenId1 = 1;
218     sptr<IDriverExtMgrCallback> connectCallback = sptr<TestDriverExtMgrCallback>::MakeSptr();
219     int32_t ret = extMgr.ConnectDevice(deviceId, tokenId1, connectCallback);
220     ASSERT_EQ(ret, EDM_NOK);
221     std::shared_ptr<Device> device = extMgr.QueryDeviceByDeviceID(deviceId);
222     ASSERT_EQ(device, nullptr);
223 
224     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
225     std::shared_ptr<DeviceInfo> deviceInfo = std::make_shared<DeviceInfo>(deviceId,
226         BusType::BUS_TYPE_TEST, "testInfo1");
227     deviceInfo->devInfo_.deviceId = deviceId;
228     ret = callback->OnDeviceAdd(deviceInfo);
229     ASSERT_EQ(ret, EDM_OK);
230     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
231     device = extMgr.QueryDeviceByDeviceID(deviceId);
232     ASSERT_NE(device, nullptr);
233     device->driverInfo_ = make_shared<DriverInfo>("testBundleName1", "testDriverName1");
234     ASSERT_EQ(device->driverInfo_->launchOnBind_, false);
235     ret = extMgr.ConnectDevice(deviceId, tokenId1, connectCallback);
236     ASSERT_NE(ret, EDM_OK);
237 
238     sptr<IRemoteObject> remote = sptr<TestRemoteObjectStub>::MakeSptr();
239     int resultCode = static_cast<int>(UsbErrCode::EDM_OK);
240     device->OnConnect(remote, resultCode);
241     ASSERT_EQ(device->boundCallerInfos_.size(), 0);
242     ASSERT_NE(device->drvExtRemote_, nullptr);
243     device->driverInfo_->accessAllowed_ = true;
244     ret = extMgr.ConnectDevice(deviceId, tokenId1, connectCallback);
245     ASSERT_EQ(ret, EDM_OK);
246     ASSERT_EQ(device->boundCallerInfos_.size(), 1);
247     const uint32_t tokenId2 = 2;
248     ret = extMgr.ConnectDevice(deviceId, tokenId2, connectCallback);
249     ASSERT_EQ(ret, EDM_OK);
250     ASSERT_EQ(device->boundCallerInfos_.size(), 2);
251     auto iter = device->boundCallerInfos_.find(tokenId1);
252     ASSERT_NE(iter, device->boundCallerInfos_.end());
253     ASSERT_EQ(iter->second.isBound, true);
254     iter = device->boundCallerInfos_.find(tokenId2);
255     ASSERT_NE(iter, device->boundCallerInfos_.end());
256     ASSERT_EQ(iter->second.isBound, true);
257 }
258 
259 HWTEST_F(DeviceManagerTest, ConnectDeviceTest1, Function | MediumTest | Level1)
260 {
261     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
262     clearDeviceMap(extMgr);
263     uint64_t deviceId = 3;
264     const uint32_t tokenId = 1;
265     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
266     std::shared_ptr<DeviceInfo> deviceInfo = std::make_shared<DeviceInfo>(deviceId,
267         BusType::BUS_TYPE_TEST, "testInfo1");
268     deviceInfo->devInfo_.deviceId = deviceId;
269     int32_t ret = callback->OnDeviceAdd(deviceInfo);
270     ASSERT_EQ(ret, EDM_OK);
271     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
272     std::shared_ptr<Device> device = extMgr.QueryDeviceByDeviceID(deviceId);
273     ASSERT_NE(device, nullptr);
274     sptr<IDriverExtMgrCallback> connectCallback = sptr<TestDriverExtMgrCallback>::MakeSptr();
275 
276     device->driverInfo_ = make_shared<DriverInfo>("testBundleName1", "testDriverName1");
277     device->driverInfo_->accessAllowed_ = false;
278     ret = extMgr.ConnectDriverWithDeviceId(deviceId, tokenId, accessibleBundles, connectCallback);
279     ASSERT_EQ(ret, EDM_ERR_SERVICE_NOT_ALLOW_ACCESS);
280 
281     device->driverInfo_->accessAllowed_ = true;
282     ret = extMgr.ConnectDriverWithDeviceId(deviceId, tokenId, accessibleBundles, connectCallback);
283     ASSERT_NE(ret, EDM_ERR_SERVICE_NOT_ALLOW_ACCESS);
284 }
285 
286 HWTEST_F(DeviceManagerTest, ConnectDeviceTest2, Function | MediumTest | Level1)
287 {
288     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
289     clearDeviceMap(extMgr);
290     uint64_t deviceId = 3;
291     const uint32_t tokenId = 1;
292     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
293     std::shared_ptr<DeviceInfo> deviceInfo = std::make_shared<DeviceInfo>(deviceId,
294         BusType::BUS_TYPE_TEST, "testInfo1");
295     deviceInfo->devInfo_.deviceId = deviceId;
296     int32_t ret = callback->OnDeviceAdd(deviceInfo);
297     ASSERT_EQ(ret, EDM_OK);
298     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
299     std::shared_ptr<Device> device = extMgr.QueryDeviceByDeviceID(deviceId);
300     ASSERT_NE(device, nullptr);
301     sptr<IDriverExtMgrCallback> connectCallback = sptr<TestDriverExtMgrCallback>::MakeSptr();
302 
303     device->driverInfo_ = make_shared<DriverInfo>("testBundleName3", "testDriverName3");
304     device->driverInfo_->accessAllowed_ = true;
305     ret = extMgr.ConnectDriverWithDeviceId(deviceId, tokenId, accessibleBundles, connectCallback);
306     ASSERT_EQ(ret, EDM_ERR_NO_PERM);
307 
308     device->driverInfo_->bundleName_ = "testBundleName1";
309     ret = extMgr.ConnectDriverWithDeviceId(deviceId, tokenId, accessibleBundles, connectCallback);
310     ASSERT_NE(ret, EDM_ERR_NO_PERM);
311 }
312 
313 HWTEST_F(DeviceManagerTest, DisConnectDeviceTest, Function | MediumTest | Level1)
314 {
315     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
316     clearDeviceMap(extMgr);
317     uint64_t deviceId = 3;
318     const uint32_t tokenId1 = 1;
319     sptr<IDriverExtMgrCallback> connectCallback = sptr<TestDriverExtMgrCallback>::MakeSptr();
320     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
321     std::shared_ptr<DeviceInfo> deviceInfo = std::make_shared<DeviceInfo>(deviceId,
322         BusType::BUS_TYPE_TEST, "testInfo2");
323     deviceInfo->devInfo_.deviceId = deviceId;
324     int32_t ret = callback->OnDeviceAdd(deviceInfo);
325     ASSERT_EQ(ret, EDM_OK);
326     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
327     std::shared_ptr<Device> device = extMgr.QueryDeviceByDeviceID(deviceId);
328     device->driverInfo_ = make_shared<DriverInfo>("testBundleName2", "testDriverName2");
329     ret = extMgr.ConnectDevice(deviceId, tokenId1, connectCallback);
330     ASSERT_NE(ret, EDM_OK);
331 
332     sptr<IRemoteObject> remote = sptr<TestRemoteObjectStub>::MakeSptr();
333     device->OnConnect(remote, static_cast<int>(UsbErrCode::EDM_OK));
334     ASSERT_EQ(device->boundCallerInfos_.size(), 0);
335     ASSERT_NE(device->drvExtRemote_, nullptr);
336     device->driverInfo_->accessAllowed_ = true;
337     ret = extMgr.ConnectDevice(deviceId, tokenId1, connectCallback);
338     ASSERT_EQ(ret, EDM_OK);
339     ASSERT_EQ(device->boundCallerInfos_.size(), 1);
340 
341     const uint32_t tokenId2 = 2;
342     ret = extMgr.ConnectDevice(deviceId, tokenId2, connectCallback);
343     ASSERT_EQ(ret, EDM_OK);
344     ASSERT_EQ(device->boundCallerInfos_.size(), 2);
345     auto iter = device->boundCallerInfos_.find(tokenId1);
346     ASSERT_NE(iter, device->boundCallerInfos_.end());
347     ASSERT_EQ(iter->second.isBound, true);
348     iter = device->boundCallerInfos_.find(tokenId2);
349     ASSERT_NE(iter, device->boundCallerInfos_.end());
350     ASSERT_EQ(iter->second.isBound, true);
351     ret = extMgr.DisConnectDevice(deviceId, tokenId2);
352     ASSERT_EQ(ret, EDM_OK);
353     ASSERT_EQ(device->boundCallerInfos_.size(), 1);
354     iter = device->boundCallerInfos_.begin();
355     ASSERT_EQ(iter->first, tokenId1);
356     ASSERT_EQ(iter->second.isBound, true);
357     device->driverInfo_->launchOnBind_ = true;
358     ret = extMgr.DisConnectDevice(deviceId, tokenId1);
359     ASSERT_NE(ret, EDM_OK);
360     ASSERT_EQ(device->boundCallerInfos_.size(), 1);
361     device->driverInfo_->launchOnBind_ = false;
362     ret = extMgr.DisConnectDevice(deviceId, tokenId1);
363     ASSERT_EQ(ret, EDM_OK);
364     ASSERT_EQ(device->boundCallerInfos_.size(), 0);
365 }
366 
367 HWTEST_F(DeviceManagerTest, DisConnectDeviceTest1, Function | MediumTest | Level1)
368 {
369     ExtDeviceManager &extMgr = ExtDeviceManager::GetInstance();
370     clearDeviceMap(extMgr);
371     uint64_t deviceId = 3;
372     const uint32_t tokenId1 = 1;
373     std::shared_ptr<DevChangeCallback> callback = std::make_shared<DevChangeCallback>();
374     std::shared_ptr<DeviceInfo> deviceInfo = std::make_shared<DeviceInfo>(deviceId,
375         BusType::BUS_TYPE_TEST, "testInfo2");
376     deviceInfo->devInfo_.deviceId = deviceId;
377     int32_t ret = callback->OnDeviceAdd(deviceInfo);
378     ASSERT_EQ(ret, EDM_OK);
379     ASSERT_EQ(getDeviceNum(extMgr.deviceMap_[BusType::BUS_TYPE_TEST]), 1);
380     std::shared_ptr<Device> device = extMgr.QueryDeviceByDeviceID(deviceId);
381     device->driverInfo_ = make_shared<DriverInfo>("testBundleName2", "testDriverName2");
382     sptr<IRemoteObject> remote = sptr<TestRemoteObjectStub>::MakeSptr();
383     device->OnConnect(remote, static_cast<int>(UsbErrCode::EDM_OK));
384     ASSERT_NE(device->drvExtRemote_, nullptr);
385     sptr<IDriverExtMgrCallback> connectCallback = sptr<TestDriverExtMgrCallback>::MakeSptr();
386 
387     device->driverInfo_->accessAllowed_ = true;
388     ret = extMgr.ConnectDriverWithDeviceId(deviceId, tokenId1, accessibleBundles, connectCallback);
389     ASSERT_EQ(ret, EDM_OK);
390     ASSERT_EQ(device->boundCallerInfos_.size(), 1);
391 
392     const uint32_t tokenId2 = 2;
393     ret = extMgr.DisConnectDriverWithDeviceId(deviceId, tokenId2);
394     ASSERT_EQ(ret, EDM_ERR_SERVICE_NOT_BOUND);
395 
396     ret = extMgr.DisConnectDriverWithDeviceId(deviceId, tokenId1);
397     ASSERT_NE(ret, EDM_ERR_SERVICE_NOT_BOUND);
398 }
399 } // namespace ExternalDeviceManager
400 } // namespace OHOS
401