Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8d0ad321
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看板
未验证
提交
8d0ad321
编写于
7月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4290 【xts_acts】【OpenHarmony-3.2-Beta2】ActsUsbJSApiTest测试套用例修改,新增UsbPortAndFunctionJsunit.test.js文件
Merge pull request !4290 from 李晓枫/lxfOHBeta2_0713
上级
cf85ca94
af6f2837
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
214 addition
and
163 deletion
+214
-163
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
+1
-0
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunit.test.js
...ndard/src/main/js/default/test/UsbFunctionsJsunit.test.js
+0
-104
usb/usb_standard/src/main/js/default/test/UsbPortAndFunctionJsunit.test.js
...src/main/js/default/test/UsbPortAndFunctionJsunit.test.js
+213
-0
usb/usb_standard/src/main/js/default/test/UsbPortJsunit.test.js
...b_standard/src/main/js/default/test/UsbPortJsunit.test.js
+0
-59
未找到文件。
usb/usb_standard/src/main/js/default/test/ListUsb.test.js
浏览文件 @
8d0ad321
...
...
@@ -27,5 +27,6 @@ require('./UsbFunctionsJsunitEx.test.js')
/* device and host test case */
require
(
'
./UsbPortJsunit.test.js
'
)
require
(
'
./UsbPortJsunitEx.test.js
'
)
// require('./UsbPortAndFunctionJsunit.test.js')
require
(
'
./UsbAutoJsunit.test.js
'
)
usb/usb_standard/src/main/js/default/test/UsbFunctionsJsunit.test.js
浏览文件 @
8d0ad321
...
...
@@ -95,108 +95,4 @@ describe('UsbFunctionsJsFunctionsTest', function () {
console
.
info
(
'
usb SUB_USB_JS_0340 : PASS
'
);
})
function
callSetCurFunction
(
caseName
,
iValue
)
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb case param case name:
'
+
caseName
);
console
.
info
(
'
usb case param iValue:
'
+
iValue
);
usb
.
setCurrentFunctions
(
iValue
).
then
(
data
=>
{
console
.
info
(
'
usb case SetCurFunction ret:
'
+
data
);
expect
(
data
).
assertTrue
();
console
.
info
(
'
usb case
'
+
caseName
+
'
: PASS
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case
'
+
caseName
+
'
error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
/**
* @tc.number : SUB_USB_JS_0350
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 1 设置为ACM功能
*/
it
(
'
SUB_USB_JS_0350
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0350 ACM 1
'
,
usb
.
ACM
)
})
/**
* @tc.number : SUB_USB_JS_0360
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能
*/
it
(
'
SUB_USB_JS_0360
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0360 ECM 2
'
,
usb
.
ECM
)
})
/**
* @tc.number : SUB_USB_JS_0370
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能
*/
it
(
'
SUB_USB_JS_0370
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0370 ACM ECM 3
'
,
(
usb
.
ACM
|
usb
.
ECM
))
})
/**
* @tc.number : SUB_USB_JS_0380
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 4 设置为HDC功能
*/
it
(
'
SUB_USB_JS_0380
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0380 HDC 4
'
,
usb
.
HDC
)
})
/**
* @tc.number : SUB_USB_JS_0390
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 5 设置为ACM、HDC功能
*/
it
(
'
SUB_USB_JS_0390
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0390 ACM HDC 5
'
,
(
usb
.
HDC
|
usb
.
ACM
))
})
/**
* @tc.number : SUB_USB_JS_0400
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 6 设置为ECM、HDC功能
*/
it
(
'
SUB_USB_JS_0400
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0400 ECM HDC 6
'
,
(
usb
.
HDC
|
usb
.
ECM
))
})
})
usb/usb_standard/src/main/js/default/test/UsbPortAndFunctionJsunit.test.js
0 → 100644
浏览文件 @
8d0ad321
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
usb
from
'
@ohos.usb
'
;
import
CheckEmptyUtils
from
'
./CheckEmptyUtils.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
/* usb core functions test */
describe
(
'
UsbPortAndFunctionsJsFunctionsTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
log
(
'
*************Usb Unit UsbPortAndFunctionsJsFunctionsTest Begin*************
'
);
var
Version
=
usb
.
getVersion
()
console
.
info
(
'
begin test getversion :
'
+
Version
)
// version > 17 host currentMode = 2 device currentMode = 1
var
usbPortList
=
usb
.
getPorts
()
if
(
usbPortList
.
length
>
0
)
{
if
(
usbPortList
[
0
].
status
.
currentMode
==
2
)
{
usb
.
setPortRoles
(
usbPortList
[
0
].
id
,
usb
.
SINK
,
usb
.
DEVICE
).
then
(
data
=>
{
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
});
console
.
log
(
'
*************Usb Unit switch to device Begin*************
'
);
}
}
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach: *************Usb Unit Test Case*************
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach: *************Usb Unit Test Case*************
'
);
})
afterAll
(
function
()
{
console
.
log
(
'
*************Usb Unit UsbPortAndFunctionsJsFunctionsTest End*************
'
);
})
function
callSetCurFunction
(
caseName
,
iValue
)
{
CheckEmptyUtils
.
sleep
(
3000
)
console
.
info
(
'
usb case param case name:
'
+
caseName
);
console
.
info
(
'
usb case param iValue:
'
+
iValue
);
usb
.
setCurrentFunctions
(
iValue
).
then
(
data
=>
{
console
.
info
(
'
usb case SetCurFunction ret:
'
+
data
);
expect
(
data
).
assertTrue
();
console
.
info
(
'
usb case
'
+
caseName
+
'
: PASS
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case
'
+
caseName
+
'
error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
/**
* @tc.number : SUB_USB_JS_0350
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 1 设置为ACM功能
*/
it
(
'
SUB_USB_JS_0350
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0350 ACM 1
'
,
usb
.
ACM
)
})
// /**
// * @tc.number : SUB_USB_JS_0360
// * @tc.name : functions_test
// * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 2 设置为ECM功能
// */
it
(
'
SUB_USB_JS_0360
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0360 ECM 2
'
,
usb
.
ECM
)
})
// /**
// * @tc.number : SUB_USB_JS_0370
// * @tc.name : functions_test
// * @tc.desc : 在设备模式下设置当前的USB功能列表 Set 3 设置为ACM、ECM功能
// */
it
(
'
SUB_USB_JS_0370
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0370 ACM ECM 3
'
,
(
usb
.
ACM
|
usb
.
ECM
))
})
/**
* @tc.number : SUB_USB_JS_0380
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 4 设置为HDC功能
*/
it
(
'
SUB_USB_JS_0380
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0380 HDC 4
'
,
usb
.
HDC
)
})
/**
* @tc.number : SUB_USB_JS_0390
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 5 设置为ACM、HDC功能
*/
it
(
'
SUB_USB_JS_0390
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0390 ACM HDC 5
'
,
(
usb
.
HDC
|
usb
.
ACM
))
})
/**
* @tc.number : SUB_USB_JS_0400
* @tc.name : functions_test
* @tc.desc : 在设备模式下设置当前的USB功能列表 Set 6 设置为ECM、HDC功能
*/
it
(
'
SUB_USB_JS_0400
'
,
0
,
function
()
{
CheckEmptyUtils
.
sleep
(
3000
)
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
(
'
SUB_USB_JS_0400 ECM HDC 6
'
,
(
usb
.
HDC
|
usb
.
ECM
))
})
/**
* @tc.number : SUB_USB_JS_0010
* @tc.name : setPortRoles
* @tc.desc : 切换为Device set powerRole 2 DataRole 2
*/
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 SUB_USB_JS_0010 device 2 2 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
for
(
var
i
=
0
;
i
<
usbPortList
.
length
;
i
++
)
{
console
.
info
(
'
usb case set data role 2, data role 2
'
);
usb
.
setPortRoles
(
usbPortList
[
i
].
id
,
usb
.
SINK
,
usb
.
DEVICE
).
then
(
data
=>
{
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
expect
(
data
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
console
.
info
(
'
usb SUB_USB_JS_0010 device 2 2: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_JS_0020
* @tc.name : setPortRoles
* @tc.desc : 切换为host set powerRole 1 DataRole 1
*/
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 SUB_USB_JS_0020 host 1 1 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
for
(
var
i
=
0
;
i
<
usbPortList
.
length
;
i
++
)
{
console
.
info
(
'
usb case set data role 1, data role 1
'
);
CheckEmptyUtils
.
sleep
(
5000
)
usb
.
setPortRoles
(
usbPortList
[
i
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
then
(
data
=>
{
expect
(
data
).
assertTrue
();
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
console
.
info
(
'
usb SUB_USB_JS_0020 host 1 1: PASS
'
);
expect
(
true
).
assertTrue
();
})
})
usb/usb_standard/src/main/js/default/test/UsbPortJsunit.test.js
浏览文件 @
8d0ad321
...
...
@@ -77,63 +77,4 @@ describe('UsbPortJsFunctionsTest', function () {
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_JS_0010
* @tc.name : setPortRoles
* @tc.desc : 切换为Device set powerRole 2 DataRole 2
*/
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 SUB_USB_JS_0010 device 2 2 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
for
(
var
i
=
0
;
i
<
usbPortList
.
length
;
i
++
)
{
console
.
info
(
'
usb case set data role 2, data role 2
'
);
usb
.
setPortRoles
(
usbPortList
[
i
].
id
,
usb
.
SINK
,
usb
.
DEVICE
).
then
(
data
=>
{
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
expect
(
data
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
console
.
info
(
'
usb SUB_USB_JS_0010 device 2 2: PASS
'
);
expect
(
true
).
assertTrue
();
})
/**
* @tc.number : SUB_USB_JS_0020
* @tc.name : setPortRoles
* @tc.desc : 切换为host set powerRole 1 DataRole 1
*/
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 SUB_USB_JS_0020 host 1 1 usbPortList is null
'
);
expect
(
false
).
assertTrue
();
return
}
for
(
var
i
=
0
;
i
<
usbPortList
.
length
;
i
++
)
{
console
.
info
(
'
usb case set data role 1, data role 1
'
);
CheckEmptyUtils
.
sleep
(
5000
)
usb
.
setPortRoles
(
usbPortList
[
i
].
id
,
usb
.
SOURCE
,
usb
.
HOST
).
then
(
data
=>
{
expect
(
data
).
assertTrue
();
console
.
info
(
'
usb case setPortRoles return:
'
+
data
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb case setPortRoles error :
'
+
error
);
expect
(
false
).
assertTrue
();
});
}
console
.
info
(
'
usb SUB_USB_JS_0020 host 1 1: PASS
'
);
expect
(
true
).
assertTrue
();
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录