Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4c58eaf1
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,发现更多精彩内容 >>
未验证
提交
4c58eaf1
编写于
2月 23, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 23, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7637 【xts_acts】【master】USB JS用例新增|变更
Merge pull request !7637 from 李晓枫/usbJs_0218
上级
66bce73b
3ff4557d
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
354 addition
and
50 deletion
+354
-50
usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js
usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js
+1
-1
usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js
usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js
+3
-43
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
...usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
+30
-1
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
...b_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
+85
-2
usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js
usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js
+1
-1
usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js
...sb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js
+233
-1
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
+1
-1
未找到文件。
usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
@@ -650,46 +650,6 @@ describe('UsbCoreJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1220
* @tc.name: connectDevice
* @tc.desc: Negative test: open device, Unauthorized
*/
it
(
'
SUB_USB_JS_1220
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1220 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
if
(
gDeviceList
.
length
==
0
)
{
console
.
info
(
'
usb case get_device_list is null
'
)
expect
(
false
).
assertTrue
();
return
}
var
isRight
=
usb
.
hasRight
(
gDeviceList
[
0
].
name
);
if
(
isRight
)
{
var
remRight
=
usb
.
removeRight
(
gDeviceList
[
0
].
name
);
console
.
info
(
'
usb 1220 removeRight remRight:
'
+
remRight
);
}
try
{
var
maskCode
=
usb
.
connectDevice
(
gDeviceList
[
0
]);
console
.
info
(
'
usb 1220 case connectDevice return:
'
+
maskCode
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
usb 1220 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
14400001
);
console
.
info
(
'
usb SUB_USB_JS_1220 : PASS
'
);
}
usb
.
requestRight
(
gDeviceList
[
0
].
name
).
then
(
hasRight
=>
{
console
.
info
(
'
usb 1220 requestRight hasRight:
'
+
hasRight
);
expect
(
hasRight
).
assertTrue
();
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1220 requestRight error:
'
+
error
);
});
CheckEmptyUtils
.
sleep
(
5000
)
})
/**
* @tc.number: SUB_USB_JS_0720
* @tc.name: hasRight
...
...
@@ -713,7 +673,7 @@ describe('UsbCoreJsFunctionsTestEx', function () {
deviceName
=
deviceName
+
'
$#
'
var
hasRight
=
usb
.
hasRight
(
deviceName
)
console
.
info
(
'
usb has_right ret :
'
+
hasRight
);
expect
(
hasRight
).
assert
Fals
e
();
expect
(
hasRight
).
assert
Tru
e
();
}
console
.
info
(
'
usb SUB_USB_JS_0720 : PASS
'
);
})
...
...
@@ -741,7 +701,7 @@ describe('UsbCoreJsFunctionsTestEx', function () {
deviceName
=
deviceName
+
'
abcdg
'
var
hasRight
=
usb
.
hasRight
(
deviceName
)
console
.
info
(
'
usb hasRight ret :
'
+
hasRight
);
expect
(
hasRight
).
assert
Fals
e
();
expect
(
hasRight
).
assert
Tru
e
();
}
console
.
info
(
'
usb SUB_USB_JS_0730 : PASS
'
);
})
...
...
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
@@ -783,5 +783,34 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
console
.
info
(
'
usb SUB_USB_JS_1560 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1570
* @tc.name: controlTransfer
* @tc.desc: Negative test: control transfer, parameter timeout type error
*/
it
(
'
SUB_USB_JS_1570
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1570 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb 1570 case get_device port is device
'
)
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
inEndpoint
==
null
||
testParam
.
interface
==
null
||
testParam
.
outEndpoint
==
null
)
{
expect
(
false
).
assertTrue
();
return
}
var
timeout
=
"
invalid
"
;
var
controlParam
=
getTransferParam
(
255
,
usb
.
USB_REQUEST_TARGET_OTHER
,
(
usb
.
USB_REQUEST_DIR_TO_DEVICE
)
|
(
usb
.
USB_REQUEST_TYPE_CLASS
<<
5
)
|
(
usb
.
USB_REQUEST_TARGET_OTHER
&
0x1f
),
0
,
0
);
try
{
callControlTransferEx
(
testParam
.
pip
,
controlParam
,
timeout
,
'
SUB_USB_JS_1570 ClearFeature
'
);
}
catch
(
err
)
{
console
.
info
(
'
usb 1570 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1570 : PASS
'
);
}
})
})
}
usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
@@ -448,6 +448,89 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}
})
/**
* @tc.number: SUB_USB_JS_1500
* @tc.name: bulkTransfer
* @tc.desc: Negative test: bulk transfer, parameter Uint8Array type error
*/
it
(
'
SUB_USB_JS_1500
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1500 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
);
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
inEndpoint
==
null
)
{
console
.
info
(
'
usb case testParam_interface and testParam_inEndpoint is null
'
);
expect
(
false
).
assertTrue
();
return
}
testParam
.
isClaimed
=
usb
.
claimInterface
(
testParam
.
pip
,
testParam
.
interface
,
true
);
expect
(
testParam
.
isClaimed
).
assertEqual
(
0
);
console
.
info
(
'
usb case readData begin
'
);
var
tmpUint8Array
=
"
invalid
"
;
try
{
usb
.
bulkTransfer
(
testParam
.
pip
,
testParam
.
inEndpoint
,
tmpUint8Array
,
5000
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1500 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1500 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1500 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1500 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1500 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1500 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_1530
* @tc.name: bulkTransfer
* @tc.desc: Negative test: bulk transfer, parameter timeout type error
*/
it
(
'
SUB_USB_JS_1530
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1530 begin
'
);
if
(
portCurrentMode
==
1
)
{
console
.
info
(
'
usb case get_device port is device
'
);
expect
(
false
).
assertFalse
();
return
}
var
testParam
=
getTransferTestParam
()
if
(
testParam
.
interface
==
null
||
testParam
.
inEndpoint
==
null
)
{
console
.
info
(
'
usb case testParam_interface and testParam_inEndpoint is null
'
);
expect
(
false
).
assertTrue
();
return
}
testParam
.
isClaimed
=
usb
.
claimInterface
(
testParam
.
pip
,
testParam
.
interface
,
true
);
expect
(
testParam
.
isClaimed
).
assertEqual
(
0
);
console
.
info
(
'
usb case readData begin
'
);
var
tmpTimeOut
=
"
invalid
"
;
var
tmpUint8Array
=
new
Uint8Array
(
testParam
.
maxInSize
);
try
{
usb
.
bulkTransfer
(
testParam
.
pip
,
testParam
.
inEndpoint
,
tmpUint8Array
,
tmpTimeOut
).
then
(
data
=>
{
console
.
info
(
'
usb case SUB_USB_JS_1530 ret:
'
+
data
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1530 : FAILED
'
);
}).
catch
(
error
=>
{
console
.
info
(
'
usb 1530 write error :
'
+
JSON
.
stringify
(
error
));
expect
(
false
).
assertTrue
();
console
.
info
(
'
usb case SUB_USB_JS_1530 : FAILED
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
usb 1530 catch err code:
'
+
err
.
code
+
'
message:
'
+
err
.
message
);
expect
(
err
.
code
).
assertEqual
(
401
);
console
.
info
(
'
usb SUB_USB_JS_1530 : PASS
'
);
}
})
/**
* @tc.number: SUB_USB_JS_0430
* @tc.name: claimInterface
...
...
@@ -1608,7 +1691,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
/**
* @tc.number: SUB_USB_JS_1540
* @tc.name: setConfiguration
* @tc.desc: Negative test: Set Device Configuration, parameter
pipe
type error
* @tc.desc: Negative test: Set Device Configuration, parameter
config
type error
*/
it
(
'
SUB_USB_JS_1540
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1540 begin
'
);
...
...
usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (C) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (C) 2021-202
3
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
...
...
@@ -157,6 +157,126 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
console
.
info
(
'
usb SUB_USB_JS_0990 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1770
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 8, return 'mtp'
*/
it
(
'
SUB_USB_JS_1770
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1770 begin
'
);
var
maskCode
=
usb
.
MTP
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
mtp
'
);
console
.
info
(
'
usb SUB_USB_JS_1770 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1780
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 12, return 'hdc,mtp'
*/
it
(
'
SUB_USB_JS_1780
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1780 begin
'
);
var
maskCode
=
usb
.
MTP
|
usb
.
HDC
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
hdc,mtp
'
);
console
.
info
(
'
usb SUB_USB_JS_1780 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1790
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 16, return 'ptp'
*/
it
(
'
SUB_USB_JS_1790
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1790 begin
'
);
var
maskCode
=
usb
.
PTP
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
ptp
'
);
console
.
info
(
'
usb SUB_USB_JS_1790 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1800
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 20, return 'hdc,ptp'
*/
it
(
'
SUB_USB_JS_1800
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1800 begin
'
);
var
maskCode
=
usb
.
PTP
|
usb
.
HDC
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
hdc,ptp
'
);
console
.
info
(
'
usb SUB_USB_JS_1800 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1810
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 32, return 'rndis'
*/
it
(
'
SUB_USB_JS_1810
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1810 begin
'
);
var
maskCode
=
usb
.
RNDIS
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
rndis
'
);
console
.
info
(
'
usb SUB_USB_JS_1810 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1820
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 36, return 'hdc,rndis'
*/
it
(
'
SUB_USB_JS_1820
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1820 begin
'
);
var
maskCode
=
usb
.
RNDIS
|
usb
.
HDC
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
hdc,rndis
'
);
console
.
info
(
'
usb SUB_USB_JS_1820 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1830
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 512, return 'storage'
*/
it
(
'
SUB_USB_JS_1830
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1830 begin
'
);
var
maskCode
=
usb
.
STORAGE
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
storage
'
);
console
.
info
(
'
usb SUB_USB_JS_1830 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1840
* @tc.name: usbFunctionsToString
* @tc.desc: Positive test: input 516, return 'hdc,storage'
*/
it
(
'
SUB_USB_JS_1840
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1840 begin
'
);
var
maskCode
=
usb
.
STORAGE
|
usb
.
HDC
;
console
.
info
(
'
usb case maskCode :
'
+
maskCode
);
var
strMaskCode
=
usb
.
usbFunctionsToString
(
maskCode
);
console
.
info
(
'
usb case maskCode
'
+
maskCode
+
'
usbFunctionsToString return int:
'
+
strMaskCode
);
expect
(
strMaskCode
).
assertEqual
(
'
hdc,storage
'
);
console
.
info
(
'
usb SUB_USB_JS_1840 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1160
* @tc.name: usbFunctionsToString
...
...
@@ -292,6 +412,118 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
console
.
info
(
'
usb SUB_USB_JS_0920 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1220
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'mtp', return 8
*/
it
(
'
SUB_USB_JS_1220
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1220 begin
'
);
var
strMaskCode
=
'
mtp
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
MTP
);
console
.
info
(
'
usb SUB_USB_JS_1220 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1700
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'hdc,mtp', return 12
*/
it
(
'
SUB_USB_JS_1700
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1700 begin
'
);
var
strMaskCode
=
'
hdc,mtp
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
MTP
|
usb
.
HDC
);
console
.
info
(
'
usb SUB_USB_JS_1700 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1710
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'ptp', return 16
*/
it
(
'
SUB_USB_JS_1710
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1710 begin
'
);
var
strMaskCode
=
'
ptp
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
PTP
);
console
.
info
(
'
usb SUB_USB_JS_1710 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1720
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'hdc,ptp', return 20
*/
it
(
'
SUB_USB_JS_1720
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1720 begin
'
);
var
strMaskCode
=
'
hdc,ptp
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
PTP
|
usb
.
HDC
);
console
.
info
(
'
usb SUB_USB_JS_1720 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1730
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'rndis', return 32
*/
it
(
'
SUB_USB_JS_1730
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1730 begin
'
);
var
strMaskCode
=
'
rndis
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
RNDIS
);
console
.
info
(
'
usb SUB_USB_JS_1730 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1740
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'hdc,rndis', return 36
*/
it
(
'
SUB_USB_JS_1740
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1740 begin
'
);
var
strMaskCode
=
'
hdc,rndis
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
RNDIS
|
usb
.
HDC
);
console
.
info
(
'
usb SUB_USB_JS_1740 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1750
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'storage', return 512
*/
it
(
'
SUB_USB_JS_1750
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1750 begin
'
);
var
strMaskCode
=
'
storage
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
STORAGE
);
console
.
info
(
'
usb SUB_USB_JS_1750 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1760
* @tc.name: usbFunctionsFromString
* @tc.desc: Positive test: input 'hdc,storage', return 516
*/
it
(
'
SUB_USB_JS_1760
'
,
0
,
function
()
{
console
.
info
(
'
usb SUB_USB_JS_1760 begin
'
);
var
strMaskCode
=
'
hdc,storage
'
var
nMaskCode
=
usb
.
usbFunctionsFromString
(
strMaskCode
)
console
.
info
(
'
usb case strMaskCode
'
+
strMaskCode
+
'
usbFunctionsFromString return int:
'
+
nMaskCode
);
expect
(
nMaskCode
).
assertEqual
(
usb
.
STORAGE
|
usb
.
HDC
);
console
.
info
(
'
usb SUB_USB_JS_1760 : PASS
'
);
})
/**
* @tc.number: SUB_USB_JS_1170
* @tc.name: usbFunctionsFromString
...
...
usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js
浏览文件 @
4c58eaf1
/*
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录