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

!6756 【monthly_20221018】Js use case rectification and addition

Merge pull request !6756 from 李晓枫/cherry-pick-1669794180
......@@ -15,11 +15,7 @@ import("//build/ohos_var.gni")
group("usb") {
testonly = true
if (device_name == "rk3568") {
if (is_standard_system) {
deps = [ "usb_standard:usb_js_test" ]
} else {
if (is_standard_system) {
deps = [ "usb_standard:usb_js_test" ]
}
}
}
......@@ -16,8 +16,8 @@
"package": "ohos.acts.usb.usb.function",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"tablet",
"default",
"phone"
],
"distro": {
......
......@@ -12,28 +12,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UsbAutoJsunit from './UsbAutoJsunit.test.js'
import UsbPortAndFunctionsJsFunctionsTest from './UsbPortAndFunctionJsunit.test.js'
import UsbPortJsFunctionsTest from './UsbPortJsunit.test.js'
import UsbPortJsFunctionsTestEx from './UsbPortJsunitEx.test.js'
import UsbFunctionsJsFunctionsTestEx from './UsbFunctionsJsunitEx.test.js'
import UsbFunctionsJsFunctionsTest from './UsbFunctionsJsunit.test.js'
import UsbDevicePipeJsFunctionsTest from './UsbDevicePipeJsunit.test.js'
import UsbDevicePipeJsFunctionsTestA from './UsbDevicePipeJsunit_A.test.js'
import UsbDevicePipeJsFunctionsTestEx from './UsbDevicePipeJsunitEx.test.js'
import UsbCoreJsFunctionsTest from './UsbCoreJsunit.test.js'
import UsbCoreJsFunctionsTestEx from './UsbCoreJsunitEx.test.js'
/* host test case */
export default function testsuite() {
UsbAutoJsunit()
UsbCoreJsFunctionsTest()
UsbCoreJsFunctionsTestEx()
UsbDevicePipeJsFunctionsTest()
UsbDevicePipeJsFunctionsTestA()
UsbDevicePipeJsFunctionsTestEx()
UsbFunctionsJsFunctionsTest()
UsbFunctionsJsFunctionsTestEx()
//UsbPortAndFunctionsJsFunctionsTest()
// UsbPortAndFunctionsJsFunctionsTest()
UsbPortJsFunctionsTest()
UsbPortJsFunctionsTestEx()
}
/*
* Copyright (C) 2021-2022 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 usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */
export default function UsbAutoJsunit() {
describe('UsbAutoJsunit', function () {
beforeAll(function () {
console.log('*************Usb Unit UsbAutoJsunit Begin*************');
var Version = usb.getVersion()
console.info('begin test getversion :' + Version)
// 切换到 device
var usbPortList = usb.getPorts()
if (usbPortList.length > 0) {
if (usbPortList[0].status.currentMode == 2) {
console.info('usb case set data role 1, data role 1');
usb.setPortRoles(usbPortList[0].id, 2, 2).then(data => {
console.info('usb case setPortRoles return: ' + data);
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
});
CheckEmptyUtils.sleep(8000)
console.log('*************Usb Unit switch to device Begin*************');
}
}
})
beforeEach(function () {
console.info('beforeEach: *************Usb Unit Test Case*************');
})
afterEach(function () {
console.info('afterEach: *************Usb Unit Test Case*************');
})
afterAll(function () {
console.log('*************Usb Unit UsbAutoJsunit End*************');
})
/**
* @tc.number : SUB_USB_JS_0930
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 0 返回 'none'
*/
it('SUB_USB_JS_0930', 0, function () {
console.info('usb SUB_USB_JS_0930 begin');
var maskCode = 0
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('none');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0930 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0940
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 1 返回 'acm'
*/
it('SUB_USB_JS_0940', 0, function () {
console.info('usb SUB_USB_JS_0940 begin');
var maskCode = 1
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0940 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0950
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 2 返回 'ecm'
*/
it('SUB_USB_JS_0950', 0, function () {
console.info('usb SUB_USB_JS_0950 begin');
var maskCode = 2
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('ecm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0950 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0960
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 3 返回 'acm,ecm'
*/
it('SUB_USB_JS_0960', 0, function () {
console.info('usb SUB_USB_JS_0960 begin');
var maskCode = 3
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm,ecm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0960 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0970
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 4 返回 'hdc'
*/
it('SUB_USB_JS_0970', 0, function () {
console.info('usb SUB_USB_JS_0970 begin');
var maskCode = 4
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0970 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0980
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 5 返回 'acm,hdc'
*/
it('SUB_USB_JS_0980', 0, function () {
console.info('usb SUB_USB_JS_0980 begin');
var maskCode = 5
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm,hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0980 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0990
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 6 返回 'ecm,hdc'
*/
it('SUB_USB_JS_0990', 0, function () {
console.info('usb SUB_USB_JS_0990 begin');
var maskCode = 6
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('ecm,hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
console.info('usb SUB_USB_JS_0990 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0860
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'none' 返回 0
*/
it('SUB_USB_JS_0860', 0, function () {
console.info('usb SUB_USB_JS_0860 begin');
var strMaskCode = 'none'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(0);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0860 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0870
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm' 返回 1
*/
it('SUB_USB_JS_0870', 0, function () {
console.info('usb SUB_USB_JS_0870 begin');
var strMaskCode = 'acm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(1);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0870 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0880
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm' 返回 2
*/
it('SUB_USB_JS_0880', 0, function () {
console.info('usb SUB_USB_JS_0880 begin');
var strMaskCode = 'ecm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(2);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0880 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0890
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,ecm' 返回 3
*/
it('SUB_USB_JS_0890', 0, function () {
console.info('usb SUB_USB_JS_0890 begin');
var strMaskCode = 'acm,ecm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(3);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0890 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0900
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'hdc' 返回 4
*/
it('SUB_USB_JS_0900', 0, function () {
console.info('usb SUB_USB_JS_0900 begin');
var strMaskCode = 'hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(4);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0900 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0910
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,hdc' 返回 5
*/
it('SUB_USB_JS_0910', 0, function () {
console.info('usb SUB_USB_JS_0910 begin');
var strMaskCode = 'acm,hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(5);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0910 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0920
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm,hdc' 返回 6
*/
it('SUB_USB_JS_0920', 0, function () {
console.info('usb SUB_USB_JS_0920 begin');
var strMaskCode = 'ecm,hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(6);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0920 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0330
* @tc.name : getCurrentFunctions
* @tc.desc : 获取当前设备模式 掩码与描述字符转换
*/
it('SUB_USB_JS_0330', 0, function () {
console.info('usb SUB_USB_JS_0330 begin');
var maskCode = usb.getCurrentFunctions();
console.info('usb case getCurrentFunctions return: ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
console.info('usb case usbFunctionsToString return str: ' + strMaskCode);
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
console.info('usb case strMaskCode usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(maskCode);
console.info('usb SUB_USB_JS_0330 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0340
* @tc.name : usbFunctionString
* @tc.desc : 反向测试 获取当前设备模式 掩码与描述字符转换
*/
it('SUB_USB_JS_0340', 0, function () {
console.info('usb SUB_USB_JS_0340 begin');
var maskCode = usb.getCurrentFunctions();
console.info('usb case getCurrentFunctions return: ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
console.info('usb case usbFunctionsToString return str: ' + strMaskCode);
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
console.info('usb case strMaskCode usbFunctionsFromString return int: ' + nMaskCode);
var errmaskCode = 0
var strMaskCode = usb.usbFunctionsToString(errmaskCode)
console.info('usb case ' + errmaskCode + ' usbFunctionsToString return str: ' + strMaskCode);
var errStrMaskCode = 'none'
var nMaskCode = usb.usbFunctionsFromString(errStrMaskCode)
expect(nMaskCode).assertEqual(0);
console.info('usb case errStrMaskCode ' + errStrMaskCode +
' usbFunctionsFromString return int: ' + nMaskCode);
console.info('usb SUB_USB_JS_0340 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0410
* @tc.name : getPorts
* @tc.desc : 获取USB端口描述信息列表
*/
it('SUB_USB_JS_0410', 0, function () {
console.info('usb SUB_USB_JS_0410 begin');
var usbPortList = usb.getPorts()
if (usbPortList.length == 0) {
console.info('usb SUB_USB_JS_0410 usbPortList is null');
expect(false).assertTrue();
return
}
expect(usbPortList.length > 0).assertTrue();
console.info('usb SUB_USB_JS_0410 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0220
* @tc.name : getSupportedModes
* @tc.desc : 获取指定的端口支持的模式列表的组合掩码
*/
it('SUB_USB_JS_0220', 0, function () {
console.info('usb SUB_USB_JS_0220 begin');
var usbPortList = usb.getPorts()
if (usbPortList.length == 0) {
console.info('usb SUB_USB_JS_0220 usbPortList is null');
expect(false).assertTrue();
return
}
expect(usbPortList.length > 0).assertTrue();
for (var i = 0; i < usbPortList.length; i++) {
var maskCode = usb.getSupportedModes(usbPortList[i].id)
expect(maskCode).assertEqual(usbPortList[i].supportedModes);
}
console.info('usb SUB_USB_JS_0220 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0230
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 改变id 获取指定的端口支持的模式列表的组合掩码
*/
it('SUB_USB_JS_0230', 0, function () {
console.info('usb SUB_USB_JS_0230 begin');
var usbPortList = usb.getPorts()
if (usbPortList.length == 0) {
console.info('usb SUB_USB_JS_0230 usbPortList is null');
expect(false).assertTrue();
return
}
expect(usbPortList.length > 0).assertTrue();
var portID = usbPortList[0].id + 10
var maskCode = usb.getSupportedModes(portID)
expect(maskCode).assertEqual(0);
console.info('usb SUB_USB_JS_0230 : PASS');
expect(true).assertTrue();
})
})
}
......@@ -62,9 +62,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0480
* @tc.name : getDevices
* @tc.desc : 获取设备列表
* @tc.number: SUB_USB_JS_0480
* @tc.name: getDevices
* @tc.desc: Positive test: Get device list
*/
it('SUB_USB_JS_0480', 0, function () {
console.info('usb SUB_USB_JS_0480 begin');
......@@ -80,15 +80,15 @@ describe('UsbCoreJsFunctionsTest', function () {
expect(false).assertTrue();
return
}
expect(gDeviceList.length).assertLarger(0);
console.info('usb case getDevices ret length: ' + gDeviceList.length);
expect(gDeviceList.length).assertLarger(0);
console.info('usb SUB_USB_JS_0480: PASS');
})
/**
* @tc.number : SUB_USB_JS_0710
* @tc.name : hasRight
* @tc.desc : 权限查询 连接设备 关闭设备
* @tc.number: SUB_USB_JS_0710
* @tc.name: hasRight
* @tc.desc: Positive test: Permission query
*/
it('SUB_USB_JS_0710', 0, function () {
console.info('usb has_right_01 begin');
......@@ -108,14 +108,14 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('usb has_right ret :' + hasRight);
}
console.info('usb SUB_USB_JS_0710 : PASS');
expect(true).assertTrue();
console.info('usb SUB_USB_JS_0710 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0680
* @tc.name : requestRight
* @tc.desc : 请求权限
* @tc.number: SUB_USB_JS_0680
* @tc.name: requestRight
* @tc.desc: Positive test: Request permission
*/
it('SUB_USB_JS_0680', 0, function () {
console.info('usb SUB_USB_JS_0680 begin');
......@@ -132,8 +132,8 @@ describe('UsbCoreJsFunctionsTest', function () {
for (var i = 0; i < gDeviceList.length; i++) {
usb.requestRight(gDeviceList[i].name).then(hasRight => {
expect(hasRight).assertTrue();
console.info('usb request_right ret :' + hasRight);
expect(hasRight).assertTrue();
console.info('usb SUB_USB_JS_0680 : PASS');
}).catch(error => {
console.info('usb case device request right failed : ' + error + ' :' + gDeviceList[i].name);
......@@ -144,11 +144,11 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_1080
* @tc.name : removeRight
* @tc.desc : 移除权限
* @tc.number: SUB_USB_JS_1080
* @tc.name: removeRight
* @tc.desc: Positive test: Remove Permissions
*/
it('SUB_USB_JS_1080', 0, function () {
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')
......@@ -176,9 +176,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0090
* @tc.name : connectDevice
* @tc.desc : 打开设备
* @tc.number: SUB_USB_JS_0090
* @tc.name: connectDevice
* @tc.desc: Positive test: open device
*/
it('SUB_USB_JS_0090', 0, function () {
console.info('usb SUB_USB_JS_0090 begin');
......@@ -210,9 +210,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0250
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 busNum
* @tc.number: SUB_USB_JS_0250
* @tc.name: closePipe
* @tc.desc: Negative test: close device, busNum error
*/
it('SUB_USB_JS_0250', 0, function () {
console.info('usb SUB_USB_JS_0250 begin');
......@@ -237,9 +237,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0260
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 devAddress
* @tc.number: SUB_USB_JS_0260
* @tc.name: closePipe
* @tc.desc: Negative test: close device, devAddress error
*/
it('SUB_USB_JS_0260', 0, function () {
console.info('usb SUB_USB_JS_0260 begin');
......@@ -263,9 +263,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0270
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 devAddress busNum
* @tc.number: SUB_USB_JS_0270
* @tc.name: closePipe
* @tc.desc: Negative test: close device, devAddress && busNum error
*/
it('SUB_USB_JS_0270', 0, function () {
console.info('usb SUB_USB_JS_0270 begin');
......@@ -290,9 +290,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0240
* @tc.name : closePipe
* @tc.desc : 关闭设备
* @tc.number: SUB_USB_JS_0240
* @tc.name: closePipe
* @tc.desc: Positive test: close device
*/
it('SUB_USB_JS_0240', 0, function () {
console.info('usb SUB_USB_JS_0240 begin');
......@@ -316,9 +316,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0530
* @tc.name : getRawDescriptor
* @tc.desc : 获取原始的USB描述符
* @tc.number: SUB_USB_JS_0530
* @tc.name: getRawDescriptor
* @tc.desc: Positive test: Get the original USB descriptor
*/
it('SUB_USB_JS_0530', 0, function () {
console.info('usb SUB_USB_JS_0530 begin');
......@@ -337,7 +337,7 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('usb case getRawDescriptor param: ' + JSON.stringify(gPipe));
var descriptor = usb.getRawDescriptor(gPipe);
console.info('usb case getRawDescriptor ret: ' + descriptor);
expect(true).assertTrue();
expect(descriptor.length).assertLarger(0);
var isPipClose = usb.closePipe(gPipe);
expect(isPipClose).assertEqual(0);
......@@ -345,9 +345,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0490
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符
* @tc.number: SUB_USB_JS_0490
* @tc.name: getFileDescriptor
* @tc.desc: Positive test: Get file descriptor
*/
it('SUB_USB_JS_0490', 0, function () {
console.info('usb SUB_USB_JS_0490 begin');
......@@ -365,7 +365,7 @@ describe('UsbCoreJsFunctionsTest', function () {
console.info('usb case getFileDescriptor param: ' + JSON.stringify(gPipe));
var fileDescriptor = usb.getFileDescriptor(gPipe);
console.info('usb case getFileDescriptor ret: ' + fileDescriptor);
expect(true).assertTrue();
expect(fileDescriptor >= 0).assertTrue();
var isPipClose = usb.closePipe(gPipe);
expect(isPipClose).assertEqual(0);
......@@ -373,9 +373,9 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0500
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数busNum=512
* @tc.number: SUB_USB_JS_0500
* @tc.name: getFileDescriptor
* @tc.desc: Negative test: Get file descriptor, error busNum=512
*/
it('SUB_USB_JS_0500', 0, function () {
console.info('usb SUB_USB_JS_0500 begin');
......@@ -401,12 +401,12 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0510
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数devAddress=512
* @tc.number: SUB_USB_JS_0510
* @tc.name: getFileDescriptor
* @tc.desc: Negative test: Get file descriptor,error devAddress=512
*/
it('SUB_USB_JS_0510', 0, function () {
console.info('usb get_file_descriptor_03 begin');
console.info('usb SUB_USB_JS_0510 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
......@@ -429,12 +429,12 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0520
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数busNum=512,devAddress=512
* @tc.number: SUB_USB_JS_0520
* @tc.name: getFileDescriptor
* @tc.desc: Negative test: Get file descriptor,error busNum=512 && devAddress=512
*/
it('SUB_USB_JS_0520', 0, function () {
console.info('usb get_file_descriptor_04 begin');
console.info('usb SUB_USB_JS_0520 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
expect(false).assertFalse();
......@@ -457,11 +457,11 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_1070
* @tc.name : getFileDescriptor
* @tc.desc : 反向测试 获取文件描述符 参数类型错误
* @tc.number: SUB_USB_JS_1070
* @tc.name: getFileDescriptor
* @tc.desc: Negative test: Get file descriptor, parameter type error
*/
it('SUB_USB_JS_1070', 0, function () {
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')
......@@ -486,11 +486,11 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_1230
* @tc.name : getFileDescriptor
* @tc.desc : 反向测试 获取文件描述符 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1230
* @tc.name: getFileDescriptor
* @tc.desc: Negative test: Get file descriptor, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1230', 0, function () {
it('SUB_USB_JS_1230', 0, function () {
console.info('usb SUB_USB_JS_1230 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......
......@@ -62,9 +62,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
/**
* @tc.number : SUB_USB_JS_0100
* @tc.name : connectDevice
* @tc.desc : 反向测试 错误参数 devAddress 打开设备
* @tc.number: SUB_USB_JS_0100
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error devAddress
*/
it('SUB_USB_JS_0100', 0, function () {
console.info('usb SUB_USB_JS_0100 begin');
......@@ -105,9 +105,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0110
* @tc.name : connectDevice
* @tc.desc : 反向测试 busNum错误参数 打开设备
* @tc.number: SUB_USB_JS_0110
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error busNum
*/
it('SUB_USB_JS_0110', 0, function () {
console.info('usb SUB_USB_JS_0110 begin');
......@@ -146,9 +146,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0120
* @tc.name : connectDevice
* @tc.desc : 反向测试 serial错误参数 打开设备
* @tc.number: SUB_USB_JS_0120
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error serial
*/
it('SUB_USB_JS_0120', 0, function () {
console.info('usb SUB_USB_JS_0120 begin');
......@@ -190,9 +190,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0130
* @tc.name : connectDevice
* @tc.desc : 反向测试 name错误参数 打开设备
* @tc.number: SUB_USB_JS_0130
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error name
*/
it('SUB_USB_JS_0130', 0, function () {
console.info('usb SUB_USB_JS_0130 begin');
......@@ -230,9 +230,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0140
* @tc.name : connectDevice
* @tc.desc : 反向测试 manufacturerName错误参数 打开设备
* @tc.number: SUB_USB_JS_0140
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error manufacturerName
*/
it('SUB_USB_JS_0140', 0, function () {
console.info('usb connect_device_06 begin');
......@@ -271,9 +271,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0150
* @tc.name : connectDevice
* @tc.desc : 反向测试 productName错误参数 打开设备
* @tc.number: SUB_USB_JS_0150
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error productName
*/
it('SUB_USB_JS_0150', 0, function () {
console.info('usb SUB_USB_JS_0150 begin');
......@@ -315,9 +315,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0160
* @tc.name : connectDevice
* @tc.desc : 反向测试 version错误参数 打开设备
* @tc.number: SUB_USB_JS_0160
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error version
*/
it('SUB_USB_JS_0160', 0, function () {
console.info('usb connect_device_08 begin');
......@@ -359,9 +359,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0170
* @tc.name : connectDevice
* @tc.desc : 反向测试 vendorId错误参数 打开设备
* @tc.number: SUB_USB_JS_0170
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error vendorId
*/
it('SUB_USB_JS_0170', 0, function () {
console.info('usb connect_device_09 begin');
......@@ -403,9 +403,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0180
* @tc.name : connectDevice
* @tc.desc : 反向测试 productId错误参数 打开设备
* @tc.number: SUB_USB_JS_0180
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error productId
*/
it('SUB_USB_JS_0180', 0, function () {
console.info('usb connect_device_10 begin');
......@@ -447,9 +447,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0190
* @tc.name : connectDevice
* @tc.desc : 反向测试 clazz错误参数 打开设备
* @tc.number: SUB_USB_JS_0190
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error clazz
*/
it('SUB_USB_JS_0190', 0, function () {
console.info('usb connect_device_11 begin');
......@@ -490,9 +490,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0200
* @tc.name : connectDevice
* @tc.desc : 反向测试 subclass错误参数 打开设备
* @tc.number: SUB_USB_JS_0200
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error subclass
*/
it('SUB_USB_JS_0200', 0, function () {
console.info('usb connect_device_12 begin');
......@@ -509,10 +509,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
var isRight = usb.hasRight(gDeviceList[0].name);
if (!isRight) {
usb.requestRight(gDeviceList[0].name).then(hasRight => {
console.info('usb SUB_USB_JS_0200 requestRight hasRight: ' + hasRight);
}).catch(error => {
console.info('usb SUB_USB_JS_0200 requestRight error:' + error);
});
console.info('usb SUB_USB_JS_0200 requestRight end:');
console.info('usb SUB_USB_JS_0200 requestRight end');
CheckEmptyUtils.sleep(5000)
}
......@@ -533,9 +534,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0210
* @tc.name : connectDevice
* @tc.desc : 反向测试 protocol错误参数 打开设备
* @tc.number: SUB_USB_JS_0210
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, error protocol
*/
it('SUB_USB_JS_0210', 0, function () {
console.info('usb connect_device_13 begin');
......@@ -576,11 +577,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1040
* @tc.name : connectDevice
* @tc.desc : 反向测试 打开设备 参数类型错误
* @tc.number: SUB_USB_JS_1040
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, parameter type error
*/
it('SUB_USB_JS_1040', 0, function () {
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')
......@@ -613,11 +614,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1240
* @tc.name : connectDevice
* @tc.desc : 反向测试 打开设备 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1240
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1240', 0, function () {
it('SUB_USB_JS_1240', 0, function () {
console.info('usb SUB_USB_JS_1240 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -650,11 +651,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1220
* @tc.name : connectDevice
* @tc.desc : 反向测试 打开设备 未授权
* @tc.number: SUB_USB_JS_1220
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, Unauthorized
*/
it('SUB_USB_JS_1220', 0, function () {
it('SUB_USB_JS_1220', 0, function () {
console.info('usb SUB_USB_JS_1220 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -679,14 +680,20 @@ describe('UsbCoreJsFunctionsTestEx', function () {
console.info('usb 1220 catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(14400001);
console.info('usb SUB_USB_JS_1220 : PASS');
usb.requestRight(gDeviceList[0].name);
}
usb.requestRight(gDeviceList[0].name).then(hasRight => {
console.info('usb 1220 requestRight hasRight:' + hasRight);
expect(hasRight).assertTrue();
}).catch(error => {
console.info('usb 1220 requestRight error:' + error);
});
CheckEmptyUtils.sleep(5000)
})
/**
* @tc.number : SUB_USB_JS_0720
* @tc.name : hasRight
* @tc.desc : 反向测试 给错误设备名字
* @tc.number: SUB_USB_JS_0720
* @tc.name: hasRight
* @tc.desc: Negative test: parameters exception, error deviceName
*/
it('SUB_USB_JS_0720', 0, function () {
console.info('usb SUB_USB_JS_0720 begin');
......@@ -706,17 +713,15 @@ describe('UsbCoreJsFunctionsTestEx', function () {
deviceName = deviceName + '$#'
var hasRight = usb.hasRight(deviceName)
console.info('usb has_right ret :' + hasRight);
expect(hasRight == false).assertTrue();
expect(hasRight).assertFalse();
}
console.info('usb SUB_USB_JS_0720 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0730
* @tc.name : hasRight
* @tc.desc : 反向测试 给设备名字为字母
* @tc.number: SUB_USB_JS_0730
* @tc.name: hasRight
* @tc.desc: Negative test: parameters exception, the device a letter name
*/
it('SUB_USB_JS_0730', 0, function () {
console.info('usb SUB_USB_JS_0730 begin');
......@@ -736,19 +741,17 @@ describe('UsbCoreJsFunctionsTestEx', function () {
deviceName = deviceName + 'abcdg'
var hasRight = usb.hasRight(deviceName)
console.info('usb hasRight ret :' + hasRight);
expect(hasRight == false).assertTrue();
expect(hasRight).assertFalse();
}
console.info('usb SUB_USB_JS_0730 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1020
* @tc.name : hasRight
* @tc.desc : 反向测试 权限查询 参数类型错误
* @tc.number: SUB_USB_JS_1020
* @tc.name: hasRight
* @tc.desc: Negative test: Permission query, parameter type error
*/
it('SUB_USB_JS_1020', 0, function () {
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')
......@@ -772,11 +775,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1250
* @tc.name : hasRight
* @tc.desc : 反向测试 权限查询 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1250
* @tc.name: hasRight
* @tc.desc: Negative test: Permission query, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1250', 0, function () {
it('SUB_USB_JS_1250', 0, function () {
console.info('usb SUB_USB_JS_1250 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -800,9 +803,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0690
* @tc.name : requestRight
* @tc.desc : 反向测试 错误设备名字 请求权限
* @tc.number: SUB_USB_JS_0690
* @tc.name: requestRight
* @tc.desc: Negative test: Request permission, error diviceName
*/
it('SUB_USB_JS_0690', 0, function () {
console.info('usb SUB_USB_JS_0690 begin');
......@@ -833,9 +836,9 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0700
* @tc.name : requestRight
* @tc.desc : 反向测试 设备名字为数字 请求权限
* @tc.number: SUB_USB_JS_0700
* @tc.name: requestRight
* @tc.desc: Negative test: Request permission, the device name is a number
*/
it('SUB_USB_JS_0700', 0, function () {
console.info('usb SUB_USB_JS_0700 begin');
......@@ -866,11 +869,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1030
* @tc.name : requestRight
* @tc.desc : 反向测试 请求权限 参数类型错误
* @tc.number: SUB_USB_JS_1030
* @tc.name: requestRight
* @tc.desc: Negative test: Request permission, parameter type error
*/
it('SUB_USB_JS_1030', 0, function () {
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')
......@@ -895,11 +898,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1260
* @tc.name : requestRight
* @tc.desc : 反向测试 请求权限 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1260
* @tc.name: requestRight
* @tc.desc: Negative test: Request permission, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1260', 0, function () {
it('SUB_USB_JS_1260', 0, function () {
console.info('usb SUB_USB_JS_1260 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -924,11 +927,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1010
* @tc.name : getDevices
* @tc.desc : 反向测试 获取设备列表 入参错误(无参接口传参)
* @tc.number: SUB_USB_JS_1010
* @tc.name: getDevices
* @tc.desc: Negative test: Get device list, parameters exception(parameter transfer without parameter interface)
*/
it('SUB_USB_JS_1010', 0, function () {
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')
......@@ -947,11 +950,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1050
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 参数类型错误
* @tc.number: SUB_USB_JS_1050
* @tc.name: closePipe
* @tc.desc: Negative test: close device, parameter type error
*/
it('SUB_USB_JS_1050', 0, function () {
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')
......@@ -975,11 +978,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1270
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1270
* @tc.name: closePipe
* @tc.desc: Negative test: close device, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1270', 0, function () {
it('SUB_USB_JS_1270', 0, function () {
console.info('usb SUB_USB_JS_1270 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -1003,11 +1006,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1060
* @tc.name : getRawDescriptor
* @tc.desc : 反向测试 获取原始USB设备描述符 参数类型错误
* @tc.number: SUB_USB_JS_1060
* @tc.name: getRawDescriptor
* @tc.desc: Negative test: Get the original USB descriptor, parameter type error
*/
it('SUB_USB_JS_1060', 0, function () {
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')
......@@ -1031,11 +1034,12 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1280
* @tc.name : getRawDescriptor
* @tc.desc : 反向测试 获取原始USB设备描述符 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1280
* @tc.name: getRawDescriptor
* @tc.desc: Negative test: Get the original USB descriptor, parameter number exception,
* necessary parameters not input
*/
it('SUB_USB_JS_1280', 0, function () {
it('SUB_USB_JS_1280', 0, function () {
console.info('usb SUB_USB_JS_1280 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -1059,11 +1063,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1090
* @tc.name : removeRight
* @tc.desc : 反向测试 移除权限 参数类型错误
* @tc.number: SUB_USB_JS_1090
* @tc.name: removeRight
* @tc.desc: Negative test: Remove Permissions, parameter type error
*/
it('SUB_USB_JS_1090', 0, function () {
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')
......@@ -1088,11 +1092,11 @@ describe('UsbCoreJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1290
* @tc.name : removeRight
* @tc.desc : 反向测试 移除权限 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1290
* @tc.name: removeRight
* @tc.desc: Negative test: Remove Permissions, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1290', 0, function () {
it('SUB_USB_JS_1290', 0, function () {
console.info('usb SUB_USB_JS_1290 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......
......@@ -51,6 +51,10 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
}
gDeviceList = usb.getDevices();
gDeviceList[0].name;
gDeviceList[0].version;
gDeviceList[0].configs;
gPipe = usb.connectDevice(gDeviceList[0])
console.info('usb unit connectDevice gPipe ret : ' + JSON.stringify(gPipe));
})
......@@ -72,6 +76,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var bfind = false
for (var k = 0; k < testParam.config.interfaces[j].endpoints.length; k++) {
var endpoint = testParam.config.interfaces[j].endpoints[k];
endpoint.number = 1;
endpoint.type = 2;
endpoint.interfaceid = 1;
if (endpoint.type == EventConstants.USB_ENDPOINT_XFER_BULK) {
bfind = true
if (endpoint.direction == usb.USB_REQUEST_DIR_TO_DEVICE) {
......@@ -113,7 +120,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
}
// 预制传输相关参数
// Prefabrication transmission related parameters
function getTransferTestParam() {
var testParam = {
config: null,
......@@ -140,9 +147,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_JS_0630
* @tc.name : bulkTransfer
* @tc.desc : 批量传输 收数据
* @tc.number: SUB_USB_JS_0630
* @tc.name: bulkTransfer
* @tc.desc: Positive test: bulk transfer, receive data
*/
it('SUB_USB_JS_0630', 0, function () {
console.info('usb SUB_USB_JS_0630 begin');
......@@ -166,8 +173,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
usb.bulkTransfer(testParam.pip, testParam.inEndpoint, tmpUint8Array, 5000).then(data => {
console.info('usb case readData tmpUint8Array buffer : ' + CheckEmptyUtils.ab2str(tmpUint8Array));
console.info('usb case readData ret: ' + data);
console.info('usb case SUB_USB_JS_0630 : PASS');
expect(data >= 0).assertTrue();
console.info('usb case SUB_USB_JS_0630 : PASS');
}).catch(error => {
console.info('usb case readData error : ' + JSON.stringify(error));
expect(false).assertTrue();
......@@ -176,9 +183,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0640
* @tc.name : bulkTransfer
* @tc.desc : 批量传输 发数据
* @tc.number: SUB_USB_JS_0640
* @tc.name: bulkTransfer
* @tc.desc: Positive test: bulk transfer, send data
*/
it('SUB_USB_JS_0640', 0, function () {
console.info('usb SUB_USB_JS_0640 begin');
......@@ -208,8 +215,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
usb.bulkTransfer(testParam.pip, testParam.outEndpoint, tmpUint8Array, 5000).then(data => {
console.info('usb case SUB_USB_JS_0640 ret: ' + data);
console.info('usb case SUB_USB_JS_0640 send data: ' + testParam.sendData);
expect(data > 0).assertTrue();
console.info('usb case SUB_USB_JS_0640 : PASS');
expect(true).assertTrue();
}).catch(error => {
console.info('usb write error : ' + JSON.stringify(error));
expect(false).assertTrue();
......@@ -218,9 +225,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0420
* @tc.name : claimInterface
* @tc.desc : 获取接口 并释放
* @tc.number: SUB_USB_JS_0420
* @tc.name: claimInterface
* @tc.desc: Positive test: Get interface, and release
*/
it('SUB_USB_JS_0420', 0, function () {
console.info('usb SUB_USB_JS_0420 begin');
......@@ -246,6 +253,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
console.info('usb case current device.configs.interfaces.length = 0');
}
for (var k = 0; k < gDeviceList[0].configs[j].interfaces.length; k++) {
//Attribute Prefabrication
var interfaces = gDeviceList[0].configs[j].interfaces[k];
interfaces.id = 1;
interfaces.name = '';
interfaces.alternateSetting = 0;
var isClaim = usb.claimInterface(gPipe, gDeviceList[0].configs[j].interfaces[k], true)
console.info('usb case claimInterface function return: ' + isClaim);
expect(isClaim).assertEqual(0);
......@@ -259,7 +271,6 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
console.info('usb SUB_USB_JS_0420 : PASS');
expect(true).assertTrue();
})
function getTransferParam(iCmd, iReqTarType, iReqType, iValue, iIndex) {
......@@ -281,9 +292,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_JS_0740
* @tc.name : setConfiguration
* @tc.desc : 设置设备配置
* @tc.number: SUB_USB_JS_0740
* @tc.name: setConfiguration
* @tc.desc: Positive test: Set Device Configuration
*/
it('SUB_USB_JS_0740', 0, function () {
console.info('usb SUB_USB_JS_0740 begin');
......@@ -300,19 +311,24 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
gPipe = usb.connectDevice(gDeviceList[0])
for (var j = 0; j < gDeviceList[0].configs.length; j++) {
var configs = gDeviceList[0].configs[j];
configs.id = 1;
configs.name = '';
configs.maxPower = 1;
configs.isRemoteWakeup = true;
configs.isSelfPowered = true;
var ret = usb.setConfiguration(gPipe, gDeviceList[0].configs[j])
console.info('usb case setConfiguration return : ' + ret);
expect(ret).assertEqual(0);
}
console.info('usb SUB_USB_JS_0740 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0750
* @tc.name : setConfiguration
* @tc.desc : 反向测试 设置设备配置
* @tc.number: SUB_USB_JS_0750
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration
*/
it('SUB_USB_JS_0750', 0, function () {
console.info('usb SUB_USB_JS_0750 begin');
......@@ -339,9 +355,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0800
* @tc.name : setInterface
* @tc.desc : 设置设备接口
* @tc.number: SUB_USB_JS_0800
* @tc.name: setInterface
* @tc.desc: Positive test: Set device interface
*/
it('SUB_USB_JS_0800', 0, function () {
console.info('usb SUB_USB_JS_0800 begin');
......@@ -361,19 +377,18 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
expect(isClaim).assertEqual(0)
if (isClaim == 0) {
var ret = usb.setInterface(gPipe, gDeviceList[0].configs[j].interfaces[0])
expect(ret).assertEqual(0);
console.info('usb case setInterface return : ' + ret);
expect(ret).assertEqual(0);
}
}
console.info('usb SUB_USB_JS_0800 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0810
* @tc.name : setInterface
* @tc.desc : 反向测试 设置设备接口
* @tc.number: SUB_USB_JS_0810
* @tc.name: setInterface
* @tc.desc: Negative test: Set device interface, error tmpInterface.id
*/
it('SUB_USB_JS_0810', 0, function () {
console.info('usb SUB_USB_JS_0810 begin');
......@@ -395,21 +410,20 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var tmpInterface = JSON.parse(JSON.stringify(gDeviceList[0].configs[j].interfaces[0]));
tmpInterface.id = 234
var ret = usb.setInterface(gPipe, tmpInterface)
expect(ret).assertLess(0)
console.info('usb case setInterface return : ' + ret)
expect(ret).assertLess(0)
}
}
console.info('usb SUB_USB_JS_0810 : PASS');
expect(true).assertTrue();
})
function callControlTransfer(pip, controlParam, timeout, caseName) {
usb.controlTransfer(pip, controlParam, timeout).then(data => {
console.info('usb controlTransfer ret data : ' + data + ' ' + caseName);
console.info('usb controlTransfer controlParam.data buffer : ' + controlParam.data + ' ' + caseName);
expect(data >= 0).assertTrue();
console.info('usb' + caseName + ': PASS');
expect(true).assertTrue();
}).catch(error => {
console.info('usb controlTransfer error : ' + JSON.stringify(error));
console.info('usb' + caseName + ': FAILED');
......@@ -419,9 +433,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_JS_0540
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetDescriptor: cmd 6 target 2 reqType 128 value 512 index 0
* @tc.number: SUB_USB_JS_0540
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, GetDescriptor: cmd 6 target 2 reqType 128 value 512 index 0
*/
it('SUB_USB_JS_0540', 0, function () {
console.info('usb SUB_USB_JS_0540 begin');
......@@ -443,9 +457,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0550
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetStatus: cmd 0 target 0 reqType 128 value 0 index 0
* @tc.number: SUB_USB_JS_0550
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, GetStatus: cmd 0 target 0 reqType 128 value 0 index 0
*/
it('SUB_USB_JS_0550', 0, function () {
console.info('usb SUB_USB_JS_0550 begin');
......@@ -467,9 +481,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0560
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetConfiguration: cmd 8 target 0 reqType 128 value 0 index 0
* @tc.number: SUB_USB_JS_0560
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, GetConfiguration: cmd 8 target 0 reqType 128 value 0 index 0
*/
it('SUB_USB_JS_0560', 0, function () {
console.info('usb SUB_USB_JS_0560 begin');
......@@ -491,9 +505,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0570
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetInterface: cmd 10 target 0 reqType 129 value 0 index 1
* @tc.number: SUB_USB_JS_0570
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, GetInterface: cmd 10 target 0 reqType 129 value 0 index 1
*/
it('SUB_USB_JS_0570', 0, function () {
console.info('usb SUB_USB_JS_0570 begin');
......@@ -515,9 +529,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0580
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 target 0 reqType 0 value 0 index 0
* @tc.number: SUB_USB_JS_0580
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, ClearFeature: cmd 1 target 0 reqType 0 value 0 index 0
*/
it('SUB_USB_JS_0580', 0, function () {
console.info('usb SUB_USB_JS_0580 begin');
......@@ -539,11 +553,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0590
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 1 reqType 129 value 512 index 0
* @tc.number: SUB_USB_JS_0590
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, ClearFeature: cmd 255 target 1 reqType 129 value 512 index 0
*/
it('SUB_USB_JS_0590', 0, function () {
it('SUB_USB_JS_0590', 0, function () {
console.info('usb SUB_USB_JS_0590 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -563,11 +577,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0600
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 2 reqType 34 value 512 index 0
* @tc.number: SUB_USB_JS_0600
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, ClearFeature: cmd 255 target 2 reqType 34 value 512 index 0
*/
it('SUB_USB_JS_0600', 0, function () {
it('SUB_USB_JS_0600', 0, function () {
console.info('usb SUB_USB_JS_0600 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -587,11 +601,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0610
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 3 reqType 67 value 512 index 0
* @tc.number: SUB_USB_JS_0610
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, ClearFeature: cmd 255 target 3 reqType 67 value 512 index 0
*/
it('SUB_USB_JS_0610', 0, function () {
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')
......@@ -611,11 +625,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0620
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 255 target 3 reqType 35 value 0 index 0
* @tc.number: SUB_USB_JS_0620
* @tc.name: controlTransfer
* @tc.desc: Positive test: control transfer, ClearFeature: cmd 255 target 3 reqType 35 value 0 index 0
*/
it('SUB_USB_JS_0620', 0, function () {
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')
......@@ -635,11 +649,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_1140
* @tc.name : controlTransfer
* @tc.desc : 反向测试 控制传输 参数类型错误
* @tc.number: SUB_USB_JS_1140
* @tc.name: controlTransfer
* @tc.desc: Negative test: control transfer, parameter number exception, input a parameter
*/
it('SUB_USB_JS_1140', 0, function () {
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')
......@@ -663,11 +677,11 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_1300
* @tc.name : controlTransfer
* @tc.desc : 反向测试 控制传输 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1300
* @tc.name: controlTransfer
* @tc.desc: Negative test: control transfer, parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1300', 0, function () {
it('SUB_USB_JS_1300', 0, function () {
console.info('usb SUB_USB_JS_1300 begin');
if (portCurrentMode == 1) {
console.info('usb case get_device port is device')
......@@ -689,5 +703,37 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
console.info('usb SUB_USB_JS_1300 : PASS');
}
})
/**
* @tc.number: SUB_USB_JS_1440
* @tc.name: controlTransfer
* @tc.desc: Negative test: control transfer, parameter pipe type error
*/
it('SUB_USB_JS_1440', 0, function () {
console.info('usb SUB_USB_JS_1440 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 testParamPip = "invalid";
var timeout = 5000;
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE)
| (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0);
try {
var maskCode = usb.controlTransfer(testParamPip, controlParam, timeout);
console.info('usb 1440 case controlTransfer return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('usb 1440 catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1440 : PASS');
}
})
})
}
......@@ -50,9 +50,9 @@ describe('UsbFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0330
* @tc.name : getCurrentFunctions
* @tc.desc : 获取当前设备模式 掩码与描述字符转换
* @tc.number: SUB_USB_JS_0330
* @tc.name: getCurrentFunctions
* @tc.desc: Positive test: Get current device mode, mask and description character conversion
*/
it('SUB_USB_JS_0330', 0, function () {
console.info('usb SUB_USB_JS_0330 begin');
......@@ -65,13 +65,12 @@ describe('UsbFunctionsJsFunctionsTest', function () {
console.info('usb case strMaskCode usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(maskCode);
console.info('usb SUB_USB_JS_0330 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0340
* @tc.name : usbFunctionString
* @tc.desc : 反向测试 获取当前设备模式 掩码与描述字符转换
* @tc.number: SUB_USB_JS_0340
* @tc.name: usbFunctionString
* @tc.desc: Negative test: Get current device mode, mask and description character conversion, nMaskcode=0
*/
it('SUB_USB_JS_0340', 0, function () {
console.info('usb SUB_USB_JS_0340 begin');
......@@ -90,17 +89,17 @@ describe('UsbFunctionsJsFunctionsTest', function () {
var errStrMaskCode = 'none'
var nMaskCode = usb.usbFunctionsFromString(errStrMaskCode)
expect(nMaskCode).assertEqual(usb.NONE);
console.info('usb case errStrMaskCode ' + errStrMaskCode +
' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.NONE);
console.info('usb SUB_USB_JS_0340 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1000
* @tc.name : getCurrentFunctions
* @tc.desc : 反向测试 获取当前设备模式 入参错误(无参接口传参)
* @tc.number: SUB_USB_JS_1000
* @tc.name: getCurrentFunctions
* @tc.desc: Negative test: Get the current device mode,
* parameters exception(parameter transfer without parameter interface)
*/
it('SUB_USB_JS_1000', 0, function () {
console.info('usb SUB_USB_JS_1000 begin');
......
......@@ -53,116 +53,116 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0930
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 0 返回 'none'
* @tc.number: SUB_USB_JS_0930
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 0, return 'none'
*/
it('SUB_USB_JS_0930', 0, function () {
console.info('usb SUB_USB_JS_0930 begin');
var maskCode = usb.NONE
console.info('usb case maskCode : ' + usb.NONE);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('none');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('none');
console.info('usb SUB_USB_JS_0930 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0940
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 1 返回 'acm'
* @tc.number: SUB_USB_JS_0940
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 1, return 'acm'
*/
it('SUB_USB_JS_0940', 0, function () {
console.info('usb SUB_USB_JS_0940 begin');
var maskCode = usb.ACM
console.info('usb case maskCode : ' + usb.ACM);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('acm');
console.info('usb SUB_USB_JS_0940 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0950
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 2 返回 'ecm'
* @tc.number: SUB_USB_JS_0950
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 2, return 'ecm'
*/
it('SUB_USB_JS_0950', 0, function () {
console.info('usb SUB_USB_JS_0950 begin');
var maskCode = usb.ECM
console.info('usb case maskCode : ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('ecm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('ecm');
console.info('usb SUB_USB_JS_0950 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0960
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 3 返回 'acm,ecm'
* @tc.number: SUB_USB_JS_0960
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 3, return 'acm,ecm'
*/
it('SUB_USB_JS_0960', 0, function () {
console.info('usb SUB_USB_JS_0960 begin');
var maskCode = usb.ACM | usb.ECM
console.info('usb case maskCode : ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm,ecm');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('acm,ecm');
console.info('usb SUB_USB_JS_0960 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0970
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 4 返回 'hdc'
* @tc.number: SUB_USB_JS_0970
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 4, return 'hdc'
*/
it('SUB_USB_JS_0970', 0, function () {
console.info('usb SUB_USB_JS_0970 begin');
var maskCode = usb.HDC
console.info('usb case maskCode : ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('hdc');
console.info('usb SUB_USB_JS_0970 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0980
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 5 返回 'acm,hdc'
* @tc.number: SUB_USB_JS_0980
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 5, return 'acm,hdc'
*/
it('SUB_USB_JS_0980', 0, function () {
console.info('usb SUB_USB_JS_0980 begin');
var maskCode = usb.ACM | usb.HDC
console.info('usb case maskCode : ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('acm,hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('acm,hdc');
console.info('usb SUB_USB_JS_0980 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0990
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 6 返回 'ecm,hdc'
* @tc.number: SUB_USB_JS_0990
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 6, return 'ecm,hdc'
*/
it('SUB_USB_JS_0990', 0, function () {
console.info('usb SUB_USB_JS_0990 begin');
var maskCode = usb.ECM | usb.HDC
console.info('usb case maskCode : ' + maskCode);
var strMaskCode = usb.usbFunctionsToString(maskCode)
expect(strMaskCode).assertEqual('ecm,hdc');
console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode);
expect(strMaskCode).assertEqual('ecm,hdc');
console.info('usb SUB_USB_JS_0990 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1160
* @tc.name : usbFunctionsToString
* @tc.desc : 反向测试 掩码转化成描述字符 参数类型错误
* @tc.number: SUB_USB_JS_1160
* @tc.name: usbFunctionsToString
* @tc.desc: Negative test: Mask converted to description character, parameter type error
*/
it('SUB_USB_JS_1160', 0, function () {
it('SUB_USB_JS_1160', 0, function () {
console.info('usb SUB_USB_JS_1160 begin');
try {
var maskCode = usb.usbFunctionsToString("invalid");
......@@ -176,11 +176,12 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1360
* @tc.name : usbFunctionsToString
* @tc.desc : 反向测试 掩码转化成描述字符 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1360
* @tc.name: usbFunctionsToString
* @tc.desc: Negative test: Mask converted to description character,
* parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1360', 0, function () {
it('SUB_USB_JS_1360', 0, function () {
console.info('usb SUB_USB_JS_1360 begin');
try {
var maskCode = usb.usbFunctionsToString();
......@@ -194,109 +195,109 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0860
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'none' 返回 0
* @tc.number: SUB_USB_JS_0860
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'none', return 0
*/
it('SUB_USB_JS_0860', 0, function () {
console.info('usb SUB_USB_JS_0860 begin');
var strMaskCode = 'none'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.NONE);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.NONE);
console.info('usb SUB_USB_JS_0860 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0870
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm' 返回 1
* @tc.number: SUB_USB_JS_0870
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'acm', return 1
*/
it('SUB_USB_JS_0870', 0, function () {
console.info('usb SUB_USB_JS_0870 begin');
var strMaskCode = 'acm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.ACM);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.ACM);
console.info('usb SUB_USB_JS_0870 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0880
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm' 返回 2
* @tc.number: SUB_USB_JS_0880
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'ecm', return 2
*/
it('SUB_USB_JS_0880', 0, function () {
console.info('usb SUB_USB_JS_0880 begin');
var strMaskCode = 'ecm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.ECM);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.ECM);
console.info('usb SUB_USB_JS_0880 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0890
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,ecm' 返回 3
* @tc.number: SUB_USB_JS_0890
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'acm,ecm', return 3
*/
it('SUB_USB_JS_0890', 0, function () {
console.info('usb SUB_USB_JS_0890 begin');
var strMaskCode = 'acm,ecm'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.ACM | usb.ECM);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.ACM | usb.ECM);
console.info('usb SUB_USB_JS_0890 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0900
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'hdc' 返回 4
* @tc.number: SUB_USB_JS_0900
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'hdc', return 4
*/
it('SUB_USB_JS_0900', 0, function () {
console.info('usb SUB_USB_JS_0900 begin');
var strMaskCode = 'hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.HDC);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.HDC);
console.info('usb SUB_USB_JS_0900 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0910
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,hdc' 返回 5
* @tc.number: SUB_USB_JS_0910
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'acm,hdc', return 5
*/
it('SUB_USB_JS_0910', 0, function () {
console.info('usb SUB_USB_JS_0910 begin');
var strMaskCode = 'acm,hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.HDC | usb.ACM);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.HDC | usb.ACM);
console.info('usb SUB_USB_JS_0910 : PASS');
})
/**
* @tc.number : SUB_USB_JS_0920
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm,hdc' 返回 6
* @tc.number: SUB_USB_JS_0920
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'ecm,hdc', return 6
*/
it('SUB_USB_JS_0920', 0, function () {
console.info('usb SUB_USB_JS_0920 begin');
var strMaskCode = 'ecm,hdc'
var nMaskCode = usb.usbFunctionsFromString(strMaskCode)
expect(nMaskCode).assertEqual(usb.HDC | usb.ECM);
console.info('usb case strMaskCode ' + strMaskCode + ' usbFunctionsFromString return int: ' + nMaskCode);
expect(nMaskCode).assertEqual(usb.HDC | usb.ECM);
console.info('usb SUB_USB_JS_0920 : PASS');
})
/**
* @tc.number : SUB_USB_JS_1170
* @tc.name : usbFunctionsFromString
* @tc.desc : 反向测试 描述字符转换成掩码 参数类型错误
* @tc.number: SUB_USB_JS_1170
* @tc.name: usbFunctionsFromString
* @tc.desc: Negative test: Description character converted to mask, parameter type error
*/
it('SUB_USB_JS_1170', 0, function () {
it('SUB_USB_JS_1170', 0, function () {
console.info('usb SUB_USB_JS_1170 begin');
try {
var maskCode = usb.usbFunctionsFromString(invalidCode);
......@@ -310,11 +311,12 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1370
* @tc.name : usbFunctionsFromString
* @tc.desc : 反向测试 描述字符转换成掩码 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1370
* @tc.name: usbFunctionsFromString
* @tc.desc: Negative test: Description character converted to mask,
* parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1370', 0, function () {
it('SUB_USB_JS_1370', 0, function () {
console.info('usb SUB_USB_JS_1370 begin');
try {
var maskCode = usb.usbFunctionsFromString();
......
......@@ -64,9 +64,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_JS_0350
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 1 设置为ACM功能
* @tc.number: SUB_USB_JS_0350
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 1, Set as ACM function
*/
it('SUB_USB_JS_0350', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -79,9 +79,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0360
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能
* @tc.number: SUB_USB_JS_0360
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 2, Set as ECM function
*/
it('SUB_USB_JS_0360', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -94,9 +94,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0370
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能
* @tc.number: SUB_USB_JS_0370
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 3, Set as ACM、ECM function
*/
it('SUB_USB_JS_0370', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -109,9 +109,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0380
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 4 设置为HDC功能
* @tc.number: SUB_USB_JS_0380
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 4, Set as HDC function
*/
it('SUB_USB_JS_0380', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -124,9 +124,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0390
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 5 设置为ACM、HDC功能
* @tc.number: SUB_USB_JS_0390
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 5, Set as ACM、HDC function
*/
it('SUB_USB_JS_0390', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -139,9 +139,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0400
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 6 设置为ECM、HDC功能
* @tc.number: SUB_USB_JS_0400
* @tc.name: functions_test
* @tc.desc: Positive test: Set the current USB function list in device mode, Set 6, Set as ECM、HDC function
*/
it('SUB_USB_JS_0400', 0, function () {
CheckEmptyUtils.sleep(3000)
......@@ -154,9 +154,9 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0010
* @tc.name : setPortRoles
* @tc.desc : 切换为Device set powerRole 2 DataRole 2
* @tc.number: SUB_USB_JS_0010
* @tc.name: setPortRoles
* @tc.desc: Positive test: Switch to Device, set powerRole 2 DataRole 2
*/
it('SUB_USB_JS_0010', 0, function () {
console.info('usb SUB_USB_JS_0010 device 2 2 begin');
......@@ -168,25 +168,24 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
}
for (var i = 0; i < usbPortList.length; i++) {
console.info('usb case set data role 2, data role 2');
console.info('usb 0010 case set data role 2, data role 2');
usb.setPortRoles(usbPortList[i].id, usb.SINK, usb.DEVICE).then(data => {
console.info('usb case setPortRoles return: ' + data);
console.info('usb 0010 case setPortRoles return: ' + data);
expect(data).assertTrue();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0010 case setPortRoles error : ' + error);
expect(false).assertTrue();
});
CheckEmptyUtils.sleep(8000)
}
console.info('usb SUB_USB_JS_0010 device 2 2: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0020
* @tc.name : setPortRoles
* @tc.desc : 切换为host set powerRole 1 DataRole 1
* @tc.number: SUB_USB_JS_0020
* @tc.name: setPortRoles
* @tc.desc: Positive test: Switch to host, set powerRole 1 DataRole 1
*/
it('SUB_USB_JS_0020', 0, function () {
console.info('usb SUB_USB_JS_0020 host 1 1 begin');
......@@ -198,19 +197,18 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
}
for (var i = 0; i < usbPortList.length; i++) {
console.info('usb case set data role 1, data role 1');
console.info('usb 0020 case set data role 1, data role 1');
usb.setPortRoles(usbPortList[i].id, usb.SOURCE, usb.HOST).then(data => {
console.info('usb 0020 case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb case setPortRoles return: ' + data);
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0020 case setPortRoles error : ' + error);
expect(false).assertTrue();
});
CheckEmptyUtils.sleep(8000)
}
console.info('usb SUB_USB_JS_0020 host 1 1: PASS');
expect(true).assertTrue();
})
})
}
......@@ -37,9 +37,9 @@ describe('UsbPortJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_JS_0410
* @tc.name : getPorts
* @tc.desc : 获取USB端口描述信息列表
* @tc.number: SUB_USB_JS_0410
* @tc.name: getPorts
* @tc.desc: Positive test: Get USB port description information list
*/
it('SUB_USB_JS_0410', 0, function () {
console.info('usb SUB_USB_JS_0410 begin');
......@@ -51,13 +51,12 @@ describe('UsbPortJsFunctionsTest', function () {
}
expect(usbPortList.length > 0).assertTrue();
console.info('usb SUB_USB_JS_0410 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0220
* @tc.name : getSupportedModes
* @tc.desc : 获取指定的端口支持的模式列表的组合掩码
* @tc.number: SUB_USB_JS_0220
* @tc.name: getSupportedModes
* @tc.desc: Positive test: Get the combination mask of the mode list supported by the specified port
*/
it('SUB_USB_JS_0220', 0, function () {
console.info('usb SUB_USB_JS_0220 begin');
......@@ -75,7 +74,6 @@ describe('UsbPortJsFunctionsTest', function () {
}
console.info('usb SUB_USB_JS_0220 : PASS');
expect(true).assertTrue();
})
})
......
......@@ -40,9 +40,9 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0230
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 改变id 获取指定的端口支持的模式列表的组合掩码
* @tc.number: SUB_USB_JS_0230
* @tc.name: getSupportedModes
* @tc.desc: Negative test: Get the combination mask of the mode list supported by the specified port, id error
*/
it('SUB_USB_JS_0230', 0, function () {
console.info('usb SUB_USB_JS_0230 begin');
......@@ -60,15 +60,15 @@ describe('UsbPortJsFunctionsTestEx', function () {
expect(maskCode).assertEqual(usb.NONE);
console.info('usb SUB_USB_JS_0230 : PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1210
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 获取指定的端口支持的模式列表的组合掩码 参数类型错误
* @tc.number: SUB_USB_JS_1210
* @tc.name: getSupportedModes
* @tc.desc: Negative test: Get the combination mask of the mode list supported by the specified port,
* parameter type error
*/
it('SUB_USB_JS_1210', 0, function () {
it('SUB_USB_JS_1210', 0, function () {
console.info('usb SUB_USB_JS_1210 begin');
try {
var maskCode = usb.getSupportedModes("invalid");
......@@ -82,11 +82,12 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1380
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 获取指定的端口支持的模式列表的组合掩码 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1380
* @tc.name: getSupportedModes
* @tc.desc: Negative test: Get the combination mask of the mode list supported by the specified port,
* parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1380', 0, function () {
it('SUB_USB_JS_1380', 0, function () {
console.info('usb SUB_USB_JS_1380 begin');
try {
var maskCode = usb.getSupportedModes();
......@@ -100,144 +101,152 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_0030
* @tc.name : setPortRoles
* @tc.desc : dataRole参数错误
* @tc.number: SUB_USB_JS_0030
* @tc.name: setPortRoles
* @tc.desc: Negative test: dataRole error
*/
it('SUB_USB_JS_0030', 0, function () {
var portId = gPort.id;
var powerRole = usb.SINK;
var dataRole = usb.NONE - 1;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0030 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0030 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0030: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0030: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0040
* @tc.name : setPortRoles
* @tc.desc : portId,powerRole参数错误
* @tc.number: SUB_USB_JS_0040
* @tc.name: setPortRoles
* @tc.desc: Negative test: portId && powerRole error
*/
it('SUB_USB_JS_0040', 0, function () {
var portId = gPort.id;
var powerRole = usb.NONE - 1;
var dataRole = usb.DEVICE;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0040 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0040 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0040: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0040: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0050
* @tc.name : setPortRoles
* @tc.desc : portId,dataRole参数错误
* @tc.number: SUB_USB_JS_0050
* @tc.name: setPortRoles
* @tc.desc: Negative test: portId && dataRole error
*/
it('SUB_USB_JS_0050', 0, function () {
var portId = gPort.id - 3;
var powerRole = usb.SINK;
var dataRole = usb.NONE - 1;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0050 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0050 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0050: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0050: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0060
* @tc.name : setPortRoles
* @tc.desc : powerRole,dataRole参数错误
* @tc.number: SUB_USB_JS_0060
* @tc.name: setPortRoles
* @tc.desc: Negative test: powerRole && dataRole error
*/
it('SUB_USB_JS_0060', 0, function () {
var portId = gPort.id;
var powerRole = usb.NONE - 1;
var dataRole = usb.NONE - 1;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0060 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0060 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0060: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0060: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0070
* @tc.name : setPortRoles
* @tc.desc : portId,powerRole,dataRole参数错误
* @tc.number: SUB_USB_JS_0070
* @tc.name: setPortRoles
* @tc.desc: Negative test: portId && powerRole && dataRole error
*/
it('SUB_USB_JS_0070', 0, function () {
var portId = gPort.id - 1;
var dataRole = usb.NONE - 1;
var powerRole = usb.NONE - 1;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0070 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0070 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0070: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0070: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_0080
* @tc.name : setPortRoles
* @tc.desc : portId参数错误
* @tc.number: SUB_USB_JS_0080
* @tc.name: setPortRoles
* @tc.desc: Negative test: portId error
*/
it('SUB_USB_JS_0080', 0, function () {
var portId = gPort.id - 1;
var powerRole = 1;
var dataRole = 1;
usb.setPortRoles(portId, powerRole, dataRole).then(data => {
console.info('usb case setPortRoles return: ' + data);
expect(data).assertTrue();
console.info('usb 0080 case setPortRoles return: ' + data);
expect(data).assertFalse();
}).catch(error => {
console.info('usb case setPortRoles error : ' + error);
console.info('usb 0080 case setPortRoles error : ' + error);
expect(error).assertFalse();
console.info('usb SUB_USB_JS_0080: PASS');
})
CheckEmptyUtils.sleep(8000)
console.info('usb SUB_USB_JS_0080: PASS');
expect(true).assertTrue();
})
/**
* @tc.number : SUB_USB_JS_1190
* @tc.name : setPortRoles
* @tc.desc : 反向测试 port功能切换 参数个数错误
* @tc.number: SUB_USB_JS_1410
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter type exception
*/
it('SUB_USB_JS_1410', 0, function () {
console.info('usb SUB_USB_JS_1410 begin');
var portId = "invalid";
var powerRole = usb.SINK;
var dataRole = usb.DEVICE;
try {
var maskCode = usb.setPortRoles(portId, powerRole, dataRole);
console.info('usb 1410 case setPortRoles return: ' + maskCode);
expect(false).assertTrue();
} catch (err) {
console.info('usb 1410 catch err code: ' + err.code + ' message: ' + err.message);
expect(err.code).assertEqual(401);
console.info('usb SUB_USB_JS_1410 : PASS');
}
})
/**
* @tc.number: SUB_USB_JS_1190
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter number exception, input a parameter
*/
it('SUB_USB_JS_1190', 0, function () {
it('SUB_USB_JS_1190', 0, function () {
console.info('usb SUB_USB_JS_1190 begin');
try {
var maskCode = usb.setPortRoles("invalid");
......@@ -251,11 +260,11 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1390
* @tc.name : setPortRoles
* @tc.desc : 反向测试 port功能切换 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1390
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1390', 0, function () {
it('SUB_USB_JS_1390', 0, function () {
console.info('usb SUB_USB_JS_1390 begin');
try {
var maskCode = usb.setPortRoles();
......@@ -269,11 +278,11 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1200
* @tc.name : getPorts
* @tc.desc : 反向测试 获取USB端口描述信息列表 入参错误(无参接口传参)
* @tc.number: SUB_USB_JS_1200
* @tc.name: getPorts
* @tc.desc: Negative test: parameters exception(parameter transfer without parameter interface)
*/
it('SUB_USB_JS_1200', 0, function () {
it('SUB_USB_JS_1200', 0, function () {
console.info('usb SUB_USB_JS_1200 begin');
try {
var maskCode = usb.getPorts("invalid");
......@@ -287,11 +296,11 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1180
* @tc.name : setCurrentFunctions
* @tc.desc : 反向测试 在设备模式下设置当前的USB功能列表 参数类型错误
* @tc.number: SUB_USB_JS_1180
* @tc.name: setCurrentFunctions
* @tc.desc: Negative test: parameter type error
*/
it('SUB_USB_JS_1180', 0, function () {
it('SUB_USB_JS_1180', 0, function () {
console.info('usb SUB_USB_JS_1180 begin');
try {
var maskCode = usb.setCurrentFunctions("invalid");
......@@ -305,11 +314,11 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_JS_1400
* @tc.name : setCurrentFunctions
* @tc.desc : 反向测试 在设备模式下设置当前的USB功能列表 参数个数错误,必要参数未传入
* @tc.number: SUB_USB_JS_1400
* @tc.name: setCurrentFunctions
* @tc.desc: Negative test: parameter number exception, necessary parameters not input
*/
it('SUB_USB_JS_1400', 0, function () {
it('SUB_USB_JS_1400', 0, function () {
console.info('usb SUB_USB_JS_1400 begin');
try {
var maskCode = usb.setCurrentFunctions();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册