Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7bb609dc
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7bb609dc
编写于
7月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4030 【xts_acts】【master】usb测试套流水线fail,用例编号修改
Merge pull request !4030 from 李晓枫/lxf0701
上级
87259508
b5079c3a
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
1018 addition
and
642 deletion
+1018
-642
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
+8
-8
usb/usb_standard/src/main/js/default/test/UsbAutoJsunit.test.js
...b_standard/src/main/js/default/test/UsbAutoJsunit.test.js
+79
-79
usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js
...b_standard/src/main/js/default/test/UsbCoreJsunit.test.js
+136
-57
usb/usb_standard/src/main/js/default/test/UsbCoreJsunitEx.test.js
...standard/src/main/js/default/test/UsbCoreJsunitEx.test.js
+180
-91
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js
...dard/src/main/js/default/test/UsbDevicePipeJsunit.test.js
+162
-74
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunitEx.test.js
...rd/src/main/js/default/test/UsbDevicePipeJsunitEx.test.js
+232
-120
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js
...rd/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js
+82
-74
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunit.test.js
...ndard/src/main/js/default/test/UsbFunctionsJsunit.test.js
+32
-32
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunitEx.test.js
...ard/src/main/js/default/test/UsbFunctionsJsunitEx.test.js
+56
-56
usb/usb_standard/src/main/js/default/test/UsbPortJsunit.test.js
...b_standard/src/main/js/default/test/UsbPortJsunit.test.js
+20
-20
usb/usb_standard/src/main/js/default/test/UsbPortJsunitEx.test.js
...standard/src/main/js/default/test/UsbPortJsunitEx.test.js
+31
-31
未找到文件。
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
浏览文件 @
7bb609dc
...
...
@@ -15,17 +15,17 @@
/* host test case */
//
require('./UsbCoreJsunit.test.js')
//
require('./UsbCoreJsunitEx.test.js')
//
require('./UsbDevicePipeJsunit.test.js')
//
require('./UsbDevicePipeJsunitEx.test.js')
require
(
'
./UsbCoreJsunit.test.js
'
)
require
(
'
./UsbCoreJsunitEx.test.js
'
)
require
(
'
./UsbDevicePipeJsunit.test.js
'
)
require
(
'
./UsbDevicePipeJsunitEx.test.js
'
)
/* device test case */
//
require('./UsbFunctionsJsunit.test.js')
//
require('./UsbFunctionsJsunitEx.test.js')
require
(
'
./UsbFunctionsJsunit.test.js
'
)
require
(
'
./UsbFunctionsJsunitEx.test.js
'
)
/* device and host test case */
//
require('./UsbPortJsunit.test.js')
//
require('./UsbPortJsunitEx.test.js')
require
(
'
./UsbPortJsunit.test.js
'
)
require
(
'
./UsbPortJsunitEx.test.js
'
)
require
(
'
./UsbAutoJsunit.test.js
'
)
usb/usb_standard/src/main/js/default/test/UsbAutoJsunit.test.js
浏览文件 @
7bb609dc
...
...
@@ -53,208 +53,208 @@ describe('UsbAutoJsunit', function () {
})
/**
* @tc.number :
usb_function_to_string_test_01
* @tc.number :
SUB_USB_JS_0930
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 0 返回 'none'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_01
begin
'
);
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
usb_function_to_string_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0930
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_02
* @tc.number :
SUB_USB_JS_0940
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 1 返回 'acm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0940
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_03
* @tc.number :
SUB_USB_JS_0950
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 2 返回 'ecm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_03
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0950
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_04
* @tc.number :
SUB_USB_JS_0960
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 3 返回 'acm,ecm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_04
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0960
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_05
* @tc.number :
SUB_USB_JS_0970
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 4 返回 'hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_05
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_05
begin
'
);
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
usb_function_to_string_test_05
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0970
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_06
* @tc.number :
SUB_USB_JS_0980
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 5 返回 'acm,hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_06
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_06
begin
'
);
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
(
'
hdc,acm
'
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
console
.
info
(
'
usb
usb_function_to_string_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0980
: PASS
'
);
})
/**
* @tc.number :
usb_function_to_string_test_07
* @tc.number :
SUB_USB_JS_0990
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 6 返回 'ecm,hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_07
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_07
begin
'
);
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
(
'
hdc,ecm
'
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
console
.
info
(
'
usb
usb_function_to_string_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0990
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_01
* @tc.number :
SUB_USB_JS_0860
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'none' 返回 0
*/
it
(
'
SUB_USB_
usb_function_from_string_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_01
begin
'
);
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
usb_function_to_string_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0860
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_02
* @tc.number :
SUB_USB_JS_0870
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm' 返回 1
*/
it
(
'
SUB_USB_
usb_function_from_string_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_02
begin
'
);
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
usb_function_from_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0870
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_03
* @tc.number :
SUB_USB_JS_0880
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm' 返回 2
*/
it
(
'
SUB_USB_
usb_function_from_string_test_03
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_03
begin
'
);
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
usb_function_from_string_test_03
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0880
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_04
* @tc.number :
SUB_USB_JS_0890
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,ecm' 返回 3
*/
it
(
'
SUB_USB_
usb_function_from_string_test_04
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_04
begin
'
);
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
usb_function_from_string_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0890
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_05
* @tc.number :
SUB_USB_JS_0900
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'hdc' 返回 4
*/
it
(
'
SUB_USB_
usb_function_from_string_test_05
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_05
begin
'
);
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
usb_function_from_string_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0900
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_06
* @tc.number :
SUB_USB_JS_0910
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,hdc' 返回 5
*/
it
(
'
SUB_USB_
usb_function_from_string_test_06
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_06
begin
'
);
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
usb_function_from_string_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0910
: PASS
'
);
})
/**
* @tc.number :
usb_function_from_string_test_07
* @tc.number :
SUB_USB_JS_0920
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm,hdc' 返回 6
*/
it
(
'
SUB_USB_
usb_function_from_string_test_07
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_07
begin
'
);
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
usb_function_from_string_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0920
: PASS
'
);
})
/**
* @tc.number :
get_current_functions_test_01
* @tc.number :
SUB_USB_JS_0330
* @tc.name : getCurrentFunctions
* @tc.desc : 获取当前设备模式 掩码与描述字符转换
*/
it
(
'
SUB_USB_
get_current_functions_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_current_functions_test_01
begin
'
);
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
);
...
...
@@ -263,17 +263,17 @@ describe('UsbAutoJsunit', function () {
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
maskCode
);
console
.
info
(
'
usb
get_current_functions_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0330
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number :
get_current_functions_test_02
* @tc.number :
SUB_USB_JS_0340
* @tc.name : usbFunctionString
* @tc.desc : 反向测试 获取当前设备模式 掩码与描述字符转换
*/
it
(
'
SUB_USB_
get_current_functions_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_current_functions_test_02
begin
'
);
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
);
...
...
@@ -293,37 +293,37 @@ describe('UsbAutoJsunit', function () {
console
.
info
(
'
usb case errStrMaskCode
'
+
errStrMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
console
.
info
(
'
usb
get_current_functions_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0340
: PASS
'
);
})
/**
* @tc.number :
get_ports_test_01
* @tc.number :
SUB_USB_JS_0410
* @tc.name : getPorts
* @tc.desc : 获取USB端口描述信息列表
*/
it
(
'
SUB_USB_
get_ports_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_ports_test_01
begin
'
);
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
get_ports_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0410
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
expect
(
usbPortList
.
length
>
0
).
assertTrue
();
console
.
info
(
'
usb
get_ports_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0410
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number :
get_supported_modes_test_01
* @tc.number :
SUB_USB_JS_0220
* @tc.name : getSupportedModes
* @tc.desc : 获取指定的端口支持的模式列表的组合掩码
*/
it
(
'
SUB_USB_
get_supported_modes_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_supported_modes_test_01
begin
'
);
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
get_supported_modes_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0220
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -334,20 +334,20 @@ describe('UsbAutoJsunit', function () {
expect
(
maskCode
).
assertEqual
(
usbPortList
[
i
].
supportedModes
);
}
console
.
info
(
'
usb
get_supported_modes_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0220
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number :
get_supported_modes_test_02
* @tc.number :
SUB_USB_JS_0230
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 改变id 获取指定的端口支持的模式列表的组合掩码
*/
it
(
'
SUB_USB_
get_supported_modes_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_supported_modes_test_02
begin
'
);
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
get_supported_modes_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0230
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -358,7 +358,7 @@ describe('UsbAutoJsunit', function () {
var
maskCode
=
usb
.
getSupportedModes
(
portID
)
expect
(
maskCode
).
assertEqual
(
0
);
console
.
info
(
'
usb
get_supported_modes_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0230
: PASS
'
);
expect
(
true
).
assertTrue
();
})
...
...
usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js
浏览文件 @
7bb609dc
...
...
@@ -21,21 +21,32 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
/* usb core functions test */
describe
(
'
UsbCoreJsFunctionsTest
'
,
function
()
{
var
gDeviceList
;
var
gPipe
;
var
portCurrentMode
;
beforeAll
(
function
()
{
console
.
log
(
'
*************Usb Unit UsbCoreJsFunctionsTest Begin*************
'
);
var
Version
=
usb
.
getVersion
()
console
.
info
(
'
begin test getversion :
'
+
Version
)
// version > 17 host currentMode = 2 device currentMode = 1
var
usbPortList
=
usb
.
getPorts
()
gDeviceList
=
usb
.
getDevices
();
if
(
usbPortList
.
length
>
0
)
{
if
(
usbPortList
[
0
].
status
.
currentMode
==
1
)
{
usb
.
setPortRoles
(
usbPortList
[
0
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
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 Begin switch to host*************
'
);
console
.
info
(
'
usb case gDeviceList.length return:
'
+
gDeviceList
.
length
);
if
(
gDeviceList
.
length
>
0
)
{
if
(
usbPortList
[
0
].
status
.
currentMode
==
1
)
{
usb
.
setPortRoles
(
usbPortList
[
0
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
then
(
data
=>
{
portCurrentMode
=
2
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
});
CheckEmptyUtils
.
sleep
(
8000
)
console
.
log
(
'
*************Usb Unit Begin switch to host*************
'
);
}
}
else
{
portCurrentMode
=
1
}
}
})
...
...
@@ -49,16 +60,19 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
log
(
'
*************Usb Unit UsbCoreJsFunctionsTest End*************
'
);
})
var
gDeviceList
var
gPipe
;
/**
* @tc.number : SUB_USB_
get_devices_test_01
* @tc.number : SUB_USB_
JS_0480
* @tc.name : getDevices
* @tc.desc : 获取设备列表
*/
it
(
'
SUB_USB_get_devices_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb get_device_01 begin
'
);
it
(
'
SUB_USB_JS_0480
'
,
0
,
function
()
{
console
.
info
(
'
*****SUB_USB_JS_0480 portcurrentMode**** ret :
'
+
portCurrentMode
)
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
console
.
info
(
'
usb SUB_USB_JS_0480 begin
'
);
gDeviceList
=
usb
.
getDevices
();
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_devices list is null
'
)
...
...
@@ -67,17 +81,22 @@ describe('UsbCoreJsFunctionsTest', function () {
}
expect
(
gDeviceList
.
length
).
assertLarger
(
0
);
console
.
info
(
'
usb case getDevices ret length:
'
+
gDeviceList
.
length
);
console
.
info
(
'
usb
get_devices_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0480
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
has_right_01
* @tc.number : SUB_USB_
JS_0710
* @tc.name : hasRigt
* @tc.desc : 权限查询 连接设备 关闭设备
*/
it
(
'
SUB_USB_
has_right_01
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0710
'
,
0
,
function
()
{
console
.
info
(
'
usb has_right_01 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
();
...
...
@@ -89,18 +108,23 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb has_right ret :
'
+
hasRight
);
}
console
.
info
(
'
usb
has_right_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0710
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
request_right_01
* @tc.number : SUB_USB_
JS_0680
* @tc.name : requestRight
* @tc.desc : 请求权限
*/
it
(
'
SUB_USB_request_right_01
'
,
0
,
function
()
{
console
.
info
(
'
usb request_right_01 begin
'
);
it
(
'
SUB_USB_JS_0680
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0680 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
();
...
...
@@ -111,7 +135,7 @@ describe('UsbCoreJsFunctionsTest', function () {
usb
.
requestRight
(
gDeviceList
[
i
].
name
).
then
(
hasRight
=>
{
expect
(
hasRight
).
assertTrue
();
console
.
info
(
'
usb request_right ret :
'
+
hasRight
);
console
.
info
(
'
usb
request_right_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0680
: PASS
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case device request right failed :
'
+
error
+
'
:
'
+
gDeviceList
[
i
].
name
);
expect
(
false
).
assertTrue
();
...
...
@@ -120,12 +144,17 @@ describe('UsbCoreJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_
connect_device_01
* @tc.number : SUB_USB_
JS_0090
* @tc.name : connectDevice
* @tc.desc : 打开设备
*/
it
(
'
SUB_USB_connect_device_01
'
,
0
,
function
()
{
console
.
info
(
'
usb connect_device_01 begin
'
);
it
(
'
SUB_USB_JS_0090
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0090 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
();
...
...
@@ -145,16 +174,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case connectDevice ret:
'
+
JSON
.
stringify
(
gPipe
));
expect
(
CheckEmptyUtils
.
isEmpty
(
gPipe
)).
assertFalse
();
console
.
info
(
'
usb
connect_device_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0090
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
close_pipe_02
* @tc.number : SUB_USB_
JS_0250
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 busNum
*/
it
(
'
SUB_USB_close_pipe_02
'
,
0
,
function
()
{
console
.
info
(
'
usb close_pipe_02 begin
'
);
it
(
'
SUB_USB_JS_0250
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0250 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
();
...
...
@@ -167,16 +201,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case closePipe ret:
'
+
isPipClose
);
expect
(
isPipClose
==
0
).
assertFalse
();
console
.
info
(
'
usb
close_pipe_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0250
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
close_pipe_03
* @tc.number : SUB_USB_
JS_0260
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 devAddress
*/
it
(
'
SUB_USB_close_pipe_03
'
,
0
,
function
()
{
console
.
info
(
'
usb close_pipe_03 begin
'
);
it
(
'
SUB_USB_JS_0260
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0260 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
();
...
...
@@ -188,16 +227,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case closePipe ret:
'
+
isPipClose
);
expect
(
isPipClose
==
0
).
assertFalse
();
console
.
info
(
'
usb
close_pipe_03
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0260
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
close_pipe_04
* @tc.number : SUB_USB_
JS_0270
* @tc.name : closePipe
* @tc.desc : 反向测试 关闭设备 错误 devAddress busNum
*/
it
(
'
SUB_USB_close_pipe_04
'
,
0
,
function
()
{
console
.
info
(
'
usb close_pipe_04 begin
'
);
it
(
'
SUB_USB_JS_0270
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0270 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
();
...
...
@@ -210,16 +254,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case closePipe ret:
'
+
isPipClose
);
expect
(
isPipClose
==
0
).
assertFalse
();
console
.
info
(
'
usb
close_pipe_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0270
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
close_pipe_01
* @tc.number : SUB_USB_
JS_0240
* @tc.name : closePipe
* @tc.desc : 关闭设备
*/
it
(
'
SUB_USB_close_pipe_01
'
,
0
,
function
()
{
console
.
info
(
'
usb close_pipe_01 begin
'
);
it
(
'
SUB_USB_JS_0240
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0240 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
();
...
...
@@ -231,15 +280,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case closePipe ret:
'
+
isPipClose
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb
close_pipe_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0240
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
get_raw_descriptor_01
* @tc.number : SUB_USB_
JS_0530
* @tc.name : getRawDescriptor
* @tc.desc : 获取原始的USB描述符
*/
it
(
'
SUB_USB_get_raw_descriptor_01
'
,
0
,
function
()
{
it
(
'
SUB_USB_JS_0530
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0530 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
();
...
...
@@ -254,15 +309,21 @@ describe('UsbCoreJsFunctionsTest', function () {
var
isPipClose
=
usb
.
closePipe
(
gPipe
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb SUB_USB_
get_raw_descriptor_01
: PASS
'
);
console
.
info
(
'
usb SUB_USB_
JS_0530
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
get_file_descriptor_01
* @tc.number : SUB_USB_
JS_0490
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符
*/
it
(
'
SUB_USB_get_file_descriptor_01
'
,
0
,
function
()
{
it
(
'
SUB_USB_JS_0490
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0490 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
();
...
...
@@ -276,15 +337,21 @@ describe('UsbCoreJsFunctionsTest', function () {
var
isPipClose
=
usb
.
closePipe
(
gPipe
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb SUB_USB_
get_file_descriptor_01
: PASS
'
);
console
.
info
(
'
usb SUB_USB_
JS_0490
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
get_file_descriptor_02
* @tc.number : SUB_USB_
JS_0500
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数busNum=512
*/
it
(
'
SUB_USB_get_file_descriptor_02
'
,
0
,
function
()
{
it
(
'
SUB_USB_JS_0500
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_0500 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
();
...
...
@@ -298,15 +365,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case getFileDescriptor ret:
'
+
fileDescriptor
);
var
isPipClose
=
usb
.
closePipe
(
gPipe
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb SUB_USB_
get_file_descriptor_02
: PASS
'
);
console
.
info
(
'
usb SUB_USB_
JS_0500
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
get_file_descriptor_03
* @tc.number : SUB_USB_
JS_0510
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数devAddress=512
*/
it
(
'
SUB_USB_get_file_descriptor_03
'
,
0
,
function
()
{
it
(
'
SUB_USB_JS_0510
'
,
0
,
function
()
{
console
.
info
(
'
usb get_file_descriptor_03 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
();
...
...
@@ -320,15 +393,21 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case getFileDescriptor ret:
'
+
fileDescriptor
);
var
isPipClose
=
usb
.
closePipe
(
gPipe
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb SUB_USB_
get_file_descriptor_03
: PASS
'
);
console
.
info
(
'
usb SUB_USB_
JS_0510
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
get_file_descriptor_04
* @tc.number : SUB_USB_
JS_0520
* @tc.name : getFileDescriptor
* @tc.desc : 获取文件描述符,反向测试,错误参数busNum=512,devAddress=512
*/
it
(
'
SUB_USB_get_file_descriptor_04
'
,
0
,
function
()
{
it
(
'
SUB_USB_JS_0520
'
,
0
,
function
()
{
console
.
info
(
'
usb get_file_descriptor_04 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
();
...
...
@@ -342,7 +421,7 @@ describe('UsbCoreJsFunctionsTest', function () {
console
.
info
(
'
usb case getFileDescriptor ret:
'
+
fileDescriptor
);
var
isPipClose
=
usb
.
closePipe
(
gPipe
);
expect
(
isPipClose
).
assertEqual
(
0
);
console
.
info
(
'
usb SUB_USB_
get_file_descriptor_04
: PASS
'
);
console
.
info
(
'
usb SUB_USB_
JS_0520
: PASS
'
);
})
})
usb/usb_standard/src/main/js/default/test/UsbCoreJsunitEx.test.js
浏览文件 @
7bb609dc
此差异已折叠。
点击以展开。
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js
浏览文件 @
7bb609dc
此差异已折叠。
点击以展开。
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunitEx.test.js
浏览文件 @
7bb609dc
此差异已折叠。
点击以展开。
usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit_A.test.js
浏览文件 @
7bb609dc
...
...
@@ -23,6 +23,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe
(
'
UsbDevicePipeJsFunctionsTest
'
,
function
()
{
var
gDeviceList
var
gPipe
var
portCurrentMode
beforeAll
(
function
()
{
console
.
log
(
'
*************Usb Unit UsbDevicePipeJsFunctionsTest Begin*************
'
);
...
...
@@ -30,15 +31,22 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
console
.
info
(
'
usb unit begin test getversion :
'
+
Version
)
// version > 17 host currentMode = 2 device currentMode = 1
var
usbPortList
=
usb
.
getPorts
()
gDeviceList
=
usb
.
getDevices
();
if
(
usbPortList
.
length
>
0
)
{
if
(
usbPortList
[
0
].
status
.
currentMode
==
1
)
{
usb
.
setPortRoles
(
usbPortList
[
0
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
then
(
data
=>
{
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
});
console
.
log
(
'
*************Usb Unit switch to host Begin*************
'
);
if
(
gDeviceList
.
length
>
0
)
{
if
(
usbPortList
[
0
].
status
.
currentMode
==
1
)
{
usb
.
setPortRoles
(
usbPortList
[
0
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
then
(
data
=>
{
portCurrentMode
=
2
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
});
console
.
log
(
'
*************Usb Unit switch to host Begin*************
'
);
}
}
else
{
portCurrentMode
=
1
}
}
gDeviceList
=
usb
.
getDevices
();
...
...
@@ -136,12 +144,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_
bulk_transfer_test_01
* @tc.number : SUB_USB_
JS_0630
* @tc.name : bulkTransfer
* @tc.desc : 批量传输 收数据
*/
it
(
'
SUB_USB_
bulk_transfer_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
bulk_transfer_test_01
begin
'
);
it
(
'
SUB_USB_
JS_0630
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0630
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
inEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -156,7 +164,7 @@ 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
bulk_transfer_test_01
: PASS
'
);
console
.
info
(
'
usb case
SUB_USB_JS_0630
: PASS
'
);
expect
(
data
>=
0
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb case readData error :
'
+
JSON
.
stringify
(
error
));
...
...
@@ -165,12 +173,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_
bulk_transfer_test_02
* @tc.number : SUB_USB_
JS_0640
* @tc.name : bulkTransfer
* @tc.desc : 批量传输 发数据
*/
it
(
'
SUB_USB_
bulk_transfer_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
bulk_transfer_test_02
begin
'
);
it
(
'
SUB_USB_
JS_0640
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0640
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -190,9 +198,9 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
tmpUint8Array
=
CheckEmptyUtils
.
str2ab
(
testParam
.
sendData
);
usb
.
bulkTransfer
(
testParam
.
pip
,
testParam
.
outEndpoint
,
tmpUint8Array
,
5000
).
then
(
data
=>
{
console
.
info
(
'
usb case
bulk_transfer_test_02
ret:
'
+
data
);
console
.
info
(
'
usb case
bulk_transfer_test_02
send data:
'
+
testParam
.
sendData
);
console
.
info
(
'
usb case
bulk_transfer_test_02
: PASS
'
);
console
.
info
(
'
usb case
SUB_USB_JS_0640
ret:
'
+
data
);
console
.
info
(
'
usb case
SUB_USB_JS_0640
send data:
'
+
testParam
.
sendData
);
console
.
info
(
'
usb case
SUB_USB_JS_0640
: PASS
'
);
expect
(
true
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb write error :
'
+
JSON
.
stringify
(
error
));
...
...
@@ -202,12 +210,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_
claim_interface_test_01
* @tc.number : SUB_USB_
JS_0420
* @tc.name : claimInterface
* @tc.desc : 获取接口 并释放
*/
it
(
'
SUB_USB_
claim_interface_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
claim_interface_test_01
begin
'
);
it
(
'
SUB_USB_
JS_0420
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0420
begin
'
);
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb 01 case get_device_list is null
'
)
expect
(
gDeviceList
.
length
).
assertEqual
(
-
1
);
...
...
@@ -242,7 +250,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
}
console
.
info
(
'
usb
claim_interface_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0420
: PASS
'
);
expect
(
true
).
assertTrue
();
})
...
...
@@ -263,12 +271,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_
set_configuration_test_01
* @tc.number : SUB_USB_
JS_0740
* @tc.name : setConfiguration
* @tc.desc : 设置设备接口
*/
it
(
'
SUB_USB_
set_configuration_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_configuration_test_01
begin
'
);
it
(
'
SUB_USB_
JS_0740
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0740
begin
'
);
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_device_list is null
'
)
expect
(
false
).
assertTrue
();
...
...
@@ -281,24 +289,24 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
configs
.
id
=
1
;
configs
.
name
=
''
;
configs
.
maxPower
=
1
;
configs
.
isRemoteWake
U
p
=
true
;
configs
.
isRemoteWake
u
p
=
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
set_configuration_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0740
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_configuration_test_02
* @tc.number : SUB_USB_
JS_0750
* @tc.name : setConfiguration
* @tc.desc : 反向测试 设置设备接口
*/
it
(
'
SUB_USB_
set_configuration_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_configuration_test_02
begin
'
);
it
(
'
SUB_USB_
JS_0750
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0750
begin
'
);
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_device_list is null
'
)
expect
(
false
).
assertTrue
();
...
...
@@ -313,16 +321,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
expect
(
ret
).
assertLess
(
0
);
}
console
.
info
(
'
usb
set_configuration_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0750
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
set_interface_test_01
* @tc.number : SUB_USB_
JS_0800
* @tc.name : setInterface
* @tc.desc : 设置设备接口
*/
it
(
'
SUB_USB_
set_interface_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_interface_test_01
begin
'
);
it
(
'
SUB_USB_
JS_0800
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0800
begin
'
);
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_device_list is null
'
)
expect
(
false
).
assertTrue
();
...
...
@@ -339,17 +347,17 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
}
console
.
info
(
'
usb
set_interface_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0800
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_interface_test_02
* @tc.number : SUB_USB_
JS_0810
* @tc.name : setInterface
* @tc.desc : 反向测试 设置设备接口
*/
it
(
'
SUB_USB_
set_interface_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_interface_test_02
begin
'
);
it
(
'
SUB_USB_
JS_0810
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0810
begin
'
);
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_device_list is null
'
)
expect
(
false
).
assertTrue
()
...
...
@@ -368,7 +376,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
}
console
.
info
(
'
usb
set_interface_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0810
: PASS
'
);
expect
(
true
).
assertTrue
();
})
...
...
@@ -386,12 +394,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_
control_transfer_test_01
* @tc.number : SUB_USB_
JS_0540
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetDescriptor: cmd 6 reqType 128 value 512 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_01
begin
'
);
it
(
'
SUB_USB_
JS_0540
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0540
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -401,16 +409,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
6
,
(
usb
.
USB_REQUEST_DIR_FROM_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_DEVICE
&
0x1f
),
(
2
<<
8
),
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_01
GetDescriptor
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0540
GetDescriptor
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_02
* @tc.number : SUB_USB_
JS_0550
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetStatus: cmd 0 reqType 128 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_02
begin
'
);
it
(
'
SUB_USB_
JS_0550
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0550
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -420,16 +428,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
0
,
(
usb
.
USB_REQUEST_DIR_FROM_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_DEVICE
&
0x1f
),
0
,
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_02
GetStatus
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0550
GetStatus
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_03
* @tc.number : SUB_USB_
JS_0560
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetConfiguration: cmd 8 reqType 128 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_03
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_03
begin
'
);
it
(
'
SUB_USB_
JS_0560
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0560
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -439,16 +447,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
8
,
(
usb
.
USB_REQUEST_DIR_FROM_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_DEVICE
&
0x1f
),
0
,
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_03
GetConfiguration
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0560
GetConfiguration
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_04
* @tc.number : SUB_USB_
JS_0570
* @tc.name : controlTransfer
* @tc.desc : 控制传输 GetInterface: cmd 10 reqType 129 value 0 index 1
*/
it
(
'
SUB_USB_
control_transfer_test_04
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_04
begin
'
);
it
(
'
SUB_USB_
JS_0570
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0570
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -458,16 +466,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
10
,
(
usb
.
USB_REQUEST_DIR_FROM_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_INTERFACE
&
0x1f
),
0
,
1
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_04
GetInterface
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0570
GetInterface
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_05
* @tc.number : SUB_USB_
JS_0580
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_05
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_05
begin
'
);
it
(
'
SUB_USB_
JS_0580
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0580
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -477,16 +485,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
1
,
(
usb
.
USB_REQUEST_DIR_TO_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_DEVICE
&
0x1f
),
0
,
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_05
ClearFeature
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0580
ClearFeature
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_06
* @tc.number : SUB_USB_
JS_0590
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_06
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_06
begin
'
);
it
(
'
SUB_USB_
JS_0590
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0590
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -496,16 +504,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
255
,
(
usb
.
USB_REQUEST_DIR_FROM_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_STANDARD
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_INTERFACE
&
0x1f
),
(
2
<<
8
),
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_06
ClearFeature
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0590
ClearFeature
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_07
* @tc.number : SUB_USB_
JS_0600
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_07
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_07
begin
'
);
it
(
'
SUB_USB_
JS_0600
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0600
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -515,16 +523,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
255
,
(
usb
.
USB_REQUEST_DIR_TO_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_CLASS
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_ENDPOINT
&
0x1f
),
(
2
<<
8
),
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_07
ClearFeature
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0600
ClearFeature
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_08
* @tc.number : SUB_USB_
JS_0610
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_08
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_08
begin
'
);
it
(
'
SUB_USB_
JS_0610
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0610
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -534,16 +542,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
255
,
(
usb
.
USB_REQUEST_DIR_TO_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_VENDOR
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_OTHER
&
0x1f
),
(
2
<<
8
),
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_08
ClearFeature
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0610
ClearFeature
'
)
})
/**
* @tc.number : SUB_USB_
control_transfer_test_09
* @tc.number : SUB_USB_
JS_0620
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0
*/
it
(
'
SUB_USB_
control_transfer_test_09
'
,
0
,
function
()
{
console
.
info
(
'
usb
control_transfer_test_09
begin
'
);
it
(
'
SUB_USB_
JS_0620
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0620
begin
'
);
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -553,7 +561,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
var
timeout
=
5000
;
var
controlParam
=
getTransferParam
(
255
,
(
usb
.
USB_REQUEST_DIR_TO_DEVICE
<<
7
)
|
(
usb
.
USB_REQUEST_TYPE_CLASS
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_OTHER
&
0x1f
),
0
,
0
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
control_transfer_test_09
ClearFeature
'
)
callControlTransfer
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_0620
ClearFeature
'
)
})
})
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunit.test.js
浏览文件 @
7bb609dc
...
...
@@ -48,12 +48,12 @@ describe('UsbFunctionsJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_
get_current_functions_test_01
* @tc.number : SUB_USB_
JS_0330
* @tc.name : getCurrentFunctions
* @tc.desc : 获取当前设备模式 掩码与描述字符转换
*/
it
(
'
SUB_USB_
get_current_functions_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_current_functions_test_01
begin
'
);
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
);
...
...
@@ -62,17 +62,17 @@ describe('UsbFunctionsJsFunctionsTest', function () {
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
maskCode
);
console
.
info
(
'
usb
get_current_functions_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0330
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
get_current_functions_test_02
* @tc.number : SUB_USB_
JS_0340
* @tc.name : usbFunctionString
* @tc.desc : 反向测试 获取当前设备模式 掩码与描述字符转换
*/
it
(
'
SUB_USB_
get_current_functions_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_current_functions_test_02
begin
'
);
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
);
...
...
@@ -92,7 +92,7 @@ describe('UsbFunctionsJsFunctionsTest', function () {
console
.
info
(
'
usb case errStrMaskCode
'
+
errStrMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
console
.
info
(
'
usb
get_current_functions_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0340
: PASS
'
);
})
function
callSetCurFunction
(
caseName
,
iValue
)
{
...
...
@@ -110,93 +110,93 @@ describe('UsbFunctionsJsFunctionsTest', function () {
}
/**
* @tc.number : SUB_USB_
set_current_functions_test_02
* @tc.number : SUB_USB_
JS_0350
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 1 设置为ACM功能
*/
it
(
'
SUB_USB_
set_current_functions_test_02
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0350
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_02
set ACM begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0350
set ACM begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_02
ACM 1
'
,
usb
.
ACM
)
callSetCurFunction
(
'
SUB_USB_JS_0350
ACM 1
'
,
usb
.
ACM
)
})
/**
* @tc.number : SUB_USB_
set_current_functions_test_03
* @tc.number : SUB_USB_
JS_0360
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能
*/
it
(
'
SUB_USB_
set_current_functions_test_03
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0360
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_03
set ECM begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0360
set ECM begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_03
ECM 2
'
,
usb
.
ECM
)
callSetCurFunction
(
'
SUB_USB_JS_0360
ECM 2
'
,
usb
.
ECM
)
})
/**
* @tc.number : SUB_USB_
set_current_functions_test_04
* @tc.number : SUB_USB_
JS_0370
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能
*/
it
(
'
SUB_USB_
set_current_functions_test_04
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0370
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_04
set ACM ECM begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0370
set ACM ECM begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_04
ACM ECM 3
'
,
(
usb
.
ACM
|
usb
.
ECM
))
callSetCurFunction
(
'
SUB_USB_JS_0370
ACM ECM 3
'
,
(
usb
.
ACM
|
usb
.
ECM
))
})
/**
* @tc.number : SUB_USB_
set_current_functions_test_05
* @tc.number : SUB_USB_
JS_0380
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 4 设置为HDC功能
*/
it
(
'
SUB_USB_
set_current_functions_test_05
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0380
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_05
set HDC begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0380
set HDC begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_05
HDC 4
'
,
usb
.
HDC
)
callSetCurFunction
(
'
SUB_USB_JS_0380
HDC 4
'
,
usb
.
HDC
)
})
/**
* @tc.number : SUB_USB_
set_current_functions_test_06
* @tc.number : SUB_USB_
JS_0390
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 5 设置为ACM、HDC功能
*/
it
(
'
SUB_USB_
set_current_functions_test_06
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0390
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_06
set ACM HDC begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0390
set ACM HDC begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_06
ACM HDC 5
'
,
(
usb
.
HDC
|
usb
.
ACM
))
callSetCurFunction
(
'
SUB_USB_JS_0390
ACM HDC 5
'
,
(
usb
.
HDC
|
usb
.
ACM
))
})
/**
* @tc.number : SUB_USB_
set_current_functions_test_07
* @tc.number : SUB_USB_
JS_0400
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 6 设置为ECM、HDC功能
*/
it
(
'
SUB_USB_
set_current_functions_test_07
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0400
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb
set_current_functions_test_07
set ECM HDC begin
'
);
console
.
info
(
'
usb
SUB_USB_JS_0400
set ECM HDC begin
'
);
var
maskCode
=
usb
.
getCurrentFunctions
();
console
.
info
(
'
usb case getCurrentFunctions return:
'
+
maskCode
);
var
funcString
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case funcString:
'
+
funcString
);
callSetCurFunction
(
'
set_current_functions_test_07
ECM HDC 6
'
,
(
usb
.
HDC
|
usb
.
ECM
))
callSetCurFunction
(
'
SUB_USB_JS_0400
ECM HDC 6
'
,
(
usb
.
HDC
|
usb
.
ECM
))
})
})
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunitEx.test.js
浏览文件 @
7bb609dc
...
...
@@ -50,206 +50,206 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_01
* @tc.number : SUB_USB_
JS_0930
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 0 返回 'none'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_01
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0930
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_02
* @tc.number : SUB_USB_
JS_0940
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 1 返回 'acm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0940
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_03
* @tc.number : SUB_USB_
JS_0950
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 2 返回 'ecm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_03
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0950
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_04
* @tc.number : SUB_USB_
JS_0960
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 3 返回 'acm,ecm'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_04
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_02
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0960
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_05
* @tc.number : SUB_USB_
JS_0970
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 4 返回 'hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_05
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_05
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_05
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0970
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_06
* @tc.number : SUB_USB_
JS_0980
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 5 返回 'acm,hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_06
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_06
begin
'
);
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
(
'
hdc,acm
'
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
console
.
info
(
'
usb
usb_function_to_string_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0980
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_to_string_test_07
* @tc.number : SUB_USB_
JS_0990
* @tc.name : usbFunctionsToString
* @tc.desc : 正向测试 6 返回 'ecm,hdc'
*/
it
(
'
SUB_USB_
usb_function_to_string_test_07
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_to_string_test_07
begin
'
);
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
(
'
hdc,ecm
'
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
console
.
info
(
'
usb
usb_function_to_string_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0990
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_01
* @tc.number : SUB_USB_
JS_0860
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'none' 返回 0
*/
it
(
'
SUB_USB_
usb_function_from_string_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_01
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_to_string_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0860
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_02
* @tc.number : SUB_USB_
JS_0870
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm' 返回 1
*/
it
(
'
SUB_USB_
usb_function_from_string_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_02
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0870
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_03
* @tc.number : SUB_USB_
JS_0880
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm' 返回 2
*/
it
(
'
SUB_USB_
usb_function_from_string_test_03
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_03
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_03
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0880
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_04
* @tc.number : SUB_USB_
JS_0890
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,ecm' 返回 3
*/
it
(
'
SUB_USB_
usb_function_from_string_test_04
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_04
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0890
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_05
* @tc.number : SUB_USB_
JS_0900
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'hdc' 返回 4
*/
it
(
'
SUB_USB_
usb_function_from_string_test_05
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_05
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0900
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_06
* @tc.number : SUB_USB_
JS_0910
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'acm,hdc' 返回 5
*/
it
(
'
SUB_USB_
usb_function_from_string_test_06
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_06
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0910
: PASS
'
);
})
/**
* @tc.number : SUB_USB_
usb_function_from_string_test_07
* @tc.number : SUB_USB_
JS_0920
* @tc.name : usbFunctionsFromString
* @tc.desc : 正向测试 'ecm,hdc' 返回 6
*/
it
(
'
SUB_USB_
usb_function_from_string_test_07
'
,
0
,
function
()
{
console
.
info
(
'
usb
usb_function_from_string_test_07
begin
'
);
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
);
console
.
info
(
'
usb
usb_function_from_string_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0920
: PASS
'
);
})
})
usb/usb_standard/src/main/js/default/test/UsbPortJsunit.test.js
浏览文件 @
7bb609dc
...
...
@@ -36,33 +36,33 @@ describe('UsbPortJsFunctionsTest', function () {
})
/**
* @tc.number : SUB_USB_
get_ports_test_01
* @tc.number : SUB_USB_
JS_0410
* @tc.name : getPorts
* @tc.desc : 获取USB端口描述信息列表
*/
it
(
'
SUB_USB_
get_ports_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_ports_test_01
begin
'
);
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
get_ports_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0410
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
expect
(
usbPortList
.
length
>
0
).
assertTrue
();
console
.
info
(
'
usb
get_ports_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0410
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
get_supported_modes_test_01
* @tc.number : SUB_USB_
JS_0220
* @tc.name : getSupportedModes
* @tc.desc : 获取指定的端口支持的模式列表的组合掩码
*/
it
(
'
SUB_USB_
get_supported_modes_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_supported_modes_test_01
begin
'
);
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
get_supported_modes_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0220
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -73,20 +73,20 @@ describe('UsbPortJsFunctionsTest', function () {
expect
(
maskCode
).
assertEqual
(
usbPortList
[
i
].
supportedModes
);
}
console
.
info
(
'
usb
get_supported_modes_test_01
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0220
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_01
* @tc.number : SUB_USB_
JS_0010
* @tc.name : setPortRoles
* @tc.desc : 切换为Device set powerRole 2 DataRole 2
*/
it
(
'
SUB_USB_
set_port_roles_test_01
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_port_roles_test_01
device 2 2 begin
'
);
it
(
'
SUB_USB_
JS_0010
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0010
device 2 2 begin
'
);
var
usbPortList
=
usb
.
getPorts
()
if
(
usbPortList
.
length
==
0
)
{
console
.
info
(
'
usb
set_port_roles_test_01
device 2 2 usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0010
device 2 2 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -102,20 +102,20 @@ describe('UsbPortJsFunctionsTest', function () {
});
}
console
.
info
(
'
usb
set_port_roles_test_01
device 2 2: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0010
device 2 2: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_02
* @tc.number : SUB_USB_
JS_0020
* @tc.name : setPortRoles
* @tc.desc : 切换为host set powerRole 1 DataRole 1
*/
it
(
'
SUB_USB_
set_port_roles_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
set_port_roles_test_02
host 1 1 begin
'
);
it
(
'
SUB_USB_
JS_0020
'
,
0
,
function
()
{
console
.
info
(
'
usb
SUB_USB_JS_0020
host 1 1 begin
'
);
var
usbPortList
=
usb
.
getPorts
()
if
(
usbPortList
.
length
==
0
)
{
console
.
info
(
'
usb
set_port_roles_test_02
host 1 1 usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0020
host 1 1 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -132,7 +132,7 @@ describe('UsbPortJsFunctionsTest', function () {
});
}
console
.
info
(
'
usb
set_port_roles_test_02
host 1 1: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0020
host 1 1: PASS
'
);
expect
(
true
).
assertTrue
();
})
...
...
usb/usb_standard/src/main/js/default/test/UsbPortJsunitEx.test.js
浏览文件 @
7bb609dc
...
...
@@ -39,15 +39,15 @@ describe('UsbPortJsFunctionsTestEx', function () {
})
/**
* @tc.number : SUB_USB_
get_supported_modes_test_02
* @tc.number : SUB_USB_
JS_0230
* @tc.name : getSupportedModes
* @tc.desc : 反向测试 改变id 获取指定的端口支持的模式列表的组合掩码
*/
it
(
'
SUB_USB_
get_supported_modes_test_02
'
,
0
,
function
()
{
console
.
info
(
'
usb
get_supported_modes_test_02
begin
'
);
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
get_supported_modes_test_01
usbPortList is null
'
);
console
.
info
(
'
usb
SUB_USB_JS_0230
usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
...
...
@@ -58,16 +58,16 @@ describe('UsbPortJsFunctionsTestEx', function () {
var
maskCode
=
usb
.
getSupportedModes
(
portID
)
expect
(
maskCode
).
assertEqual
(
usb
.
NONE
);
console
.
info
(
'
usb
get_supported_modes_test_02
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0230
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_03
* @tc.number : SUB_USB_
JS_0030
* @tc.name : setPortRoles
* @tc.desc : dataRole参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_03
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0030
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
;
var
powerRole
=
usb
.
SINK
;
var
dataRole
=
usb
.
NONE
-
1
;
...
...
@@ -78,19 +78,19 @@ describe('UsbPortJsFunctionsTestEx', function () {
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_03
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0030
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_03
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0030
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_04
* @tc.number : SUB_USB_
JS_0040
* @tc.name : setPortRoles
* @tc.desc : portId,powerRole参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_04
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0040
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
;
var
powerRole
=
usb
.
NONE
-
1
;
var
dataRole
=
usb
.
DEVICE
;
...
...
@@ -101,19 +101,19 @@ describe('UsbPortJsFunctionsTestEx', function () {
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0040
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_04
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0040
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_05
* @tc.number : SUB_USB_
JS_0050
* @tc.name : setPortRoles
* @tc.desc : portId,dataRole参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_05
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0050
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
-
3
;
var
powerRole
=
usb
.
SINK
;
var
dataRole
=
usb
.
NONE
-
1
;
...
...
@@ -124,19 +124,19 @@ describe('UsbPortJsFunctionsTestEx', function () {
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_05
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0050
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_05
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0050
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_06
* @tc.number : SUB_USB_
JS_0060
* @tc.name : setPortRoles
* @tc.desc : powerRole,dataRole参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_06
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0060
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
;
var
powerRole
=
usb
.
NONE
-
1
;
var
dataRole
=
usb
.
NONE
-
1
;
...
...
@@ -147,43 +147,43 @@ describe('UsbPortJsFunctionsTestEx', function () {
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0060
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_06
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0060
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_07
* @tc.number : SUB_USB_
JS_0070
* @tc.name : setPortRoles
* @tc.desc : portId,portId,dataRole参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_07
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0070
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
-
1
;
var
dataRole
=
usb
.
NONE
-
1
;
var
powerRole
=
usb
.
NONE
-
1
;
CheckEmptyUtils
.
sleep
(
2000
)
usb
.
setPortRoles
(
portId
,
powerRole
,
dataRole
).
then
(
data
=>
{
console
.
info
(
'
usb case setPortRoles
07
return:
'
+
data
);
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
expect
(
data
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles
07
error :
'
+
error
);
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0070
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_07
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0070
: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_
set_port_roles_test_08
* @tc.number : SUB_USB_
JS_0080
* @tc.name : setPortRoles
* @tc.desc : portId参数错误
*/
it
(
'
SUB_USB_
set_port_roles_test_08
'
,
0
,
function
()
{
it
(
'
SUB_USB_
JS_0080
'
,
0
,
function
()
{
var
portId
=
gPort
.
id
-
1
;
var
powerRole
=
1
;
var
dataRole
=
1
;
...
...
@@ -194,10 +194,10 @@ describe('UsbPortJsFunctionsTestEx', function () {
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
error
).
assertFalse
();
console
.
info
(
'
usb
set_port_roles_test_08
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0080
: PASS
'
);
})
console
.
info
(
'
usb
set_port_roles_test_08
: PASS
'
);
console
.
info
(
'
usb
SUB_USB_JS_0080
: PASS
'
);
expect
(
true
).
assertTrue
();
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录