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

!6130 feat: 【monthly_20221018】Add the js api error code and the removeRight interface use case

Merge pull request !6130 from 李晓枫/monthly_20221018
......@@ -67,13 +67,13 @@ describe('UsbCoreJsFunctionsTest', function () {
* @tc.desc : 获取设备列表
*/
it('SUB_USB_JS_0480', 0, function () {
console.info('usb SUB_USB_JS_0480 begin');
console.info('*****SUB_USB_JS_0480 portcurrentMode**** ret : ' + portCurrentMode)
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
console.info('usb SUB_USB_JS_0480 begin');
gDeviceList = usb.getDevices();
if (gDeviceList.length == 0) {
console.info('usb case get_devices list is null')
......@@ -85,10 +85,9 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('usb SUB_USB_JS_0480: PASS');
})
/**
* @tc.number : SUB_USB_JS_0710
* @tc.name : hasRigt
* @tc.name : hasRight
* @tc.desc : 权限查询 连接设备 关闭设备
*/
it('SUB_USB_JS_0710', 0, function () {
......@@ -113,7 +112,6 @@ describe('UsbCoreJsFunctionsTest', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0680
* @tc.name : requestRight
......@@ -145,6 +143,38 @@ describe('UsbCoreJsFunctionsTest', function () {
}
})
/**
* @tc.number : SUB_USB_JS_1080
* @tc.name : removeRight
* @tc.desc : 移除权限
*/
it('SUB_USB_JS_1080', 0, function () {
console.info('usb SUB_USB_JS_1080 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
var isRight = usb.hasRight(gDeviceList[0].name);
if (!isRight) {
usb.requestRight(gDeviceList[0].name).then(hasRight => {
console.info('usb 1080 requestRight hasRight:' + hasRight);
}).catch(error => {
console.info('usb 1080 requestRight error:' + error);
});
CheckEmptyUtils.sleep(5000);
}
var remRight = usb.removeRight(gDeviceList[0].name);
console.info('usb remove_right ret :' + remRight);
expect(remRight).assertTrue();
console.info('usb SUB_USB_JS_1080 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0090
* @tc.name : connectDevice
......@@ -165,9 +195,9 @@ describe('UsbCoreJsFunctionsTest', function () {
var isRight = usb.hasRight(gDeviceList[0].name);
if (!isRight) {
usb.requestRight(gDeviceList[0].name).then(hasRight => {
console.info('usb 0090 requestRight hasRight:' + hasRight);
}).catch(error => {
console.info('usb 01 requestRight error:' + error);
console.info('usb 0090 requestRight error:' + error);
});
CheckEmptyUtils.sleep(5000)
}
......@@ -426,5 +456,33 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('usb SUB_USB_JS_0520 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1070
* @tc.name : getFileDescriptor
* @tc.desc : 反向测试 关闭设备 传入错误参数
*/
it('SUB_USB_JS_1070', 0, function () {
console.info('usb SUB_USB_JS_1070 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
gPipe = usb.connectDevice(gDeviceList[0])
try {
var maskCode = usb.getFileDescriptor("invalid");
console.info('usb case getFileDescriptor return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1070 : PASS');
}
})
})
}
......@@ -24,6 +24,7 @@ describe('UsbCoreJsFunctionsTestEx', function () {
var gDeviceList
var portCurrentMode
var invalidCode = 0;
beforeAll(function () {
console.log('*************Usb Unit UsbCoreJsFunctionsTestEx Begin*************');
......@@ -574,6 +575,43 @@ describe('UsbCoreJsFunctionsTestEx', function () {
console.info('usb SUB_USB_JS_0210 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1040
* @tc.name : connectDevice
* @tc.desc : 反向测试 请求权限 参数类型错误
*/
it('SUB_USB_JS_1040', 0, function () {
console.info('usb SUB_USB_JS_1040 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
var isRight = usb.hasRight(gDeviceList[0].name);
if (!isRight) {
usb.requestRight(gDeviceList[0].name).then(hasRight => {
console.info('usb 1040 requestRight hasRight:' + hasRight);
}).catch(error => {
console.info('usb 1040 requestRight error:' + error);
});
CheckEmptyUtils.sleep(5000)
}
try {
var maskCode = usb.connectDevice("invalid");
console.info('usb case connectDevice return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1040 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0720
* @tc.name : hasRight
......@@ -634,6 +672,34 @@ describe('UsbCoreJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1020
* @tc.name : hasRight
* @tc.desc : 反向测试 权限查询 参数类型错误
*/
it('SUB_USB_JS_1020', 0, function () {
console.info('usb SUB_USB_JS_1020 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.hasRight(invalidCode);
console.info('usb case hasRight return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1020 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0690
* @tc.name : requestRight
......@@ -699,5 +765,142 @@ describe('UsbCoreJsFunctionsTestEx', function () {
CheckEmptyUtils.sleep(5000);
}
})
/**
* @tc.number : SUB_USB_JS_1030
* @tc.name : requestRight
* @tc.desc : 反向测试 请求权限 参数类型错误
*/
it('SUB_USB_JS_1030', 0, function () {
console.info('usb SUB_USB_JS_1030 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.requestRight(invalidCode);
console.info('usb case requestRight return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1030 : PASS');
}
CheckEmptyUtils.sleep(5000);
})
/**
* @tc.number : SUB_USB_JS_1010
* @tc.name : getDevices
* @tc.desc : 反向测试 获取设备列表 参数类型错误
*/
it('SUB_USB_JS_1010', 0, function () {
console.info('usb SUB_USB_JS_1010 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
try {
var maskCode = usb.getDevices("invalid");
console.info('usb case getDevices return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1010 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_1050
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 参数类型错误
*/
it('SUB_USB_JS_1050', 0, function () {
console.info('usb SUB_USB_JS_1050 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.closePipe("invalid");
console.info('usb case closePipe return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1050 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_1060
* @tc.name : getRawDescriptor
* @tc.desc : 反向测试 关闭设备 参数类型错误
*/
it('SUB_USB_JS_1060', 0, function () {
console.info('usb SUB_USB_JS_1060 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.getRawDescriptor("invalid");
console.info('usb case getRawDescriptor return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1060 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_1090
* @tc.name : removeRight
* @tc.desc : 反向测试 移除权限 参数类型错误
*/
it('SUB_USB_JS_1090', 0, function () {
console.info('usb SUB_USB_JS_1090 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.removeRight(invalidCode);
console.info('usb case removeRight return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1090 : PASS');
}
CheckEmptyUtils.sleep(5000);
})
})
}
......@@ -230,13 +230,13 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
return
}
if (gDeviceList.length == 0) {
console.info('usb 01 case get_device_list is null')
console.info('usb 0420 case get_device_list is null')
expect(gDeviceList.length).assertEqual(-1);
return
}
if (gDeviceList[0].configs.length == 0) {
console.info('usb 01 case current device.configs.length = 0');
console.info('usb 0420 case current device.configs.length = 0');
expect(false).assertTrue();
return
}
......@@ -591,48 +591,75 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 3 reqType 67 value 512 index 0
*/
it('SUB_USB_JS_0610', 0, function () {
console.info('usb SUB_USB_JS_0610 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
var testParam = getTransferTestParam()
if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) {
expect(false).assertTrue();
return
}
it('SUB_USB_JS_0610', 0, function () {
console.info('usb SUB_USB_JS_0610 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
var testParam = getTransferTestParam()
if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) {
expect(false).assertTrue();
return
}
var timeout = 5000;
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature')
})
var timeout = 5000;
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature')
})
/**
* @tc.number : SUB_USB_JS_0620
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 3 reqType 35 value 0 index 0
*/
it('SUB_USB_JS_0620', 0, function () {
console.info('usb SUB_USB_JS_0620 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
var testParam = getTransferTestParam()
if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) {
expect(false).assertTrue();
return
}
it('SUB_USB_JS_0620', 0, function () {
console.info('usb SUB_USB_JS_0620 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
var testParam = getTransferTestParam()
if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) {
expect(false).assertTrue();
return
}
var timeout = 5000;
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature')
})
var timeout = 5000;
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature')
})
/**
* @tc.number : SUB_USB_JS_1140
* @tc.name : controlTransfer
* @tc.desc : 反向测试 控制传输 参数类型错误
*/
it('SUB_USB_JS_1140', 0, function () {
console.info('usb SUB_USB_JS_1140 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
var testParam = getTransferTestParam()
if (testParam.inEndpoint == null || testParam.interface == null || testParam.outEndpoint == null) {
expect(false).assertTrue();
return
}
try {
var maskCode = usb.controlTransfer("invalid");
console.info('usb case controlTransfer return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1140 : PASS');
}
})
})
}
......@@ -251,6 +251,34 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
CheckEmptyUtils.sleep(3000);
})
/**
* @tc.number : SUB_USB_JS_1100
* @tc.name : bulkTransfer
* @tc.desc : 反向测试 批量传输 参数类型错误
*/
it('SUB_USB_JS_1100', 0, function () {
console.info('usb SUB_USB_JS_1100 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.bulkTransfer("invalid");
console.info('usb case bulkTransfer return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1100 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0430
* @tc.name : claimInterface
......@@ -456,6 +484,39 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1110
* @tc.name : claimInterface
* @tc.desc : 反向测试 获取接口 参数类型错误
*/
it('SUB_USB_JS_1110', 0, function () {
console.info('usb SUB_USB_JS_1110 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
if (gDeviceList[0].configs.length == 0) {
console.info('usb 1110 case current device.configs.length = 0');
expect(false).assertTrue();
return
}
try {
var maskCode = usb.claimInterface("invalid");
console.info('usb case claimInterface return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1110 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0280
* @tc.name : releaseInterface
......@@ -661,6 +722,40 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1150
* @tc.name : releaseInterface
* @tc.desc : 反向测试 释放接口 参数类型错误
*/
it('SUB_USB_JS_1150', 0, function () {
console.info('usb SUB_USB_JS_1150 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
if (gDeviceList[0].configs.length == 0) {
console.info('usb 1110 case current device.configs.length = 0');
expect(false).assertTrue();
return
}
gPipe = usb.connectDevice(gDeviceList[0])
try {
var maskCode = usb.releaseInterface("invalid");
console.info('usb case releaseInterface return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1150 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0820
* @tc.name : setInterface
......@@ -791,6 +886,34 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1130
* @tc.name : setInterface
* @tc.desc : 反向测试 设置设备接口 参数类型错误
*/
it('SUB_USB_JS_1130', 0, function () {
console.info('usb SUB_USB_JS_1130 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.setInterface("invalid");
console.info('usb case setInterface return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1130 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0760
* @tc.name : setConfiguration
......@@ -909,5 +1032,32 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
console.info('usb SUB_USB_JS_0790 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1120
* @tc.name : setConfiguration
* @tc.desc : 反向测试 设置设备接口 参数类型错误
*/
it('SUB_USB_JS_1120', 0, function () {
console.info('usb SUB_USB_JS_1120 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
return
}
if (gDeviceList.length == 0) {
console.info('usb case get_device_list is null')
expect(false).assertTrue();
return
}
try {
var maskCode = usb.setConfiguration("invalid");
console.info('usb case setConfiguration return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1120 : PASS');
}
})
})
}
......@@ -100,13 +100,14 @@ describe('UsbFunctionsJsFunctionsTest', function () {
/**
* @tc.number : SUB_USB_JS_1000
* @tc.name : getCurrentFunctions
* @tc.desc : 反向测试 获取当前设备模式
* @tc.desc : 反向测试 获取当前设备模式 入参错误(无参接口传参)
*/
it('SUB_USB_JS_1000', 0, function () {
console.info('usb SUB_USB_JS_1000 begin');
try {
var maskCode = usb.getCurrentFunctions("invalid");
console.info('usb case getCurrentFunctions return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
......
......@@ -20,6 +20,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function UsbFunctionsJsFunctionsTestEx() {
describe('UsbFunctionsJsFunctionsTestEx', function () {
var invalidCode = 0;
beforeAll(function () {
console.log('*************Usb Unit UsbFunctionsJsFunctionsTestEx Begin*************');
var Version = usb.getVersion()
......@@ -155,6 +157,24 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
console.info('usb SUB_USB_JS_0990 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1160
* @tc.name : usbFunctionsToString
* @tc.desc : 反向测试 掩码转化成描述字符 参数类型错误
*/
it('SUB_USB_JS_1160', 0, function () {
console.info('usb SUB_USB_JS_1160 begin');
try {
var maskCode = usb.usbFunctionsToString("invalid");
console.info('usb case usbFunctionsToString return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1160 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0860
* @tc.name : usbFunctionsFromString
......@@ -253,5 +273,22 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
console.info('usb SUB_USB_JS_0920 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1170
* @tc.name : usbFunctionsFromString
* @tc.desc : 反向测试 描述字符转换成掩码 参数类型错误
*/
it('SUB_USB_JS_1170', 0, function () {
console.info('usb SUB_USB_JS_1170 begin');
try {
var maskCode = usb.usbFunctionsFromString(invalidCode);
console.info('usb case usbFunctionsFromString return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1170 : PASS');
}
})
})
}
......@@ -212,6 +212,5 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
console.info('usb SUB_USB_JS_0020 host 1 1: PASS');
expect(true).assertTrue();
})
})
}
......@@ -63,6 +63,24 @@ describe('UsbPortJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1210
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 获取指定的端口支持的模式列表的组合掩码 参数类型错误
*/
it('SUB_USB_JS_1210', 0, function () {
console.info('usb SUB_USB_JS_1210 begin');
try {
var maskCode = usb.getSupportedModes("invalid");
console.info('usb case getSupportedModes return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1210 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_0030
* @tc.name : setPortRoles
......@@ -196,5 +214,58 @@ describe('UsbPortJsFunctionsTestEx', function () {
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1190
* @tc.name : setPortRoles
* @tc.desc : 反向测试 port功能切换 参数个数错误
*/
it('SUB_USB_JS_1190', 0, function () {
console.info('usb SUB_USB_JS_1190 begin');
try {
var maskCode = usb.setPortRoles("invalid");
console.info('usb case setPortRoles return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1190 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_1200
* @tc.name : getPorts
* @tc.desc : 反向测试 port功能切换 入参错误(无参接口传参)
*/
it('SUB_USB_JS_1200', 0, function () {
console.info('usb SUB_USB_JS_1200 begin');
try {
var maskCode = usb.getPorts("invalid");
console.info('usb case getPorts return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1200 : PASS');
}
})
/**
* @tc.number : SUB_USB_JS_1180
* @tc.name : setCurrentFunctions
* @tc.desc : 反向测试 在设备模式下设置当前的USB功能列表 参数类型错误
*/
it('SUB_USB_JS_1180', 0, function () {
console.info('usb SUB_USB_JS_1180 begin');
try {
var maskCode = usb.setCurrentFunctions("invalid");
console.info('usb case setCurrentFunctions return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1180 : PASS');
}
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册