Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3bbc0f53
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3bbc0f53
编写于
2月 09, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7388 【xts_acts】【master】添加401错误码用例
Merge pull request !7388 from 李晓枫/usb0202
上级
471b0ca5
88fbc255
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
393 addition
and
34 deletion
+393
-34
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
...usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
+59
-11
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
...b_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
+271
-22
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
+63
-1
未找到文件。
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
浏览文件 @
3bbc0f53
...
...
@@ -328,7 +328,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
/**
* @tc.number: SUB_USB_JS_0750
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration
* @tc.desc: Negative test: Set Device Configuration
, USBConfig id error
*/
it
(
'
SUB_USB_JS_0750
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0750 begin
'
);
...
...
@@ -648,6 +648,19 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0620 ClearFeature
'
)
})
function
callControlTransferEx
(
pip
,
controlParam
,
timeout
,
caseName
)
{
usb
.
controlTransfer
(
pip
,
controlParam
,
timeout
).
then
(
data
=>
{
console
.
info
(
'
usb controlTransfer ret data :
'
+
data
+
'
'
+
caseName
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb
'
+
caseName
+
'
: FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb controlTransfer error :
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
usb
'
+
caseName
+
'
: FAILED
'
);
expect
(
false
).
assertTrue
();
});
CheckEmptyUtils
.
sleep
(
3000
);
}
/**
* @tc.number: SUB_USB_JS_1140
* @tc.name: controlTransfer
...
...
@@ -666,9 +679,13 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
return
}
try
{
var
maskCode
=
usb
.
controlTransfer
(
"
invalid
"
);
console
.
info
(
'
usb 1140 case controlTransfer return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
usb
.
controlTransfer
(
"
invalid
"
).
then
(
data
=>
{
console
.
info
(
'
usb 1140 case controlTransfer ret data :
'
+
data
);
expect
(
false
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1140 case controlTransfer error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1140 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
...
...
@@ -694,9 +711,13 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
return
}
try
{
var
maskCode
=
usb
.
controlTransfer
();
console
.
info
(
'
usb 1300 case controlTransfer return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
usb
.
controlTransfer
().
then
(
data
=>
{
console
.
info
(
'
usb 1300 case controlTransfer ret data :
'
+
data
);
expect
(
false
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1300 case controlTransfer error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1300 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
...
...
@@ -716,7 +737,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
var
testParam
=
getTransferTestParam
()
;
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
return
...
...
@@ -726,14 +747,41 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
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
();
callControlTransferEx
(
testParamPip
,
controlParam
,
timeout
,
'
SUB_USB_JS_1440 ClearFeature
'
);
}
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
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1560
* @tc.name: controlTransfer
* @tc.desc: Negative test: control transfer,
* parameter contrlparam type error(The controlParam should have the data property)
*/
it
(
'
SUB_USB_JS_1560
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1560 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb 1560 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
controlParam
=
"
invalid
"
;
var
timeout
=
5000
;
try
{
callControlTransferEx
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_1560 ClearFeature
'
);
}
catch
(
err
)
{
console
.
info
(
'
usb 1560 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1560 : PASS
'
);
}
})
})
}
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
浏览文件 @
3bbc0f53
...
...
@@ -273,9 +273,15 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
expect
(
testParam
.
isClaimed
).
assertEqual
(
0
);
try
{
var
maskCode
=
usb
.
bulkTransfer
(
"
invalid
"
);
console
.
info
(
'
usb 1100 case bulkTransfer return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
usb
.
bulkTransfer
(
testParam
.
pip
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1100 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1100 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb SUB_USB_JS_1100 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1100 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1100 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
...
...
@@ -283,6 +289,44 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1480
* @tc.name: bulkTransfer
* @tc.desc: Negative test: bulk transfer, parameter number exception, input two parameter
*/
it
(
'
SUB_USB_JS_1480
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1480 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
inEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
return
}
testParam
.
isClaimed
=
usb
.
claimInterface
(
testParam
.
pip
,
testParam
.
interface
,
true
);
expect
(
testParam
.
isClaimed
).
assertEqual
(
0
);
try
{
usb
.
bulkTransfer
(
testParam
.
pip
,
testParam
.
outEndpoint
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1480 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1480 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1480 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1480 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1480 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1480 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1310
* @tc.name: bulkTransfer
...
...
@@ -300,12 +344,19 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
expect
(
false
).
assertTrue
();
return
}
try
{
var
maskCode
=
usb
.
bulkTransfer
();
console
.
info
(
'
usb 1310 case bulkTransfer return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
usb
.
bulkTransfer
().
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1310 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1310 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1310 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1310 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1
31
0 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
console
.
info
(
'
usb 1
48
0 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1310 : PASS
'
);
}
...
...
@@ -338,9 +389,15 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
tmpTestParam
.
pip
=
"
invalid
"
;
var
tmpUint8Array
=
new
Uint8Array
(
testParam
.
maxInSize
);
try
{
var
maskCode
=
usb
.
bulkTransfer
(
tmpTestParam
.
pip
,
tmpTestParam
.
inEndpoint
,
tmpUint8Array
,
5000
);
console
.
info
(
'
usb 1420 case bulkTransfer return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
usb
.
bulkTransfer
(
tmpTestParam
.
pip
,
tmpTestParam
.
inEndpoint
,
tmpUint8Array
,
5000
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1420 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1420 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1420 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1420 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1420 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
...
...
@@ -348,6 +405,49 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1490
* @tc.name: bulkTransfer
* @tc.desc: Negative test: bulk transfer, parameter endpoint type error
*/
it
(
'
SUB_USB_JS_1490
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1490 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
);
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
inEndpoint
==
null
)
{
console
.
info
(
'
usb case testParam_interface and testParam_inEndpoint is null
'
);
expect
(
false
).
assertTrue
();
return
}
testParam
.
isClaimed
=
usb
.
claimInterface
(
testParam
.
pip
,
testParam
.
interface
,
true
);
expect
(
testParam
.
isClaimed
).
assertEqual
(
0
);
console
.
info
(
'
usb case readData begin
'
);
var
tmpTestParam
=
testParam
;
tmpTestParam
.
inEndpoint
=
"
invalid
"
;
var
tmpUint8Array
=
new
Uint8Array
(
testParam
.
maxInSize
);
try
{
usb
.
bulkTransfer
(
tmpTestParam
.
pip
,
tmpTestParam
.
inEndpoint
,
tmpUint8Array
,
5000
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1490 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1490 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1490 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1490 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1490 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1490 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_0430
* @tc.name: claimInterface
...
...
@@ -653,6 +753,73 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1510
* @tc.name: claimInterface
* @tc.desc: Negative test: Get interface, parameter iface type error
*/
it
(
'
SUB_USB_JS_1510
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1510 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
TmpInterface
=
"
invalid
"
;
try
{
var
maskCode
=
usb
.
claimInterface
(
gPipe
,
TmpInterface
);
console
.
info
(
'
usb 1510 case claimInterface return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1510 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1510 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1520
* @tc.name: claimInterface
* @tc.desc: Negative test: Get interface, parameter force type error
*/
it
(
'
SUB_USB_JS_1520
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1520 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
{
for
(
var
j
=
0
;
j
<
gDeviceList
[
0
].
configs
.
length
;
j
++
)
{
if
(
gDeviceList
[
0
].
configs
[
j
].
interfaces
.
length
==
0
)
{
console
.
info
(
'
usb case SUB_USB_JS_1520 current device.configs.interfaces.length = 0
'
);
}
for
(
var
k
=
0
;
k
<
gDeviceList
[
0
].
configs
[
j
].
interfaces
.
length
;
k
++
)
{
var
TmpInterface
=
gDeviceList
[
0
].
configs
[
j
].
interfaces
[
k
];
var
maskCode
=
usb
.
claimInterface
(
gPipe
,
TmpInterface
,
"
invalid
"
);
console
.
info
(
'
usb 1520 case claimInterface return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
}
}
catch
(
err
)
{
console
.
info
(
'
usb 1520 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1520 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_0280
* @tc.name: releaseInterface
...
...
@@ -954,6 +1121,31 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1580
* @tc.name: releaseInterface
* @tc.desc: Negative test: release Interface, parameter iface type error
*/
it
(
'
SUB_USB_JS_1580
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1580 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb 1580 case get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
var
TmpInterface
=
"
invalid
"
;
try
{
var
maskCode
=
usb
.
releaseInterface
(
gPipe
,
TmpInterface
);
console
.
info
(
'
usb 1580 case releaseInterface return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1580 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1580 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_0820
* @tc.name: setInterface
...
...
@@ -1090,6 +1282,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
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
'
)
...
...
@@ -1174,10 +1367,40 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1550
* @tc.name: setInterface
* @tc.desc: Negative test: Set device interface, parameter iface type error
*/
it
(
'
SUB_USB_JS_1550
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1550 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case 1550 get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case 1550 get_device_list is null
'
)
expect
(
false
).
assertTrue
();
return
}
var
TmpInterface
=
"
invalid
"
;
try
{
var
maskCode
=
usb
.
setInterface
(
gPipe
,
TmpInterface
);
console
.
info
(
'
usb 1550 case setInterface return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1550 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1550 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_0760
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration, USBConfig name error
* @tc.desc: Negative test: Set Device Configuration, USBConfig name error
*/
it
(
'
SUB_USB_JS_0760
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0760 begin
'
);
...
...
@@ -1206,7 +1429,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
/**
* @tc.number: SUB_USB_JS_0770
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration, USBConfig name
error
* @tc.desc: Negative test: Set Device Configuration, USBConfig name
, id error
*/
it
(
'
SUB_USB_JS_0770
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0770 begin
'
);
...
...
@@ -1236,7 +1459,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
/**
* @tc.number: SUB_USB_JS_0780
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration, USBConfig attributes error
* @tc.desc: Negative test: Set Device Configuration, USBConfig attributes error
*/
it
(
'
SUB_USB_JS_0780
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0780 begin
'
);
...
...
@@ -1370,15 +1593,10 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
try
{
for
(
var
j
=
0
;
j
<
gDeviceList
[
0
].
configs
.
length
;
j
++
)
{
if
(
gDeviceList
[
0
].
configs
[
j
].
interfaces
.
length
==
0
)
{
console
.
info
(
'
usb case SUB_USB_JS_1470 current device.configs.interfaces.length = 0
'
);
}
for
(
var
k
=
0
;
k
<
gDeviceList
[
0
].
configs
[
j
].
interfaces
.
length
;
k
++
)
{
var
TmpInterface
=
gDeviceList
[
0
].
configs
[
j
].
interfaces
[
k
];
var
maskCode
=
usb
.
setConfiguration
(
testParamPip
,
TmpInterface
);
console
.
info
(
'
usb 1470 case setConfiguration return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
var
TmpConfig
=
gDeviceList
[
0
].
configs
[
j
];
var
maskCode
=
usb
.
setConfiguration
(
testParamPip
,
TmpConfig
);
console
.
info
(
'
usb 1470 case setConfiguration return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
}
catch
(
err
)
{
console
.
info
(
'
usb 1470 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
...
...
@@ -1386,5 +1604,36 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
console
.
info
(
'
usb SUB_USB_JS_1470 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1540
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration, parameter pipe type error
*/
it
(
'
SUB_USB_JS_1540
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1540 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
TmpConfig
=
"
invalid
"
;
try
{
var
maskCode
=
usb
.
setConfiguration
(
gPipe
,
TmpConfig
);
console
.
info
(
'
usb 1540 case setConfiguration return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1540 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1540 : PASS
'
);
}
})
})
}
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
浏览文件 @
3bbc0f53
...
...
@@ -223,7 +223,7 @@ describe('UsbPortJsFunctionsTestEx', function () {
/**
* @tc.number: SUB_USB_JS_1410
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter type exception
* @tc.desc: Negative test: parameter
portId
type exception
*/
it
(
'
SUB_USB_JS_1410
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1410 begin
'
);
...
...
@@ -277,6 +277,68 @@ describe('UsbPortJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1590
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter number exception, parameter powerRole type exception
*/
it
(
'
SUB_USB_JS_1590
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1590 begin
'
);
var
portId
=
gPort
.
id
;
var
powerRole
=
"
invalid
"
;
var
dataRole
=
usb
.
DEVICE
;
try
{
var
maskCode
=
usb
.
setPortRoles
(
portId
,
powerRole
,
dataRole
);
console
.
info
(
'
usb 1590 case setPortRoles return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1590 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1590 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1600
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter number exception, parameter dataRole type exception
*/
it
(
'
SUB_USB_JS_1600
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1600 begin
'
);
var
portId
=
gPort
.
id
;
var
powerRole
=
usb
.
SINK
;
var
dataRole
=
"
invalid
"
;
try
{
var
maskCode
=
usb
.
setPortRoles
(
portId
,
powerRole
,
dataRole
);
console
.
info
(
'
usb 1600 case setPortRoles return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1600 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1600 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1610
* @tc.name: setPortRoles
* @tc.desc: Negative test: parameter number exception, input two parameter
*/
it
(
'
SUB_USB_JS_1610
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1610 begin
'
);
var
portId
=
gPort
.
id
;
var
powerRole
=
usb
.
SINK
;
try
{
var
maskCode
=
usb
.
setPortRoles
(
portId
,
powerRole
);
console
.
info
(
'
usb 1610 case setPortRoles return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1610 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1610 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1200
* @tc.name: getPorts
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录