未验证 提交 3fddfae2 编写于 作者: O openharmony_ci 提交者: Gitee

!1888 【分布式硬件】新增unAuthenticateDevice/getLocalDeviceInfo/getLocalDeviceInfoSync接口测试套

Merge pull request !1888 from zeng_xingdong/master
/*
* Copyright (C) 2021 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 app from '@system.app'; import app from '@system.app';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import deviceManager from '@ohos.distributedHardware.deviceManager' import deviceManager from '@ohos.distributedHardware.deviceManager'
var dmClass;
describe('deviceManagerTest', function() { describe('deviceManagerTest', function() {
console.log("---deviceManager接口测试---")
/* /*
* @tc.number deviceManagerTest_createDeviceManager_0100 * @tc.number deviceManagerTest_createDeviceManager_0100
* @tc.name Pass in the correct package name * @tc.name correct Packagesname for createDeviceManager
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('deviceManagerTest_createDeviceManager_0100', 0, async function (done) { it('deviceManagerTest_createDeviceManager_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_createDeviceManager_0100----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0100----------");
var result = await deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertUndefined();
}); });
expect(result == undefined).assertTrue();
console.log("----------stop running deviceManagerTest_createDeviceManager_0100----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_createDeviceManager_0200 * @tc.number deviceManagerTest_createDeviceManager_0200
* @tc.name Pass in an empty package name * @tc.name null Packagesname for createDeviceManager
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 3
*/ */
it('deviceManagerTest_createDeviceManager_0200', 0, async function (done) { it('deviceManagerTest_createDeviceManager_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_createDeviceManager_0200----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0200----------");
var result = deviceManager.createDeviceManager('', (err, data) => { deviceManager.createDeviceManager('', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull();
}); });
expect(result == undefined).assertTrue();
console.log("----------stop running deviceManagerTest_createDeviceManager_0200----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0200----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_createDeviceManager_0300 * @tc.number deviceManagerTest_createDeviceManager_0300
* @tc.name Pass in malformed package name * @tc.name incorrect Packagesname for createDeviceManager
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 3
*/ */
it('deviceManagerTest_createDeviceManager_0300', 0, async function (done) { it('deviceManagerTest_createDeviceManager_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_createDeviceManager_0300----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0300----------");
var result = deviceManager.createDeviceManager('comohosdevicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('comohosdevicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull();
}); });
expect(result == undefined).assertTrue();
console.log("----------stop running deviceManagerTest_createDeviceManager_0300----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0300----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_createDeviceManager_0400 * @tc.number deviceManagerTest_createDeviceManager_0400
* @tc.name Incorrect package name passed in * @tc.name incorrect Packagesname case2 for createDeviceManager
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 3
*/ */
it('deviceManagerTest_createDeviceManager_0400', 0, async function (done) { it('deviceManagerTest_createDeviceManager_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_createDeviceManager_0400----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0400----------");
var result = deviceManager.createDeviceManager('com.ohos.123', (err, data) => { deviceManager.createDeviceManager('com.ohos.123', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull();
}); });
expect(result == undefined).assertTrue();
console.log("----------stop running deviceManagerTest_createDeviceManager_0400----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0400----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_createDeviceManager_0500 * @tc.number deviceManagerTest_createDeviceManager_0500
* @tc.name Pass in a package name with special characters * @tc.name special Packagesname for createDeviceManager
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 3
*/ */
it('deviceManagerTest_createDeviceManager_0500', 0, async function (done) { it('deviceManagerTest_createDeviceManager_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_createDeviceManager_0500----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0500----------");
var result = deviceManager.createDeviceManager('com#ohos%devicemangagerdemo&*', (err, data) => { deviceManager.createDeviceManager('com#ohos%devicemangagerdemo&*', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull();
}); });
expect(result == undefined).assertTrue();
console.log("----------stop running deviceManagerTest_createDeviceManager_0500----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0500----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0100 * @tc.number deviceManagerTest_startDeviceDiscovery_0100
* @tc.name Discover device Test with ACTIVE mode * @tc.name correct deviceinfo for startDeviceDiscovery with different para 1
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 3
*/ */
it('deviceManagerTest_startDeviceDiscovery_0100', 0, async function (done) { it('deviceManagerTest_startDeviceDiscovery_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
...@@ -108,2906 +120,659 @@ describe('deviceManagerTest', function() { ...@@ -108,2906 +120,659 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){
dmClass = data; var info = {
dmStartDeviceDiscovery(); "subscribeId": 2115,
},1000); "mode": DISCOVER_MODE_ACTIVE,
}); "medium": AUTO,
async function dmStartDeviceDiscovery(){ "freq": LOW,
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var discoverModePassive = 0x55;
var auto = 0;
var low = 0;
var subscribeCapAbilityDDMP = 0;
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": discoverModePassive,
"medium": auto,
"freq": low,
"isSameAccount": false, "isSameAccount": false,
"isWakeRemote": true, "isWakeRemote": true,
"capability": subscribeCapAbilityDDMP "capability": 0
}; };
var start = dmClass.startDeviceDiscovery(subscribeInfo); var start = data.startDeviceDiscovery(info);
expect(start == undefined).assertTrue(); expect(start).assertUndefined();
} });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0200 * @tc.number deviceManagerTest_startDeviceDiscovery_0110
* @tc.name Discover device Test with PASSIVE mode * @tc.name correct deviceinfo for startDeviceDiscovery with different para 2
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 3
*/ */
it('deviceManagerTest_startDeviceDiscovery_0200', 0, async function (done) { it('deviceManagerTest_startDeviceDiscovery_0110', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0200----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){
dmClass = data; var info = {
dmStartDeviceDiscovery(); "subscribeId": 2115,
},1000); "mode": DISCOVER_MODE_PASSIVE,
}); "medium": BLE,
async function dmStartDeviceDiscovery(){ "freq": MID,
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var discoverModePassive = 0x55;
var ble = 1;
var mid = 1;
var subscribeCapAbilityDDMP = 0;
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": discoverModePassive,
"medium": ble,
"freq": mid,
"isSameAccount": false, "isSameAccount": false,
"isWakeRemote": true, "isWakeRemote": true,
"capability": subscribeCapAbilityDDMP "capability": SUBSCRIBE_CAPABILITY_OSD
}; };
var start = dmClass.startDeviceDiscovery(subscribeInfo); var start = data.startDeviceDiscovery(info);
expect(start == undefined).assertTrue(); expect(start).assertUndefined();
} });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0200----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0300 * @tc.number deviceManagerTest_startDeviceDiscovery_0120
* @tc.name Incoming normal device information,DiscoverMode is DISCOVER_MODE_ACTIVE, * @tc.name correct deviceinfo for startDeviceDiscovery with different para 3
ExchangeMedium is COAP,ExchangeFreq is HIGH,SubscribeCap is SUBSCRIBE_CAPABILITY_DDMP
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 3
*/ */
it('deviceManagerTest_startDeviceDiscovery_0300', 0, async function (done) { it('deviceManagerTest_startDeviceDiscovery_0120', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0300----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){
dmClass = data; var info = {
dmStartDeviceDiscovery(); "subscribeId": 2115,
},1000); "mode": DISCOVER_MODE_PASSIVE,
}); "medium": COAP,
async function dmStartDeviceDiscovery(){ "freq": SUPER_HIGH,
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var discoverModeActive = 0xAA;
var coap = 2;
var high = 2;
var subscribeCapAbilityDDMP = 0;
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": discoverModeActive,
"medium": coap,
"freq": high,
"isSameAccount": false, "isSameAccount": false,
"isWakeRemote": true, "isWakeRemote": true,
"capability": subscribeCapAbilityDDMP "capability": SUBSCRIBE_CAPABILITY_DDMP
}; };
var start = dmClass.startDeviceDiscovery(subscribeInfo); var start = data.startDeviceDiscovery(info);
expect(start == undefined).assertTrue(); expect(start).assertUndefined();
} });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0300----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0400 * @tc.number deviceManagerTest_release_0100
* @tc.name DeviceDiscovery with ACTIVE mode * @tc.name testcase for release
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 1
*/ */
it('deviceManagerTest_startDeviceDiscovery_0400', 0, async function (done) { it('deviceManagerTest_release_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0400----------"); console.log("----------start running deviceManagerTest_release_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var re = data.release();
dmClass = data; expect(re).assertUndefined();
dmStartDeviceDiscovery();
},1000);
}); });
async function dmStartDeviceDiscovery(){ console.log("----------stop running deviceManagerTest_release_0100----------");
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var discoverModeActive = 0xAA;
var usb = 3;
var superHigh = 3;
var subscribeCapAbilityDDMP = 0;
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": discoverModeActive,
"medium": usb,
"freq": superHigh,
"isSameAccount": false,
"isWakeRemote": true,
"capability": subscribeCapAbilityDDMP
};
var start = dmClass.startDeviceDiscovery(subscribeInfo);
expect(start == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0400----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0500 * @tc.number deviceManagerTest_getTrustedDeviceListSync_0100
* @tc.name DeviceDiscovery with PASSIVE mode * @tc.name testcase for getTrustedDeviceListSync
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_startDeviceDiscovery_0500', 0, async function (done) { it('deviceManagerTest_getTrustedDeviceListSync_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0500----------"); console.log("----------start running deviceManagerTest_getTrustedDeviceListSync_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var array = data.getTrustedDeviceListSync();
dmClass = data; expect(array).assertUndefined();
dmStartDeviceDiscovery();
},1000);
}); });
async function dmStartDeviceDiscovery(){ console.log("----------stop running deviceManagerTest_getTrustedDeviceListSync_0100----------");
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var discoverModePassive = 0x55;
var auto = 0;
var low = 0;
var subscribeCapAbilityOSD = 1;
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": discoverModePassive,
"medium": auto,
"freq": low,
"isSameAccount": false,
"isWakeRemote": true,
"capability": subscribeCapAbilityOSD
};
var start = dmClass.startDeviceDiscovery(subscribeInfo);
expect(start == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0500----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_startDeviceDiscovery_0600 * @tc.number deviceManagerTest_stopDeviceDiscovery_0100
* @tc.name Pass in empty device information * @tc.name testcase for stopDeviceDiscovery
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_startDeviceDiscovery_0600', 0, async function (done) { it('deviceManagerTest_stopDeviceDiscovery_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0600----------"); console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var subscribeId = 2115;
dmClass = data; var start = data.stopDeviceDiscovery(subscribeId);
dmStartDeviceDiscovery(); expect(start).assertUndefined();
},1000);
}); });
async function dmStartDeviceDiscovery(){ console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0100----------");
var subscribeInfo = {};
try{
var start = dmClass.startDeviceDiscovery(subscribeInfo);
expect(start == undefined).assertFail();
}catch(e){
console.log('error is: '+ e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0600----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_release_0100 * @tc.number deviceManagerTest_getLocalDeviceInfoSync_0100
* @tc.name Call the release interface normally * @tc.name call getLocalDeviceInfoSync interface
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 1
*/ */
it('deviceManagerTest_release_0100', 0, async function (done) { it('deviceManagerTest_getLocalDeviceInfoSync_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_release_0100----------"); console.log("----------start running deviceManagerTest_getLocalDeviceInfoSync_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
dmClass = data; dmClass = data;
dmRelease(); dmGetLocalDeviceInfoSync();
},1000); },1000);
}); });
async function dmRelease(){ async function dmGetLocalDeviceInfoSync(){
var re = dmClass.release(); var deviceInfo = dmClass.getLocalDeviceInfoSync();
expect(re == undefined).assertTrue(); expect(deviceInfo.deviceId != null).assertTrue();
} }
console.log("----------stop running deviceManagerTest_release_0100----------"); console.log("----------stop running deviceManagerTest_getLocalDeviceInfoSync_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList1_0100 * @tc.number deviceManagerTest_getLocalDeviceInfo1_0100
* @tc.name Call the dmGetTrustedDeviceList1 interface normally * @tc.name Call the getLocalDeviceInfo interface
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList1_0100', 0, async function (done) { it('deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList1_0100----------"); console.log("----------start running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
dmClass = data; dmClass = data;
dmGetTrustedDeviceList1(); getLocalDeviceInfo1();
},1000); },1000);
}); });
async function dmGetTrustedDeviceList1(){ async function getLocalDeviceInfo1(){
var result = dmClass.getTrustedDeviceList((err, data) => { var deviceInfo = dmClass.getLocalDeviceInfo((err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){
dmClass = data;
dmCheckResult();
},1000);
}); });
async function dmCheckResult(){ expect(deviceInfo == undefined).assertTrue();
expect(result == undefined).assertTrue();
}
} }
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList1_0100----------"); console.log("----------stop running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList1_0200 * @tc.number deviceManagerTest_getLocalDeviceInfo(promise)_0100
* @tc.name When an incorrect package name is passed in, the dmGetTrustedDeviceList1 interface is called * @tc.name Call the getLocalDeviceInfo interface
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 0
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList1_0200', 0, async function (done) { it('deviceManagerTest_getLocalDeviceInfo(promise)_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList1_0200----------"); console.log("----------start running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
deviceManager.createDeviceManager('comohosdevicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
dmClass = data; dmClass = data;
dmGetTrustedDeviceList1(); getLocalDeviceInfo2();
},1000); },1000);
}); });
async function dmGetTrustedDeviceList1(){ async function getLocalDeviceInfo2(){
var result = dmClass.getTrustedDeviceList((err, data) => { var deviceInfo = dmClass.getLocalDeviceInfo().then(data => {
if (err) { // console.log('data is :' + data)
expect().assertFail(); })
} // console.log('promise is : ' + JSON.stringify(deviceInfo))
setTimeout(function(){ expect(deviceInfo != null).assertTrue();
dmCheckResult();
},1000);
});
async function dmCheckResult(){
expect(result == undefined).assertTrue();
}
} }
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList1_0200----------"); console.log("----------stop running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0100 * @tc.number deviceManagerTest_authenticateDevice_0100
* @tc.name Pass in normal parameters(FilterOption),sortType is 0 * @tc.name testcase for authenticateDevice in correct deviceType para with WEARABLE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0100', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: WEARABLE
}); }
async function dmGetTrustedDeviceList2(){ let extraInfo = {
var mFilterOption = { "targetPkgName": 'com.ohos.devicemangagerdemo',
targetPkgName : "com.ohos.devicemanagerui", "appName": "myapplication",
sortType : 0, "appDescription": "apply auth",
filter : JSON.stringify({key : 'test', value : 0}) "business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
} }
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var token = data.pinToken;
dmCheckResult(); expect(token).assertNotNull();
},1000);
}); });
async function dmCheckResult(){ });
expect(result == undefined).assertTrue(); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0200 * @tc.number deviceManagerTest_authenticateDevice_0110
* @tc.name Pass in normal parameters(FilterOption),sortType is 1 * @tc.name testcase for authenticateDevice in correct deviceType para with SPEAKER
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0200', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0110', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0200----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: SPEAKER
}); }
async function dmGetTrustedDeviceList2(){ let extraInfo = {
var mFilterOption = { "targetPkgName": 'com.ohos.devicemangagerdemo',
targetPkgName : "com.ohos.devicemanagerui", "appName": "myapplication",
sortType : 1, "appDescription": "apply auth",
filter : JSON.stringify({key : 'test', value : 0}) "business": '0',
"displayOwner": 0
} }
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => { let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var token = data.pinToken;
dmCheckResult(); expect(token).assertNotNull();
},1000);
}); });
async function dmCheckResult(){ });
expect(result == undefined).assertTrue(); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0200----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0300 * @tc.number deviceManagerTest_authenticateDevice_0120
* @tc.name Pass in normal parameters(FilterOption),sortType is 2 * @tc.name testcase for authenticateDevice in correct deviceType para with PHONE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0300', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0120', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0300----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: PHONE
}); }
async function dmGetTrustedDeviceList2(){ let extraInfo = {
var mFilterOption = { "targetPkgName": 'com.ohos.devicemangagerdemo',
targetPkgName : "com.ohos.devicemanagerui", "appName": "myapplication",
sortType : 2, "appDescription": "apply auth",
filter : JSON.stringify({key : 'test', value : 0}) "business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
} }
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var token = data.pinToken;
dmCheckResult(); expect(token).assertNotNull();
},1000);
}); });
async function dmCheckResult(){ });
console.log("3333" + result) console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
expect(result == undefined).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0300----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0400 * @tc.number deviceManagerTest_authenticateDevice_0130
* @tc.name Pass in normal parameters(FilterOption),targetPkgName is null * @tc.name testcase for authenticateDevice in correct deviceType para with TABLET
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0400', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0130', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0400----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: TABLET
}); }
async function dmGetTrustedDeviceList2(){ let extraInfo = {
var mFilterOption = { "targetPkgName": 'com.ohos.devicemangagerdemo',
targetPkgName : "", "appName": "myapplication",
sortType : 0, "appDescription": "apply auth",
filter : JSON.stringify({key : 'test', value : 0}) "business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
} }
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var token = data.pinToken;
dmCheckResult(); expect(token).assertNotNull();
},1000);
}); });
async function dmCheckResult(){ });
expect(result == undefined).assertTrue(); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0400----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0500 * @tc.number deviceManagerTest_authenticateDevice_0140
* @tc.name Pass in normal parameters(FilterOption),filter is null * @tc.name testcase for authenticateDevice in correct deviceType para with CAR
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0500', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0140', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0500----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: CAR
}); }
async function dmGetTrustedDeviceList2(){ let extraInfo = {
var mFilterOption = { "targetPkgName": 'com.ohos.devicemangagerdemo',
targetPkgName : "com.ohos.devicemanagerui", "appName": "myapplication",
sortType : 0, "appDescription": "apply auth",
filter : JSON.stringify({}) "business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
} }
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var token = data.pinToken;
dmCheckResult(); expect(token).assertNotNull();
})
}); });
async function dmCheckResult(){ });
expect(result == undefined).assertTrue(); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0500----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0600 * @tc.number deviceManagerTest_authenticateDevice_0150
* @tc.name Pass in null parameter * @tc.name testcase for authenticateDevice in correct deviceType para with TV
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_dmGetTrustedDeviceList2_0600', 0, async function (done) { it('deviceManagerTest_authenticateDevice_0150', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0600----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let deviceInfo = {
dmClass = data; deviceId: "",
dmGetTrustedDeviceList2(); deviceName: "",
},1000); deviceType: TV
});
async function dmGetTrustedDeviceList2(){
try{
var result = dmClass.getTrustedDeviceList('', (err, data) => {
if (err) {
expect().assertFail();
}
});
}catch(e){
console.log('error is : ' + e);
expect(e != null).assertTrue();
} }
} let extraInfo = {
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0600----------"); "targetPkgName": 'com.ohos.devicemangagerdemo',
done(); "appName": "myapplication",
}) "appDescription": "apply auth",
"business": '0',
/* "displayOwner": 0
* @tc.number deviceManagerTest_dmGetTrustedDeviceList2_0700
* @tc.name Pass in normal parameters(FilterOption),sortType is not in enum
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_dmGetTrustedDeviceList2_0700', 0, async function (done) {
console.log("----------start running deviceManagerTest_dmGetTrustedDeviceList2_0700----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList2();
},1000);
});
async function dmGetTrustedDeviceList2(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 5,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption, (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmCheckResult();
},1000);
});
async function dmCheckResult(){
expect(dmClass == undefined).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_dmGetTrustedDeviceList2_0700----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0100
* @tc.name Pass in normal parameters(FilterOption),sortType is 0
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 0,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0200
* @tc.name Pass in normal parameters(FilterOption),sortType is 1
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 1,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('data is :' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0300
* @tc.name Pass in normal parameters(FilterOption),sortType is 2
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 2,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0400
* @tc.name Pass in normal parameters(FilterOption),targetPkgName is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "",
sortType : 0,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0500
* @tc.name Pass in normal parameters(FilterOption),filter is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 0,
filter : JSON.stringify({})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0600
* @tc.name Pass in null parameter
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0600', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0600----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
try{
var result = dmClass.getTrustedDeviceList('').then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
}catch(e){
console.log('error is :' + e);
expect(e = null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0600----------");
done();
})
/*
* @tc.number deviceManagerTest_getTrustedDeviceList(promise)_0700
* @tc.name Pass in normal parameters(FilterOption),sortType is not in enum
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getTrustedDeviceList(promise)_0700', 0, async function (done) {
console.log("----------start running deviceManagerTest_getTrustedDeviceList(promise)_0700----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetTrustedDeviceList3();
},1000);
});
async function dmGetTrustedDeviceList3(){
var mFilterOption = {
targetPkgName : "com.ohos.devicemanagerui",
sortType : 5,
filter : JSON.stringify({key : 'test', value : 0})
}
var result = dmClass.getTrustedDeviceList(mFilterOption).then(data => {
// console.log('22222222222' + JSON.stringify(data))
})
setTimeout(function(){
dmCheckResult();
},1000);
async function dmCheckResult(){
// console.log('promise is : ' + JSON.stringify(result))
expect(result != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_getTrustedDeviceList(promise)_0700----------");
done();
})
/*
* @tc.number deviceManagerTest_stopDeviceDiscovery_0100
* @tc.name Pass in the normal subscribeid
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_stopDeviceDiscovery_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStopDeviceDiscovery();
})
});
async function dmStopDeviceDiscovery(){
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var result = dmClass.stopDeviceDiscovery(subscribeId);
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_stopDeviceDiscovery_0200
* @tc.name Subscribeid passed in null value
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_stopDeviceDiscovery_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStopDeviceDiscovery();
})
});
async function dmStopDeviceDiscovery(){
try{
var subscribeId = '';
var result = dmClass.stopDeviceDiscovery(subscribeId);
}catch(e){
console.log('error is: '+ e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_stopDeviceDiscovery_0300
* @tc.name Subscribeid pass in special symbol
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_stopDeviceDiscovery_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStopDeviceDiscovery();
})
});
async function dmStopDeviceDiscovery(){
try{
var subscribeId = '$%^&*';
var result = dmClass.stopDeviceDiscovery(subscribeId);
}catch(e){
console.log('error is: '+ e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_stopDeviceDiscovery_0400
* @tc.name Subscribeid pass in letter
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_stopDeviceDiscovery_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStopDeviceDiscovery();
})
});
async function dmStopDeviceDiscovery(){
try{
var subscribeId = 'abcdefg';
var result = dmClass.stopDeviceDiscovery(subscribeId);
expect(result != null).assertFail();
}catch(e){
console.log('error is: '+ e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0100
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is UNKNOWN_TYPE
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_authenticateDevice_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
})
});
async function dmAuthenticateDevice(){
var unknownType = 0;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: unknownType
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue()
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0200
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is SPEAKER
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
})
});
async function dmAuthenticateDevice(){
var speaker = 0x0A;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: speaker
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue()
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0300
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is PHONE
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
})
});
async function dmAuthenticateDevice(){
var phone = 0x0E;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: phone
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0400
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is TABLET
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
})
});
async function dmAuthenticateDevice(){
var tablet = 0x11;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tablet
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue()
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0500
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is WEARABLE
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
},1000);
});
async function dmAuthenticateDevice(){
var wearable = 0x6D;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: wearable
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue()
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0600
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is CAR
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0600', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0600----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
},1000);
});
async function dmAuthenticateDevice(){
var car = 0x83;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: car
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue()
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0600----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0700
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is TV
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0700', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0700----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
},1000);
});
async function dmAuthenticateDevice(){
var tv = 0x9C;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tv
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0700----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0800
* @tc.name DeviceInfo passes in a null value
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0800', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0800----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
},1000);
});
async function dmAuthenticateDevice(){
let deviceInfo = {}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0800----------");
done();
})
/*
* @tc.number deviceManagerTest_authenticateDevice_0900
* @tc.name Pass in the normal deviceInfo、authParam,deviceType is 0
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_authenticateDevice_0900', 0, async function (done) {
console.log("----------start running deviceManagerTest_authenticateDevice_0900----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmAuthenticateDevice();
},1000);
});
async function dmAuthenticateDevice(){
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: 0
}
let extraInfo = {
"targetPkgName": 'com.ohos.devicemangagerdemo',
"appName": "myapplication",
"appDescription": "apply auth",
"business": '0',
"displayOwner": 0
}
let authParam = {
"authType": 1,
"appIcon": new Uint8Array([]),
"appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
}
var result = dmClass.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_authenticateDevice_0900----------");
done();
})
/*
* @tc.number deviceManagerTest_verifyAuthInfo_0100
* @tc.name Pass in the normal authInfo
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_verifyAuthInfo_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_verifyAuthInfo_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmVerifyAuthInfo();
},1000);
});
async function dmVerifyAuthInfo(){
let authInfo = {
"authType": 1,
"token": 12,
"extraInfo": {
"pinCode": 123456,
}
}
var result = dmClass.verifyAuthInfo(authInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_verifyAuthInfo_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_verifyAuthInfo_0200
* @tc.name authType is not number
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_verifyAuthInfo_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_verifyAuthInfo_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmVerifyAuthInfo();
},1000);
});
async function dmVerifyAuthInfo(){
let authInfo = {
"authType": 'asd',
"token": 12,
"extraInfo": {
"pinCode": 123456,
}
}
var result = dmClass.verifyAuthInfo(authInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_verifyAuthInfo_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_verifyAuthInfo_0300
* @tc.name token is not number
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_verifyAuthInfo_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_verifyAuthInfo_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmVerifyAuthInfo();
},1000);
});
async function dmVerifyAuthInfo(){
let authInfo = {
"authType": 1,
"token": 'asd',
"extraInfo": {
"pinCode": 123456,
}
}
var result = dmClass.verifyAuthInfo(authInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_verifyAuthInfo_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_verifyAuthInfo_0400
* @tc.name extraInfo is not number
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_verifyAuthInfo_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_verifyAuthInfo_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmVerifyAuthInfo();
},1000);
});
async function dmVerifyAuthInfo(){
let authInfo = {
"authType": 1,
"token": 12,
"extraInfo": {
"pinCode": 'asd',
}
}
var result = dmClass.verifyAuthInfo(authInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_verifyAuthInfo_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_verifyAuthInfo_0500
* @tc.name AuthInfo passed in null value
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_verifyAuthInfo_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_verifyAuthInfo_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmVerifyAuthInfo();
},1000);
});
async function dmVerifyAuthInfo(){
let authInfo = {}
var result = dmClass.verifyAuthInfo(authInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_verifyAuthInfo_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_getFaParam_0100
* @tc.name Call getFaParam interface normally
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_getFaParam_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_getFaParam_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetFaParam();
},1000);
});
async function dmGetFaParam(){
var faParam = dmClass.getFaParam();
expect(faParam.authParam.extraInfo.pinToken < 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_getFaParam_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0100
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_ALLOW_AUTH
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_setUserOperation_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionAllowAuth = 0;
var operation = actionAllowAuth;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0200
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_CANCEL_AUTH
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionCancelAuth = 1;
var operation = actionCancelAuth;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0300
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_AUTH_CONFIRM_TIMEOUT
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionAuthConfirmTimeOut = 2;
var operation = actionAuthConfirmTimeOut;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0400
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_CANCEL_PINCODE_DISPLAY
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionCancelPinCodeDisplay = 3;
var operation = actionCancelPinCodeDisplay;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0500
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_CANCEL_PINCODE_INPUT
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionCancelPinCodeInput = 4;
var operation = actionCancelPinCodeInput;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0600
* @tc.name Call setuseroperation interface,UserOperationAction is ACTION_CANCEL_CONWIFI_INPUT
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0600', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0600----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
var actionCancelConWifiInput = 5;
var operation = actionCancelConWifiInput;
var faParam = dmClass.setUserOperation(operation);
expect(faParam == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_setUserOperation_0600----------");
done();
})
/*
* @tc.number deviceManagerTest_setUserOperation_0700
* @tc.name Call setuseroperation interface,UserOperationAction is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_setUserOperation_0700', 0, async function (done) {
console.log("----------start running deviceManagerTest_setUserOperation_0700----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmSetUserOperation();
},1000);
});
async function dmSetUserOperation(){
try{
var operation = '';
var faParam = dmClass.setUserOperation(operation);
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_setUserOperation_0700----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0100
* @tc.name Call startconfigurewifi interface,deviceType is unknownType
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_startConfigureWifi_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var unknownType =0;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: unknownType
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0200
* @tc.name Call startconfigurewifi interface,deviceType is SPEAKER
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var speaker = 0x0A;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: speaker
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0300
* @tc.name Call startconfigurewifi interface,deviceType is PHONE
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var phone = 0x0E;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: phone
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0400
* @tc.name Call startconfigurewifi interface,deviceType is TABLET
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var tablet = 0x11;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tablet
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0500
* @tc.name Call startconfigurewifi interface,deviceType is WEARABLE
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0500', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var wearable = 0x6D;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: wearable
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0600
* @tc.name Call startconfigurewifi interface,deviceType is CAR
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0600', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0600----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var car = 0x83;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: car
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0600----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0700
* @tc.name Call startconfigurewifi interface,deviceType is TV
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0700', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0700----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
var tv = 0x9C;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tv
}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0700----------");
done();
})
/*
* @tc.number deviceManagerTest_startConfigureWifi_0800
* @tc.name Call startconfigurewifi interface,deviceInfo is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_startConfigureWifi_0800', 0, async function (done) {
console.log("----------start running deviceManagerTest_startConfigureWifi_0800----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmStartConfigureWifi();
},1000);
});
async function dmStartConfigureWifi(){
let deviceInfo = {}
var token = dmClass.startConfigureWifi(deviceInfo);
expect(token == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_startConfigureWifi_0800----------");
done();
})
/*
* @tc.number deviceManagerTest_configureWifiInfo_0100
* @tc.name Pass in the normal parameter WiFi info
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_configureWifiInfo_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_configureWifiInfo_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmConfigureWifiInfo();
},1000);
});
async function dmConfigureWifiInfo(){
var wifiInfo = {
wifiSsid: 'wifi',
wifiPassword: '12345678'
}
var result = dmClass.configureWifiInfo(wifiInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_configureWifiInfo_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_configureWifiInfo_0200
* @tc.name Pass in the exception parameter WiFi info,wifiPassword is null
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_configureWifiInfo_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_configureWifiInfo_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmConfigureWifiInfo();
},1000);
});
async function dmConfigureWifiInfo(){
var wifiInfo = {
wifiSsid: 'wifi',
wifiPassword: ''
}
var result = dmClass.configureWifiInfo(wifiInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_configureWifiInfo_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_configureWifiInfo_0300
* @tc.name Pass in the exception parameter WiFi info,wifiSsid is null
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_configureWifiInfo_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_configureWifiInfo_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmConfigureWifiInfo();
},1000);
});
async function dmConfigureWifiInfo(){
var wifiInfo = {
wifiSsid: '',
wifiPassword: '12345678'
}
var result = dmClass.configureWifiInfo(wifiInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
console.log('1111111111111111 ' + result)
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_configureWifiInfo_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_configureWifiInfo_0400
* @tc.name Pass in the exception parameter WiFi info,wifiSsid and wifiPassword is null
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_configureWifiInfo_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_configureWifiInfo_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmConfigureWifiInfo();
},1000);
});
async function dmConfigureWifiInfo(){
var wifiInfo = {
wifiSsid: '',
wifiPassword: ''
}
var result = dmClass.configureWifiInfo(wifiInfo, (err, data) => {
if (err) {
expect().assertFail();
}
});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_configureWifiInfo_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceDiscoveredEnable_0100
* @tc.name Pass in normal parameters,IsEnable is false
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceDiscoveredEnable_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceDiscoveredEnable_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceDiscoveredEnable();
},1000);
});
async function dmDeviceDiscoveredEnable(){
var currentState = false;
var discoverResult = dmClass.deviceDiscoveredEnable(currentState);
expect(discoverResult == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_deviceDiscoveredEnable_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceDiscoveredEnable_0200
* @tc.name Pass in normal parameters,IsEnable is true
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceDiscoveredEnable_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceDiscoveredEnable_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceDiscoveredEnable();
},1000);
});
async function dmDeviceDiscoveredEnable(){
var currentState = true;
var discoverResult = dmClass.deviceDiscoveredEnable(currentState);
expect(discoverResult == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_deviceDiscoveredEnable_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceDiscoveredEnable_0200
* @tc.name Pass in normal parameters,IsEnable is string
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceDiscoveredEnable_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceDiscoveredEnable_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceDiscoveredEnable();
},1000);
});
async function dmDeviceDiscoveredEnable(){
try{
var currentState = 'qwe';
var discoverResult = dmClass.deviceDiscoveredEnable(currentState);
expect(discoverResult != null).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_deviceDiscoveredEnable_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceDiscoveredEnable_0400
* @tc.name IsEnable is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_deviceDiscoveredEnable_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceDiscoveredEnable_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceDiscoveredEnable();
},1000);
});
async function dmDeviceDiscoveredEnable(){
try{
var currentState = '';
var discoverResult = dmClass.deviceDiscoveredEnable(currentState);
expect(discoverResult != null).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_deviceDiscoveredEnable_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceMonitorEnable_0100
* @tc.name Pass in normal parameters,IsEnable is false
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceMonitorEnable_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceMonitorEnable_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceMonitorEnable();
},1000);
});
async function dmDeviceMonitorEnable(){
var currentState = false;
var discoverResult = dmClass.deviceMonitorEnable(currentState);
expect(discoverResult == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_deviceMonitorEnable_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceMonitorEnable_0200
* @tc.name Pass in normal parameters,IsEnable is true
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceMonitorEnable_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceMonitorEnable_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceMonitorEnable();
},1000);
});
async function dmDeviceMonitorEnable(){
var currentState = true;
var discoverResult = dmClass.deviceMonitorEnable(currentState);
expect(discoverResult == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_deviceMonitorEnable_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceMonitorEnable_0300
* @tc.name Pass in normal parameters,IsEnable is string
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_deviceMonitorEnable_0300', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceMonitorEnable_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceMonitorEnable();
},1000);
});
async function dmDeviceMonitorEnable(){
try{
var currentState = 'qwe';
var discoverResult = dmClass.deviceMonitorEnable(currentState);
expect(discoverResult != null).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_deviceMonitorEnable_0300----------");
done();
})
/*
* @tc.number deviceManagerTest_deviceMonitorEnable_0400
* @tc.name Pass in normal parameters,IsEnable is null
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_deviceMonitorEnable_0400', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceMonitorEnable_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceMonitorEnable();
},1000);
});
async function dmDeviceMonitorEnable(){
try{
var currentState = '';
var discoverResult = dmClass.deviceMonitorEnable(currentState);
expect(discoverResult != null).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_deviceMonitorEnable_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_getLocalDeviceInfoSync_0100
* @tc.name call getLocalDeviceInfoSync interface
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_getLocalDeviceInfoSync_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_getLocalDeviceInfoSync_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmGetLocalDeviceInfoSync();
},1000);
});
async function dmGetLocalDeviceInfoSync(){
var deviceInfo = dmClass.getLocalDeviceInfoSync();
expect(deviceInfo.deviceId != null).assertTrue();
}
console.log("----------stop running deviceManagerTest_getLocalDeviceInfoSync_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_getLocalDeviceInfo1_0100
* @tc.name Call the getLocalDeviceInfo interface
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
getLocalDeviceInfo1();
},1000);
});
async function getLocalDeviceInfo1(){
var deviceInfo = dmClass.getLocalDeviceInfo((err, data) => {
if (err) {
expect().assertFail();
}
});
expect(deviceInfo == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_getLocalDeviceInfo(promise)_0100
* @tc.name Call the getLocalDeviceInfo interface
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_getLocalDeviceInfo(promise)_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
getLocalDeviceInfo2();
},1000);
});
async function getLocalDeviceInfo2(){
var deviceInfo = dmClass.getLocalDeviceInfo().then(data => {
// console.log('data is :' + data)
})
// console.log('promise is : ' + JSON.stringify(deviceInfo))
expect(deviceInfo != null).assertTrue();
}
console.log("----------stop running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0100
* @tc.name Call the removeTrustedDevice interface,deviceType is UNKNOWN_TYPE
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0100', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmRemoveTrustedDevice();
},1000);
})
async function dmRemoveTrustedDevice(){
var unknownType = 0;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: unknownType
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0100----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0200
* @tc.name Call the removeTrustedDevice interface,deviceType is SPEAKER
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0200', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmRemoveTrustedDevice();
},1000);
})
async function dmRemoveTrustedDevice(){
var speaker = 0x0A;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: speaker
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0200----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0300
* @tc.name Call the removeTrustedDevice interface,deviceType is PHONE
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0300', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0300----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmRemoveTrustedDevice();
},1000);
})
async function dmRemoveTrustedDevice(){
var phone = 0x0E;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: phone
} }
var info = dmClass.removeTrustedDevice(deviceInfo); let authParam = {
expect(info == 0).assertTrue(); "authType": 1,
} "appIcon": new Uint8Array([]),
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0300----------"); "appThumbnail": new Uint8Array([]),
done(); "extraInfo": extraInfo
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0400
* @tc.name Call the removeTrustedDevice interface,deviceType is TABLET
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0400', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0400----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
} }
setTimeout(function(){ data.authenticateDevice(deviceInfo, authParam, (err, data) => {
dmClass = data; if (err) {
dmRemoveTrustedDevice(); expect().assertFail();
},1000); }
var token = data.pinToken;
expect(token).assertNotNull();
});
}); });
async function dmRemoveTrustedDevice(){ console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
var tablet = 0x11;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tablet
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0400----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0500
* @tc.name Call the removeTrustedDevice interface,deviceType is WEARABLE
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0500', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0500----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmRemoveTrustedDevice();
},1000);
})
async function dmRemoveTrustedDevice(){
var wearable = 0x6D;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: wearable
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0500----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0600
* @tc.name Call the removeTrustedDevice interface,deviceType is CAR
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0600', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0600----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmRemoveTrustedDevice();
},1000);
})
async function dmRemoveTrustedDevice(){
var car = 0x83;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: car
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0600----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_removeTrustedDevice_0700 * @tc.number deviceManagerTest_authenticateDevice_0100
* @tc.name Call the removeTrustedDevice interface,deviceType is TV * @tc.name testcase two for authenticateDevice in correct para
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_removeTrustedDevice_0700', 0, async function(done){ it('deviceManagerTest_authenticateDevice_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_removeTrustedDevice_0700----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{ deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if(err){ if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ let authInfo = {
dmClass = data; "authType": 1,
dmRemoveTrustedDevice(); "token": 12,
},1000); "extraInfo": {
}) "pinCode": 123456,
async function dmRemoveTrustedDevice(){ }
var tv = 0x9C;
let deviceInfo = {
deviceId: "",
deviceName: "",
deviceType: tv
} }
var info = dmClass.removeTrustedDevice(deviceInfo); data.verifyAuthInfo(authInfo, (err, data) => {
expect(info == 0).assertTrue(); if (err) {
} expect().assertFail();
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0700----------"); }
expect(data).assertUndefined();
});
});
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_removeTrustedDevice_0800 * @tc.number deviceManagerTest_unauthenticateDevice_0100
* @tc.name Call the removeTrustedDevice interface,deviceType is null * @tc.name Pass in the normal deviceInfo、authParam,deviceType is UNKNOWN_TYPE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('deviceManagerTest_removeTrustedDevice_0800', 0, async function(done){ it('deviceManagerTest_unauthenticateDevice_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_removeTrustedDevice_0800----------"); console.log("----------start running deviceManagerTest_unauthenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{ deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if(err){ if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
dmClass = data; dmClass = data;
dmRemoveTrustedDevice(); dmUnAuthenticateDevice();
},1000); })
}) });
async function dmRemoveTrustedDevice(){ async function dmUnAuthenticateDevice(){
var unknownType = 0;
let deviceInfo = { let deviceInfo = {
deviceId: "", deviceId: "",
deviceName: "", deviceName: "",
deviceType: "" deviceType: unknownType
}
var info = dmClass.removeTrustedDevice(deviceInfo);
expect(info == 0).assertTrue();
}
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0800----------");
done();
})
/*
* @tc.number deviceManagerTest_removeTrustedDevice_0900
* @tc.name Call the removeTrustedDevice interface,deviceType is null
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_removeTrustedDevice_0900', 0, async function(done){
console.log("----------start running deviceManagerTest_removeTrustedDevice_0900----------");
deviceManager.createDeviceManager('com.ohos.devicemanagerdemo',(err,data) =>{
if(err){
expect().assertFail();
} }
setTimeout(function(){ let extraInfo = {
dmClass = data; "targetPkgName": 'com.ohos.devicemangagerdemo',
dmRemoveTrustedDevice(); "appName": "myapplication",
},1000); "appDescription": "apply auth",
}) "business": '0',
async function dmRemoveTrustedDevice(){ "displayOwner": 0
try{
var info = dmClass.removeTrustedDevice('');
expect(info == 0).assertFail();
}catch(e){
console.log('error is :' + e)
expect(e != null).assertTrue();
} }
} let authParam = {
console.log("----------stop running deviceManagerTest_removeTrustedDevice_0900----------"); "authType": 1,
done(); "appIcon": new Uint8Array([]),
}) "appThumbnail": new Uint8Array([]),
"extraInfo": extraInfo
/*
* @tc.number deviceManagerTest_on-dmFaCallback_0100
* @tc.name Call the on interface to pass in dmfacallback
* @tc.desc Function test
* @tc.level 0
*/
it('deviceManagerTest_on-dmFaCallback_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-dmFaCallback_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
} }
setTimeout(function(){ var result = dmClass.unauthenticateDevice(deviceInfo, authParam, (err, data) => {
dmClass = data; if (err) {
dmFaCallback(); expect().assertFail();
},1000); }
}); });
async function dmFaCallback(){ expect(result == undefined).assertTrue()
var result = dmClass.on('dmFaCallback', () => {});
expect(result == undefined).assertTrue();
} }
console.log("----------stop running deviceManagerTest_on-dmFaCallback_0100----------"); console.log("----------stop running deviceManagerTest_unauthenticateDevice_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_on-dmFaCallback_0200 * @tc.number deviceManagerTest_getAuthenticationParam_0100
* @tc.name Call the on interface to pass in a null value * @tc.name testcase for getAuthenticationParam
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_on-dmFaCallback_0200', 0, async function (done) { it('deviceManagerTest_getAuthenticationParam_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-dmFaCallback_0200----------"); console.log("----------start running deviceManagerTest_getAuthenticationParam_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var authparam = data.getAuthenticationParam();
dmClass = data; expect(authparam).assertNotNull();
dmFaCallback();
},1000);
}); });
async function dmFaCallback(){ console.log("----------stop running deviceManagerTest_getAuthenticationParam_0100----------");
try{
var result = dmClass.on('', () => {});
expect(result == undefined).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_on-dmFaCallback_0200----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_off-dmFaCallback_0100 * @tc.number deviceManagerTest_on-deviceStateChange_0100
* @tc.name Call the off interface to pass in dmfacallback * @tc.name testcase for deviceStateChange on with ONLINE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_off-dmFaCallback_0100', 0, async function (done) { it('deviceManagerTest_on-deviceStateChange_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-dmFaCallback_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
dmClass = data; expect(true).assertEqual(deviceStateChangeAction.ONLINE == 0);
dmFaCallback(); });
},1000); expect(fa).assertUndefined();
}); });
async function dmFaCallback(){ console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
var result = dmClass.off('dmFaCallback', () => {});
expect(result == undefined).assertFail();
}
console.log("----------stop running deviceManagerTest_off-dmFaCallback_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_off-dmFaCallback_0200 * @tc.number deviceManagerTest_on-deviceStateChange_0110
* @tc.name Call the on interface to pass in a null value * @tc.name testcase for deviceStateChange on with OFFLINE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_off-dmFaCallback_0200', 0, async function (done) { it('deviceManagerTest_on-deviceStateChange_0110', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-dmFaCallback_0200----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
dmClass = data; expect(true).assertEqual(deviceStateChangeAction.OFFLINE == 0);
dmFaCallback(); });
},1000); expect(fa).assertUndefined();
}); });
async function dmFaCallback(){ console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
try{
var result = dmClass.off('', () => {});
expect(result == undefined).assertFail();
}catch(e){
console.log('error is :' + e);
expect(e != null).assertTrue();
}
}
console.log("----------stop running deviceManagerTest_off-dmFaCallback_0200----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_on-deviceStateChange_0100 * @tc.number deviceManagerTest_on-deviceStateChange_0120
* @tc.name Call the on interface to pass in devicestatechange * @tc.name testcase for deviceStateChange on with READY
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_on-deviceStateChange_0100', 0, async function (done) { it('deviceManagerTest_on-deviceStateChange_0120', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
dmClass = data; expect(true).assertEqual(deviceStateChangeAction.READY == 0);
dmDeviceStateChange(); });
},1000); expect(fa).assertUndefined();
}); });
async function dmDeviceStateChange(){
var result = dmClass.on('deviceStateChange', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_on-deviceStateChange_0200 * @tc.number deviceManagerTest_on-deviceStateChange_0130
* @tc.name Call the on interface to pass in number * @tc.name testcase for deviceStateChange on with CHANGE
* @tc.desc Function test * @tc.desc Function test
* @tc.level 1 * @tc.level 2
*/ */
it('deviceManagerTest_on-deviceStateChange_0200', 0, async function (done) { it('deviceManagerTest_on-deviceStateChange_0130', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0200----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
dmClass = data; expect(true).assertEqual(deviceStateChangeAction.CHANGE == 0);
dmDeviceStateChange(); });
},1000); expect(fa).assertUndefined();
}); });
async function dmDeviceStateChange(){ console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
var result = dmClass.on('123456', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0200----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_off-deviceStateChange_0100 * @tc.number deviceManagerTest_off-deviceStateChange_0100
* @tc.name Call the off interface to pass in devicestatechange * @tc.name testcase for deviceStateChange off
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_off-deviceStateChange_0100', 0, async function (done) { it('deviceManagerTest_off-deviceStateChange_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_off-deviceStateChange_0100----------");
...@@ -3015,50 +780,18 @@ describe('deviceManagerTest', function() { ...@@ -3015,50 +780,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.off('deviceStateChange', () => {});
dmClass = data; expect(fa).assertUndefined();
dmDeviceStateChange();
},1000);
}); });
async function dmDeviceStateChange(){
var result = dmClass.off('deviceStateChange', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_off-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_off-deviceStateChange_0100----------");
done(); done();
}) })
/*
* @tc.number deviceManagerTest_off-deviceStateChange_0200
* @tc.name Call the off interface to pass in Special symbols
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_off-deviceStateChange_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-deviceStateChange_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceStateChange();
},1000);
});
async function dmDeviceStateChange(){
var result = dmClass.off('#$%^&', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_off-deviceStateChange_0200----------");
done();
})
/* /*
* @tc.number deviceManagerTest_on-deviceFound_0100 * @tc.number deviceManagerTest_on-deviceFound_0100
* @tc.name Call the on interface to pass in devicefound * @tc.name testcase for deviceFound on
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_on-deviceFound_0100', 0, async function (done) { it('deviceManagerTest_on-deviceFound_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-deviceFound_0100----------"); console.log("----------start running deviceManagerTest_on-deviceFound_0100----------");
...@@ -3066,49 +799,18 @@ describe('deviceManagerTest', function() { ...@@ -3066,49 +799,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('deviceFound', () => {});
dmClass = data; expect(fa).assertUndefined();
dmDeviceFound();
},1000);
}); });
async function dmDeviceFound(){
var result = dmClass.on('deviceFound', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_on-deviceFound_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceFound_0100----------");
done(); done();
}) })
/*
* @tc.number deviceManagerTest_on-deviceFound_0200
* @tc.name Call the on interface to pass in Incorrect parameters
* @tc.desc Function test
* @tc.level 1
*/
it('deviceManagerTest_on-deviceFound_0200', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-deviceFound_0200----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) {
expect().assertFail();
}
setTimeout(function(){
dmClass = data;
dmDeviceFound();
},1000);
});
async function dmDeviceFound(){
var result = dmClass.on('device11', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_on-deviceFound_0200----------");
done();
})
/* /*
* @tc.number deviceManagerTest_off-deviceFound_0100 * @tc.number deviceManagerTest_off-deviceFound_0100
* @tc.name Call the off interface to pass in devicefound * @tc.name testcase for deviceFound off
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_off-deviceFound_0100', 0, async function (done) { it('deviceManagerTest_off-deviceFound_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-deviceFound_0100----------"); console.log("----------start running deviceManagerTest_off-deviceFound_0100----------");
...@@ -3116,24 +818,18 @@ describe('deviceManagerTest', function() { ...@@ -3116,24 +818,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.off('deviceFound', () => {});
dmClass = data; expect(fa).assertUndefined();
dmDeviceFound();
},1000);
}); });
async function dmDeviceFound(){
var result = dmClass.off('deviceFound', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_off-deviceFound_0100----------"); console.log("----------stop running deviceManagerTest_off-deviceFound_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_on-discoverFail_0100 * @tc.number deviceManagerTest_on-discoverFail_0100
* @tc.name Call the on interface to pass in discoverfail * @tc.name testcase for discoverFail on
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_on-discoverFail_0100', 0, async function (done) { it('deviceManagerTest_on-discoverFail_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-discoverFail_0100----------"); console.log("----------start running deviceManagerTest_on-discoverFail_0100----------");
...@@ -3141,24 +837,18 @@ describe('deviceManagerTest', function() { ...@@ -3141,24 +837,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('discoverFail', () => {});
dmClass = data; expect(fa).assertUndefined();
dmDiscoverFail();
},1000);
}); });
async function dmDiscoverFail(){
var result = dmClass.on('discoverFail', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_on-discoverFail_0100----------"); console.log("----------stop running deviceManagerTest_on-discoverFail_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_off-discoverFail_0100 * @tc.number deviceManagerTest_off-discoverFail_0100
* @tc.name Call the off interface to pass in discoverfail * @tc.name testcase for discoverFail off
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_off-discoverFail_0100', 0, async function (done) { it('deviceManagerTest_off-discoverFail_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-discoverFail_0100----------"); console.log("----------start running deviceManagerTest_off-discoverFail_0100----------");
...@@ -3166,24 +856,18 @@ describe('deviceManagerTest', function() { ...@@ -3166,24 +856,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.off('discoverFail', () => {});
dmClass = data; expect(fa).assertUndefined();
dmDiscoverFail();
},1000);
}); });
async function dmDiscoverFail(){
var result = dmClass.off('discoverFail', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_off-discoverFail_0100----------"); console.log("----------stop running deviceManagerTest_off-discoverFail_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_on-serviceDie_0100 * @tc.number deviceManagerTest_on-serviceDie_0100
* @tc.name Call the on interface to pass in servicedie * @tc.name testcase for serviceDie on
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_on-serviceDie_0100', 0, async function (done) { it('deviceManagerTest_on-serviceDie_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_on-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_on-serviceDie_0100----------");
...@@ -3191,24 +875,18 @@ describe('deviceManagerTest', function() { ...@@ -3191,24 +875,18 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.on('serviceDie', () => {});
dmClass = data; expect(fa).assertUndefined();
dmServiceDie();
},1000);
}); });
async function dmServiceDie(){
var result = dmClass.on('serviceDie', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------start running deviceManagerTest_on-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_on-serviceDie_0100----------");
done(); done();
}) })
/* /*
* @tc.number deviceManagerTest_off-serviceDie_0100 * @tc.number deviceManagerTest_off-serviceDie_0100
* @tc.name Call the off interface to pass in servicedie * @tc.name testcase for serviceDie off
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 2
*/ */
it('deviceManagerTest_off-serviceDie_0100', 0, async function (done) { it('deviceManagerTest_off-serviceDie_0100', 0, async function (done) {
console.log("----------start running deviceManagerTest_off-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_off-serviceDie_0100----------");
...@@ -3216,17 +894,10 @@ describe('deviceManagerTest', function() { ...@@ -3216,17 +894,10 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ var fa = data.off('serviceDie', () => {});
dmClass = data; expect(fa).assertUndefined();
dmServiceDie();
},1000);
}); });
async function dmServiceDie(){
var result = dmClass.off('serviceDie', () => {});
expect(result == undefined).assertTrue();
}
console.log("----------stop running deviceManagerTest_off-serviceDie_0100----------"); console.log("----------stop running deviceManagerTest_off-serviceDie_0100----------");
done(); done();
}) })
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册