mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-27 01:40:46 +00:00
分布式DP维护和新增js异常用例
Signed-off-by: bWX1145125 <bianjianliang1@huawei.com>
This commit is contained in:
parent
0851dd263c
commit
4acf5200e1
@ -17,8 +17,9 @@ group("distributedhardware") {
|
||||
testonly = true
|
||||
if (is_standard_system) {
|
||||
deps = [
|
||||
"distributedaudionewtest:SubDctsdisAudioNewTest",
|
||||
"distributedaudiotest:SubDctsdisAudioTest",
|
||||
"devicemanagernotest:DctsSubDeviceJsTest",
|
||||
"distributedaudionewtest:DctsSubdAudioNewTest",
|
||||
"distributedaudiotest:DctsSubAudioTest",
|
||||
"distributedcameratest:DctsSubdisCameraTest",
|
||||
"distributeddevicejstest:DctsSubdisDeviceJsTest",
|
||||
"distributeddptest:DctsSubDistributedDpTest",
|
||||
|
35
distributedhardware/devicemanagernotest/BUILD.gn
Normal file
35
distributedhardware/devicemanagernotest/BUILD.gn
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright (C) 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("../../../tools/build/suite.gni")
|
||||
|
||||
ohos_js_hap_suite("DctsSubDeviceJsTest") {
|
||||
hap_profile = "./src/main/config.json"
|
||||
deps = [
|
||||
":distributedjs_assets",
|
||||
":distributedjs_resources",
|
||||
]
|
||||
certificate_profile = "./signature/openharmony_sx.p7b"
|
||||
hap_name = "DctsSubDeviceJsTest"
|
||||
subsystem_name = "distributedhardware"
|
||||
part_name = "device_manager"
|
||||
}
|
||||
ohos_js_assets("distributedjs_assets") {
|
||||
js2abc = true
|
||||
hap_profile = "./src/main/config.json"
|
||||
source_dir = "./src/main/js"
|
||||
}
|
||||
ohos_resources("distributedjs_resources") {
|
||||
sources = [ "./src/main/resources" ]
|
||||
hap_profile = "./src/main/config.json"
|
||||
}
|
20
distributedhardware/devicemanagernotest/Test.json
Normal file
20
distributedhardware/devicemanagernotest/Test.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"description": "Configuration for hjunit demo Tests",
|
||||
"driver": {
|
||||
"type": "OHJSUnitTest",
|
||||
"bundle-name": "com.ohos.distributedjstest",
|
||||
"package-name": "com.ohos.distributedjstest",
|
||||
"test-timeout": "1200000",
|
||||
"testcase-timeout": "6000",
|
||||
"shell-timeout": "1200000"
|
||||
},
|
||||
"kits": [
|
||||
{
|
||||
"test-file-name": [
|
||||
"DctsSubDeviceJsTest.hap"
|
||||
],
|
||||
"type": "AppInstallKit",
|
||||
"cleanup-apps": true
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
101
distributedhardware/devicemanagernotest/src/main/config.json
Normal file
101
distributedhardware/devicemanagernotest/src/main/config.json
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.distributedjstest",
|
||||
"vendor": "example",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
},
|
||||
"apiVersion": {
|
||||
"compatible": 10,
|
||||
"target": 10
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"reqPermissions": [
|
||||
],
|
||||
"package": "com.ohos.distributedjstest",
|
||||
"name": ".entry",
|
||||
"mainAbility": ".MainAbility",
|
||||
"srcPath": "",
|
||||
"deviceType": [
|
||||
"phone",
|
||||
"tablet",
|
||||
"tv",
|
||||
"wearable",
|
||||
"default",
|
||||
"2in1"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "entry",
|
||||
"moduleType": "entry",
|
||||
"installationFree": false
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"orientation": "unspecified",
|
||||
"formsEnabled": false,
|
||||
"name": ".MainAbility",
|
||||
"srcLanguage": "js",
|
||||
"srcPath": "MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:app_name",
|
||||
"type": "page",
|
||||
"visible": true,
|
||||
"launchType": "standard"
|
||||
},
|
||||
{
|
||||
"orientation": "unspecified",
|
||||
"formsEnabled": false,
|
||||
"name": ".TestAbility",
|
||||
"srcLanguage": "js",
|
||||
"srcPath": "TestAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:TestAbility_desc",
|
||||
"label": "$string:TestAbility_label",
|
||||
"type": "page",
|
||||
"visible": true,
|
||||
"launchType": "standard"
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"name": ".MainAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"name": ".TestAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"testRunner": {
|
||||
"name": "OpenHarmonyTestRunner",
|
||||
"srcPath": "TestRunner"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('AceApplication onCreate');
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('AceApplication onDestroy');
|
||||
}
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "Hello",
|
||||
"world": "World"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "您好",
|
||||
"world": "世界"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
.container {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 100px;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
<div class="container">
|
||||
<text class="title">
|
||||
{{ $t('strings.hello') }} {{title}}
|
||||
</text>
|
||||
</div>
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
data: {
|
||||
title: ''
|
||||
},
|
||||
onInit() {
|
||||
this.title = this.$t('strings.world');
|
||||
},
|
||||
onShow() {
|
||||
console.info('onShow finish')
|
||||
},
|
||||
onReady() {
|
||||
},
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
|
||||
import { Hypium } from '@ohos/hypium';
|
||||
import testsuite from '../test/List.test';
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('TestApplication onCreate');
|
||||
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
|
||||
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
|
||||
console.info('start run testcase!!!');
|
||||
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
|
||||
},
|
||||
onDestroy() {
|
||||
console.info("TestApplication onDestroy");
|
||||
}
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "Hello",
|
||||
"world": "World"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "您好",
|
||||
"world": "世界"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 60px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 40%;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
@media screen and (device-type: phone) and (orientation: landscape) {
|
||||
.title {
|
||||
font-size: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (device-type: tablet) and (orientation: landscape) {
|
||||
.title {
|
||||
font-size: 100px;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<div class="container">
|
||||
<text class="title">
|
||||
{{ $t('strings.hello') }} {{ title }}
|
||||
</text>
|
||||
</div>
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
data: {
|
||||
title: ''
|
||||
},
|
||||
onInit() {
|
||||
this.title = this.$t('strings.world');
|
||||
},
|
||||
onShow() {
|
||||
console.info('onShow finish')
|
||||
},
|
||||
onReady() {
|
||||
},
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
|
||||
|
||||
function translateParamsToString(parameters) {
|
||||
const keySet = new Set([
|
||||
'-s class', '-s notClass', '-s suite', '-s itName',
|
||||
'-s level', '-s testType', '-s size', '-s timeout',
|
||||
'-s package', '-s dryRun'
|
||||
]);
|
||||
let targetParams = '';
|
||||
for (const key in parameters) {
|
||||
if (keySet.has(key)) {
|
||||
targetParams += ' ' + key + ' ' + parameters[key];
|
||||
}
|
||||
}
|
||||
return targetParams.trim();
|
||||
}
|
||||
|
||||
export default {
|
||||
onPrepare() {
|
||||
console.info('OpenHarmonyTestRunner OnPrepare');
|
||||
},
|
||||
onRun() {
|
||||
console.log('OpenHarmonyTestRunner onRun run');
|
||||
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
|
||||
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
|
||||
|
||||
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility';
|
||||
|
||||
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName;
|
||||
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters);
|
||||
var debug = abilityDelegatorArguments.parameters["-D"];
|
||||
console.info('debug value : '+debug);
|
||||
if (debug == 'true')
|
||||
{
|
||||
cmd += ' -D';
|
||||
}
|
||||
console.info('cmd : '+cmd);
|
||||
abilityDelegator.executeShellCommand(cmd, (err, data) => {
|
||||
console.info('executeShellCommand : err : ' + JSON.stringify(err));
|
||||
console.info('executeShellCommand : data : ' + data.stdResult);
|
||||
console.info('executeShellCommand : data : ' + data.exitCode);
|
||||
})
|
||||
}
|
||||
};
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import distributedDevice from './distributedDevice.test.js'
|
||||
|
||||
export default function testsuite() {
|
||||
distributedDevice();
|
||||
}
|
@ -0,0 +1,658 @@
|
||||
/*
|
||||
* Copyright (C) 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||
import deviceManager from '@ohos.distributedDeviceManager';
|
||||
|
||||
export default function distributedDeviceManager() {
|
||||
|
||||
describe('distributedDeviceManager', function () {
|
||||
const TEST_BUNDLE_NAME = 'com.ohos.distributedjstest';
|
||||
|
||||
let dmInstance = null;
|
||||
|
||||
beforeAll(async function (done) {
|
||||
console.info(('beforeAll called'));
|
||||
done();
|
||||
})
|
||||
|
||||
beforeEach(async function (done) {
|
||||
console.info(('beforeEach called'));
|
||||
done();
|
||||
})
|
||||
|
||||
afterEach(async function (done) {
|
||||
console.info('afterEach called');
|
||||
setTimeout(done, 4000);
|
||||
done();
|
||||
})
|
||||
|
||||
afterAll(async function (done) {
|
||||
console.info('afterAll called');
|
||||
done();
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0100
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0100", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_0100 start------------------------");
|
||||
|
||||
dmInstance = deviceManager.createDeviceManager(TEST_BUNDLE_NAME);
|
||||
if (!dmInstance) {
|
||||
console.error("createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
console.info("createDeviceManager success");
|
||||
expect(dmInstance !== null).assertTrue();
|
||||
done();
|
||||
console.info("-----------------SUB_DH_Device_Dcts_0100 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0200
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0200", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0200 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("serviceDie", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0200 deviceManager.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0200 deviceManager.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_0200 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0300
|
||||
* @tc.name Start to discover nearby devices.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0300", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0300 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("discoverFailure", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0300 deviceManager.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0300 deviceManager.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_0300 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_DeviceManager_Dcts_0300
|
||||
* @tc.name Get the network id of the local device
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0400", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0400 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("deviceNameChange", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0400 deviceManager.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0400 deviceManager.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0400 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0500
|
||||
* @tc.name Get a list of available devices. This interface query all authorized and connectable devices.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0500", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0500 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("discoverSuccess", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0500 deviceManager.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0500 deviceManager.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0500 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0600
|
||||
* @tc.name Get a list of available devices. This interface query all authorized and connectable devices.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0600", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0600 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("deviceStateChange", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0600 deviceManager.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0600 deviceManager.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0600 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0700
|
||||
* @tc.name Get a list of available devices. This interface query all authorized and connectable devices.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0700", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0700 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("serviceDie", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0700 deviceManager.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0700 deviceManager.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0700 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0800
|
||||
* @tc.name Get the device name of the local device.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0800", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0800 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("discoverFailure", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0800 deviceManager.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0800 deviceManager.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0800 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_0900
|
||||
* @tc.name Get the device name of the local device.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_0900", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0900 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("deviceNameChange", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_0900 deviceManager.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_0900 deviceManager.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_0900 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1000
|
||||
* @tc.name Get the device type of the local device
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1000", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_1000 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("discoverSuccess", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_1000 deviceManager.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1000 deviceManager.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_1000 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1100
|
||||
* @tc.name Get the device id of the local device
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1100", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_1100 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("deviceStateChange", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_1100 deviceManager.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1100 deviceManager.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_1100 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1200
|
||||
* @tc.name Get the device name by network id.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1200", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1200 start------------------------");
|
||||
try {
|
||||
dmInstance.getAvailableDeviceList();
|
||||
console.error("in SUB_DH_Device_Dcts_1200 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1200 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1200 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1300
|
||||
* @tc.name Get the device type by network id.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1300", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1300 start------------------------");
|
||||
try {
|
||||
dmInstance.getAvailableDeviceList((error, data) => {
|
||||
console.info("in SUB_DH_Device_Dcts_1300 success without permission");
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info("in SUB_DH_Device_Dcts_1300 failed, code is ${error.code}, message is ${error.message}");
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1300 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1400
|
||||
* @tc.name Unbind the specified target.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1400", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1400 start------------------------");
|
||||
try {
|
||||
dmInstance.bindTarget("deviceId", {
|
||||
"bindType" : 1,
|
||||
"targetPkgName" : "com.ohos.distributedDeviceManager",
|
||||
"appName" : "SubDctsDeviceJsTest",
|
||||
"appOperation": "想要连接本机。",
|
||||
"customDescription": "device manager"
|
||||
}, (error, data) => {
|
||||
if (error) {
|
||||
console.info("in SUB_DH_Device_Dcts_1400 failed, code is ${error.code}, message is ${error.message}");
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
} else {
|
||||
console.error("in SUB_DH_Device_Dcts_1400 success without permission, data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1400 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1400 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1500
|
||||
* @tc.name Stop discovering nearby devices.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1500", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1500 start------------------------");
|
||||
try {
|
||||
dmInstance.unbindTarget("deviceId");
|
||||
console.error("in SUB_DH_Device_Dcts_1500 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1500 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1500 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1600
|
||||
* @tc.name Releases the {@code DeviceManager} instance that is no longer used.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1600", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1600 start------------------------");
|
||||
try {
|
||||
dmInstance.startDiscovering({"discoverTargetType":1});
|
||||
console.error("in SUB_DH_Device_Dcts_1600 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1600 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1600 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1700
|
||||
* @tc.name Releases the {@code DeviceManager} instance that is no longer used.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1700", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1700 start------------------------");
|
||||
try {
|
||||
dmInstance.stopDiscovering();
|
||||
console.error("in SUB_DH_Device_Dcts_1700 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1700 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1700 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1800
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1800", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1800 start------------------------");
|
||||
try {
|
||||
dmInstance.getAvailableDeviceListSync();
|
||||
console.error("in SUB_DH_Device_Dcts_1800 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1800 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1800 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_1900
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_1900", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1900 start------------------------");
|
||||
try {
|
||||
dmInstance.getLocalDeviceType();
|
||||
console.error("in SUB_DH_Device_Dcts_1900 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_1900 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_1900 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2000
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2000", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2000 start------------------------");
|
||||
try {
|
||||
dmInstance.getLocalDeviceName();
|
||||
console.error("in SUB_DH_Device_Dcts_2000 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_2000 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2000 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2100
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2100", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2100 start------------------------");
|
||||
try {
|
||||
dmInstance.getLocalDeviceNetworkId();
|
||||
console.error("in SUB_DH_Device_Dcts_2100 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_2100 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2100 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2200
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2200", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2200 start------------------------");
|
||||
try {
|
||||
dmInstance.getLocalDeviceId();
|
||||
console.error("in SUB_DH_Device_Dcts_2200 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_2200 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2200 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2300
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2300", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_2300 begin---------------------------");
|
||||
try {
|
||||
dmInstance.on("replyResult", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_2300 replyResult.on success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_2300 replyResult.on failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2300 end------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2400
|
||||
* @tc.name Get the device name of the local device.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2400", 0, async function (done) {
|
||||
console.info("----------------------SUB_DH_Device_Dcts_2400 begin---------------------------");
|
||||
try {
|
||||
dmInstance.off("replyResult", (data) => {
|
||||
console.error("in SUB_DH_Device_Dcts_2400 replyResult.off success without permission , data:" + JSON.stringify(data));
|
||||
expect().assertFail();
|
||||
done();
|
||||
});
|
||||
} catch (error) {
|
||||
console.info(`in SUB_DH_Device_Dcts_2400 replyResult.off failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("----------------------SUB_DH_Device_Dcts_2400 end---------------------------");
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DH_Device_Dcts_2500
|
||||
* @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.
|
||||
* @tc.desc Function test
|
||||
* @tc.size MediumTest
|
||||
* @tc.type: Function
|
||||
* @tc.level Level1
|
||||
*/
|
||||
it("SUB_DH_Device_Dcts_2500", 0, async function (done) {
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2500 start------------------------");
|
||||
let operation = 0;
|
||||
try {
|
||||
dmInstance.replyUiAction(operation, 'extra');
|
||||
console.error("in replyUiAction SUB_DH_Device_Dcts_2500 success without permission ");
|
||||
expect().assertFail();
|
||||
done();
|
||||
} catch (error) {
|
||||
console.info(`in replyUiAction SUB_DH_Device_Dcts_2500 failed, code is ${error.code}, message is ${error.message}`);
|
||||
expect(error.code == 201).assertTrue();
|
||||
done();
|
||||
}
|
||||
console.info("-----------------SUB_DH_Device_Dcts_2500 end------------------------");
|
||||
})
|
||||
})
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "distributedscreenjstest"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "JS_Phone_Empty device"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "distributedscreenjstest"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "TestAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "TestAbility_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@ -16,7 +16,7 @@ import("$base_root/test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "dcts/distributedhardware"
|
||||
|
||||
ohos_moduletest_suite("SubDctsdisAudioNewTest") {
|
||||
ohos_moduletest_suite("DctsSubdAudioNewTest") {
|
||||
module_out_path = module_output_path
|
||||
include_dirs = [
|
||||
"$base_root/drivers\peripheral\audio\interfaces\include",
|
||||
@ -90,7 +90,7 @@ ohos_moduletest_suite("SubDctsdisAudioNewTest") {
|
||||
|
||||
defines = [
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"SubDctsdisAudioNewTest\"",
|
||||
"DH_LOG_TAG=\"DctsSubdAudioNewTest\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Config for disCamera test cases",
|
||||
"driver": {
|
||||
"module-name": "SubDctsdisAudioNewTest",
|
||||
"module-name": "DctsSubdAudioNewTest",
|
||||
"native-test-timeout": "120000",
|
||||
"native-test-device-path": "/data/local/tmp",
|
||||
"runtime-hint": "1s",
|
||||
@ -13,7 +13,7 @@
|
||||
"chmod -R 777 /data/local/tmp/*"
|
||||
],
|
||||
"push": [
|
||||
"SubDctsdisAudioNewTest->/data/local/tmp/SubDctsdisAudioNewTest"
|
||||
"DctsSubdAudioNewTest->/data/local/tmp/DctsSubdAudioNewTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "dcts/distributedhardware"
|
||||
|
||||
ohos_moduletest_suite("SubDctsdisAudioTest") {
|
||||
ohos_moduletest_suite("DctsSubAudioTest") {
|
||||
module_out_path = module_output_path
|
||||
include_dirs = [
|
||||
"$base_root/drivers\peripheral\audio\interfaces\include",
|
||||
@ -43,7 +43,7 @@ ohos_moduletest_suite("SubDctsdisAudioTest") {
|
||||
|
||||
defines = [
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"SubDctsdisAudioTest\"",
|
||||
"DH_LOG_TAG=\"DctsSubAudioTest\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"description": "Config for disCamera test cases",
|
||||
"driver": {
|
||||
"module-name": "SubDctsdisAudioTest",
|
||||
"module-name": "DctsSubAudioTest",
|
||||
"native-test-timeout": "120000",
|
||||
"native-test-device-path": "/data/local/tmp",
|
||||
"runtime-hint": "1s",
|
||||
@ -13,7 +13,7 @@
|
||||
"chmod -R 777 /data/local/tmp/*"
|
||||
],
|
||||
"push": [
|
||||
"SubDctsdisAudioTest->/data/local/tmp/SubDctsdisAudioTest"
|
||||
"DctsSubAudioTest->/data/local/tmp/DctsSubAudioTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
|
@ -215,6 +215,7 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0700, TestSize.Level1)
|
||||
serviceProfile10.SetServiceType("serviceType10");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_ = nullptr;
|
||||
DeviceProfileManager::GetInstance().isFirst_.store(true);
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile10);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
@ -236,6 +237,7 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0800, TestSize.Level1)
|
||||
serviceProfile11.SetServiceType("serviceType11");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
DeviceProfileManager::GetInstance().isFirst_.store(true);
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile11);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
@ -397,6 +399,7 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1500, TestSize.Level1)
|
||||
charProfile11.SetCharacteristicValue("characteristicValue11");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
DeviceProfileManager::GetInstance().isFirst_.store(true);
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile11);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
|
Loading…
Reference in New Issue
Block a user