新增DM的deviceid验证用例

Signed-off-by: bWX1145125 <bianjianliang1@huawei.com>
This commit is contained in:
bWX1145125 2024-09-19 11:07:19 +08:00
parent fd0044acc6
commit deae8fc2ce
15 changed files with 75 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2023 Huawei Device Co., Ltd.
# Copyright (C) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2022-2023 - 2024 Huawei Device Co., Ltd.
# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (C) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Copyright (C) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -1491,6 +1491,66 @@ export default function distributedDeviceManager() {
}
await sleep(1000);
console.info("-----------------SUB_DH_DeviceManager_Dcts_4300 end------------------------");
})
/*
* @tc.number SUB_DH_DeviceManager_Dcts_4400
* @tc.name To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then
* use this instance to call other device management methods, verification deviceID.
* @tc.desc Function test
* @tc.size MediumTest
* @tc.type: Function
* @tc.level Level1
*/
it("SUB_DH_DeviceManager_Dcts_4400", 0, async function (done) {
console.info("-----------------SUB_DH_DeviceManager_Dcts_4400 start------------------------");
let dmDeviceId = null;
let bindParam = {
"bindType" : 1,
"targetPkgName" : "com.ohos.distributedDeviceManager",
"appName" : "SubDctsdisDeviceJsTest",
"appOperation": "想要连接本机。",
"customDescription": "device manager"
};
try {
dmInstance = deviceManager.createDeviceManager("com.ohos.distributedscreenjstest");
if (!dmInstance) {
console.error("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
expect(false).assertFail();
done();
}
console.info("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager success");
dmDeviceInfo = dmInstance.getAvailableDeviceListSync();
if (dmDeviceInfo === null) {
console.log('SUB_DH_DeviceManager_Dcts_4400 getAvailableDeviceListSync info fail');
expect(false).assertFail();
done();
}
console.log('SUB_DH_DeviceManager_Dcts_4400 getAvailableDeviceListSync info:' + JSON.stringify(dmDeviceInfo[0]["deviceId"]));
dmDeviceId = dmDeviceInfo[0]["deviceId"];
console.log('SUB_DH_DeviceManager_Dcts_4400 dmDeviceId info:' + JSON.stringify(dmDeviceId));
dmInstance.bindTarget(dmDeviceId, bindParam, (err, data) => {
if (err) {
console.error('SUB_DH_DeviceManager_Dcts_4400 bindTarget errCode:' + err.code + ',errMessage:' + err.message);
expect(false).assertFail();
done();
}
console.info('SUB_DH_DeviceManager_Dcts_4400 bindTarget result:' + JSON.stringify(data));
});
console.info("SUB_DH_DeviceManager_Dcts_4400 bindTarget success");
deviceManager.releaseDeviceManager(dmInstance);
console.info("SUB_DH_DeviceManager_Dcts_4400 releaseDeviceManager success");
expect(dmInstance !== null).assertTrue();
done();
} catch(err) {
console.error("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
expect(false).assertFail();
done();
}
await sleep(1000);
console.info("-----------------SUB_DH_DeviceManager_Dcts_4400 end------------------------");
})
})
}