Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0d7698e9
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看板
提交
0d7698e9
编写于
10月 30, 2022
作者:
Q
quanli
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
870839b2
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
1175 addition
and
581 deletion
+1175
-581
communication/nfc_Controller/src/main/js/test/List.test.js
communication/nfc_Controller/src/main/js/test/List.test.js
+2
-0
communication/nfc_Controller/src/main/js/test/nfc.ATagSession.js
...cation/nfc_Controller/src/main/js/test/nfc.ATagSession.js
+15
-15
communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
...nication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
+31
-6
communication/nfc_Controller/src/main/js/test/nfc.MifareClassicTag.js
...n/nfc_Controller/src/main/js/test/nfc.MifareClassicTag.js
+44
-50
communication/nfc_Controller/src/main/js/test/nfc.MifareUltralightTag.js
...fc_Controller/src/main/js/test/nfc.MifareUltralightTag.js
+22
-86
communication/nfc_Controller/src/main/js/test/nfc.NDEFTag.js
communication/nfc_Controller/src/main/js/test/nfc.NDEFTag.js
+800
-0
communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js
communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js
+247
-418
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
+1
-0
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
...ication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
+4
-3
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
...fi_standard/src/main/js/test/WifiCandidateNetWork.test.js
+1
-0
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
...n/wifi_standard/src/main/js/test/WifiStationEvent.test.js
+2
-0
communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js
...fi_standard/src/main/js/test/WifiStationFunctions.test.js
+4
-2
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
...on_standard/src/main/js/default/test/GeocoderTest.test.js
+2
-1
未找到文件。
communication/nfc_Controller/src/main/js/test/List.test.js
浏览文件 @
0d7698e9
...
...
@@ -19,6 +19,7 @@ import nfcIsoDepTagTest from './nfc.IsoDepTag.js'
import
nfcMifareClassicTag
from
'
./nfc.MifareClassicTag.js
'
import
nfcMifareUltralightTag
from
'
./nfc.MifareUltralightTag.js
'
import
nfcTagABFVTest
from
'
./nfc.TagABFV.js
'
import
nfcNDEFTagTest
from
'
./nfc.NDEFTag.js
'
import
parameter
from
'
@ohos.systemparameter
'
;
let
info
=
parameter
.
getSync
(
"
const.SystemCapability.Communication.NFC.Core
"
,
"
false
"
);
export
default
function
testsuite
()
{
...
...
@@ -30,6 +31,7 @@ if (info != "false")
nfcMifareClassicTag
();
nfcMifareUltralightTag
();
nfcTagABFVTest
();
nfcNDEFTagTest
();
}
}
communication/nfc_Controller/src/main/js/test/nfc.ATagSession.js
浏览文件 @
0d7698e9
...
...
@@ -58,7 +58,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
001
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
100
'
,
0
,
function
()
{
let
NfcConnected
;
try
{
NfcConnected
=
tag
.
getNfcATag
(
aTag
).
connectTag
();
...
...
@@ -70,7 +70,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
002
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
200
* @tc.name testreset
* @tc.desc Test reset api.
* @tc.size MEDIUM
...
...
@@ -78,7 +78,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
002
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
200
'
,
0
,
function
()
{
try
{
tag
.
getNfcATag
(
aTag
).
reset
();
expect
(
true
).
assertTrue
();
...
...
@@ -89,7 +89,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
003
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
300
* @tc.name testisTagConnected
* @tc.desc Test isTagConnected api by callback.
* @tc.size MEDIUM
...
...
@@ -97,7 +97,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
003
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
300
'
,
0
,
function
()
{
let
isNfcConnected
;
try
{
isNfcConnected
=
tag
.
getNfcATag
(
aTag
).
isTagConnected
();
...
...
@@ -109,7 +109,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
004
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
400
* @tc.name testgetMaxSendLength
* @tc.desc Test getMaxSendLength api.
* @tc.size MEDIUM
...
...
@@ -117,7 +117,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
004
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
400
'
,
0
,
function
()
{
let
mazSendLen
;
try
{
mazSendLen
=
tag
.
getNfcATag
(
aTag
).
getMaxSendLength
();
...
...
@@ -130,7 +130,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
005
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
500
* @tc.name testsetSendDataTimeout
* @tc.desc Test setSendDataTimeout api.
* @tc.size MEDIUM
...
...
@@ -138,7 +138,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
005
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
500
'
,
0
,
function
()
{
let
settime
;
try
{
settime
=
tag
.
getNfcATag
(
aTag
).
setSendDataTimeout
(
1000
);
...
...
@@ -150,7 +150,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
006
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
600
* @tc.name testgetSendDataTimeout
* @tc.desc Test getSendDataTimeout api.
* @tc.size MEDIUM
...
...
@@ -158,7 +158,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
006
'
,
0
,
function
()
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
600
'
,
0
,
function
()
{
let
gettime
;
try
{
gettime
=
tag
.
getNfcATag
(
aTag
).
getSendDataTimeout
();
...
...
@@ -171,7 +171,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
007
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
700
* @tc.name testsendData
* @tc.desc Test sendData api by peomise.
* @tc.size MEDIUM
...
...
@@ -179,7 +179,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
007
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
700
'
,
0
,
async
function
(
done
)
{
let
sendDatas
=
[
0x01
,
0x02
,
0x03
,
0x04
];
await
tag
.
getNfcATag
(
aTag
).
sendData
(
sendDatas
).
then
((
data
)
=>
{
console
.
log
(
"
nfcAtage sendData1 data:
"
+
data
+
"
json1:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -192,7 +192,7 @@ export default function nfcATagSessionTest() {
})
/**
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
008
* @tc.number SUB_Communication_NFC_nfcAtage_js_0
800
* @tc.name testsendData
* @tc.desc Test sendData api by callback.
* @tc.size MEDIUM
...
...
@@ -200,7 +200,7 @@ export default function nfcATagSessionTest() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
008
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_NFC_nfcAtage_js_0
800
'
,
0
,
async
function
(
done
)
{
let
sendDatas
=
[
0x01
,
0x02
,
0x03
,
0x04
];
tag
.
getNfcATag
(
aTag
).
sendData
(
sendDatas
,
(
err
,
data
)
=>
{
if
(
err
)
{
...
...
communication/nfc_Controller/src/main/js/test/nfc.IsoDepTag.js
浏览文件 @
0d7698e9
...
...
@@ -44,6 +44,12 @@ let NfcForumType = {
MIFARE_CLASSIC
:
101
,
};
let
FeatureType
=
{
HCE
:
0
,
UICC
:
0
,
ESE
:
0
,
}
let
isoDepTaginfo
=
{
"
uid
"
:
[
0x01
,
0x02
,
0x03
,
0x04
],
"
technology
"
:
[
1
,
3
],
...
...
@@ -57,13 +63,13 @@ let isoDepTaginfo = {
],
"
tagRfDiscId
"
:
1
,
};
let
isoDep
;
let
IsoDepTag
;
export
default
function
nfcIsoDepTagTest
()
{
describe
(
'
nfcIsoDepTagTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
[NFC_test]beforeAll called
'
)
try
{
isoDep
=
tag
.
getIsoDep
(
isoDepTaginfo
);
IsoDepTag
=
tag
.
getIsoDep
(
isoDepTaginfo
);
}
catch
(
error
){
console
.
info
(
'
getIsoDep is ->
'
+
error
)
}
...
...
@@ -87,7 +93,7 @@ export default function nfcIsoDepTagTest() {
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcIsoDep_js_0100
'
,
0
,
function
()
{
let
ResponseFlags
=
isoDep
.
getHistoricalBytes
();
let
ResponseFlags
=
IsoDepTag
.
getHistoricalBytes
();
expect
(
ResponseFlags
).
assertInstanceOf
(
'
Array
'
)
console
.
info
(
'
[nfc_js] test ResponseFlags data>:
'
+
ResponseFlags
);
})
...
...
@@ -101,7 +107,7 @@ export default function nfcIsoDepTagTest() {
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcIsoDep_js_0200
'
,
0
,
function
()
{
let
HiLayerResponse
=
isoDep
.
getHiLayerResponse
();
let
HiLayerResponse
=
IsoDepTag
.
getHiLayerResponse
();
expect
(
HiLayerResponse
).
assertInstanceOf
(
'
Array
'
)
console
.
info
(
'
[nfc_js] test ResponseFlags data>:
'
+
HiLayerResponse
);
})
...
...
@@ -115,7 +121,7 @@ export default function nfcIsoDepTagTest() {
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcIsoDep_js_0300
'
,
0
,
async
function
(
done
)
{
await
isoDep
.
isExtendedApduSupported
().
then
((
data
)
=>
{
await
IsoDepTag
.
isExtendedApduSupported
().
then
((
data
)
=>
{
expect
(
false
).
assertEqual
(
data
);
console
.
info
(
"
isoDep isExtendedApduSupported data:
"
+
data
);
done
();
...
...
@@ -135,7 +141,7 @@ export default function nfcIsoDepTagTest() {
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfcIsoDep_js_0400
'
,
0
,
async
function
(
done
)
{
isoDep
.
isExtendedApduSupported
((
err
,
data
)
=>
{
IsoDepTag
.
isExtendedApduSupported
((
err
,
data
)
=>
{
if
(
err
)
{
expect
().
assertFail
();
console
.
info
(
"
isoDep isExtendedApduSupported err:
"
+
err
);
...
...
@@ -147,6 +153,25 @@ export default function nfcIsoDepTagTest() {
done
();
})
/**
* @tc.number SUB_Communication_NFC_nfccardEmulationnfc_js_0500
* @tc.name Test cardEmulationnfc
* @tc.desc Whether to support a certain type of card emulation.
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_nfccardEmulationnfc_js_0500
'
,
0
,
function
()
{
let
cardEmulationnfc
;
try
{
cardEmulationnfc
=
cardEmulation
.
isSupported
(
FeatureType
.
ESE
);
console
.
info
(
'
cardEmulationnfc type ->
'
+
cardEmulationnfc
)
expect
(
cardEmulationnfc
).
assertFalse
();
}
catch
(
error
){
console
.
info
(
'
cardEmulationnfc error
'
+
error
)
}
})
console
.
info
(
"
*************[nfc_test] start nfc js unit test end*************
"
);
})
}
...
...
communication/nfc_Controller/src/main/js/test/nfc.MifareClassicTag.js
浏览文件 @
0d7698e9
...
...
@@ -51,13 +51,13 @@ let mifareclassicTaginfo = {
],
"
tagRfDiscId
"
:
1
,
};
let
mifareClassic
=
null
;
let
MifareClassicTag
=
null
;
export
default
function
nfcMifareClassicTag
()
{
describe
(
'
nfcMifareClassicTag
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
[NFC_test]beforeAll called
'
)
try
{
mifareClassic
=
tag
.
getMifareClassic
(
mifareclassicTaginfo
);
MifareClassicTag
=
tag
.
getMifareClassic
(
mifareclassicTaginfo
);
}
catch
(
error
){
console
.
info
(
'
beforeAll mifareClassic error
'
+
error
)
}
...
...
@@ -79,14 +79,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testauthenticateSector
* @tc.desc Test authenticateSector api by callback.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0100
'
,
0
,
async
function
(
done
)
{
let
sectorIndex
=
1
;
let
key
=
[
0x04
,
0x05
];
await
mifareClassic
.
authenticateSector
(
sectorIndex
,
key
,
true
).
then
((
data
)
=>
{
await
MifareClassicTag
.
authenticateSector
(
sectorIndex
,
key
,
true
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic authenticateSector1 data:
"
+
data
+
"
json1:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertTrue
();
done
();
...
...
@@ -104,14 +104,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testauthenticateSector
* @tc.desc Test authenticateSector api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0200
'
,
0
,
async
function
(
done
)
{
let
sectorIndex
=
1
;
let
key
=
[
0x04
,
0x05
];
mifareClassic
.
authenticateSector
(
sectorIndex
,
key
,
true
,
(
err
,
data
)
=>
{
MifareClassicTag
.
authenticateSector
(
sectorIndex
,
key
,
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic authenticateSector2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -130,19 +130,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testreadSingleBlock
* @tc.desc Test readSingleBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0300
'
,
0
,
async
function
(
done
)
{
let
mifareClassic
;
try
{
mifareClassic
=
tag
.
getMifareClassic
(
mifareclassicTaginfo
);
}
catch
(
error
){
console
.
info
(
'
beforeAll mifareClassic error
'
+
error
)
}
let
blockIndex
=
1
;
await
mifareClassic
.
readSingleBlock
(
blockIndex
).
then
((
data
)
=>
{
await
MifareClassicTag
.
readSingleBlock
(
blockIndex
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic readSingleBlock1 data:
"
+
data
+
"
json3:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertInstanceOf
(
'
Array
'
)
done
();
...
...
@@ -160,13 +154,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testreadSingleBlock
* @tc.desc Test readSingleBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0400
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
mifareClassic
.
readSingleBlock
(
blockIndex
,
(
err
,
data
)
=>
{
MifareClassicTag
.
readSingleBlock
(
blockIndex
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic readSingleBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -184,14 +178,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testwriteSingleBlock
* @tc.desc Test writeSingleBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0500
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
rawData
=
[
0x0a
,
0x14
];
await
mifareClassic
.
writeSingleBlock
(
blockIndex
,
rawData
).
then
((
data
)
=>
{
await
MifareClassicTag
.
writeSingleBlock
(
blockIndex
,
rawData
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic writeSingleBlock1 data:
"
+
data
+
"
json5:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertTrue
();
done
();
...
...
@@ -209,14 +203,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testwriteSingleBlock
* @tc.desc Test writeSingleBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0600
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
rawData
=
[
0x0a
,
0x14
];
mifareClassic
.
writeSingleBlock
(
blockIndex
,
rawData
,
(
err
,
data
)
=>
{
MifareClassicTag
.
writeSingleBlock
(
blockIndex
,
rawData
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic writeSingleBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -235,14 +229,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testincrementBlock
* @tc.desc Test incrementBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0700
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
value
=
0x20
;
await
mifareClassic
.
incrementBlock
(
blockIndex
,
value
).
then
((
data
)
=>
{
await
MifareClassicTag
.
incrementBlock
(
blockIndex
,
value
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic incrementBlock1 data:
"
+
data
+
"
json7:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertInstanceOf
(
'
Number
'
)
done
();
...
...
@@ -260,14 +254,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testincrementBlock
* @tc.desc Test incrementBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0800
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
value
=
0x20
;
mifareClassic
.
incrementBlock
(
blockIndex
,
value
,
(
err
,
data
)
=>
{
MifareClassicTag
.
incrementBlock
(
blockIndex
,
value
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic incrementBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -286,14 +280,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testdecrementBlock
* @tc.desc Test decrementBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_0900
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
value
=
0x20
;
await
mifareClassic
.
decrementBlock
(
blockIndex
,
value
).
then
((
data
)
=>
{
await
MifareClassicTag
.
decrementBlock
(
blockIndex
,
value
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic decrementBlock1 data:
"
+
data
+
"
json9:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertInstanceOf
(
'
Number
'
)
done
();
...
...
@@ -311,14 +305,14 @@ export default function nfcMifareClassicTag() {
* @tc.name testdecrementBlock
* @tc.desc Test decrementBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1000
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
let
value
=
0x20
;
mifareClassic
.
decrementBlock
(
blockIndex
,
value
,
(
err
,
data
)
=>
{
MifareClassicTag
.
decrementBlock
(
blockIndex
,
value
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic decrementBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -337,13 +331,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testtransferToBlock
* @tc.desc Test transferToBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1100
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
await
mifareClassic
.
transferToBlock
(
blockIndex
).
then
((
data
)
=>
{
await
MifareClassicTag
.
transferToBlock
(
blockIndex
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic transferToBlock1 data:
"
+
data
+
"
json9:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertInstanceOf
(
'
Number
'
)
done
();
...
...
@@ -361,13 +355,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testtransferToBlock
* @tc.desc Test transferToBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1200
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
mifareClassic
.
transferToBlock
(
blockIndex
,
(
err
,
data
)
=>
{
MifareClassicTag
.
transferToBlock
(
blockIndex
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic transferToBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -386,13 +380,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testrestoreFromBlock
* @tc.desc Test restoreFromBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1300
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
await
mifareClassic
.
restoreFromBlock
(
blockIndex
).
then
((
data
)
=>
{
await
MifareClassicTag
.
restoreFromBlock
(
blockIndex
).
then
((
data
)
=>
{
console
.
info
(
"
mifareClassic restoreFromBlock1 data:
"
+
data
+
"
json11:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertInstanceOf
(
'
Number
'
)
done
();
...
...
@@ -410,13 +404,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testrestoreFromBlock
* @tc.desc Test restoreFromBlock api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1400
'
,
0
,
async
function
(
done
)
{
let
blockIndex
=
1
;
mifareClassic
.
restoreFromBlock
(
blockIndex
,
(
err
,
data
)
=>
{
MifareClassicTag
.
restoreFromBlock
(
blockIndex
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareClassic restoreFromBlock2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -435,12 +429,12 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetSectorCount
* @tc.desc Test getSectorCount api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1500
'
,
0
,
function
()
{
let
sectorCount
=
mifareClassic
.
getSectorCount
();
let
sectorCount
=
MifareClassicTag
.
getSectorCount
();
console
.
info
(
"
mifareClassic sectorCount:
"
+
sectorCount
);
expect
(
sectorCount
).
assertInstanceOf
(
'
Number
'
)
})
...
...
@@ -451,12 +445,12 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetBlockCountInSector
* @tc.desc Test getBlockCountInSector api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1600
'
,
0
,
function
()
{
let
blockCountInSector
=
mifareClassic
.
getBlockCountInSector
();
let
blockCountInSector
=
MifareClassicTag
.
getBlockCountInSector
();
console
.
info
(
"
mifareClassic blockCountInSector:
"
+
blockCountInSector
);
expect
(
blockCountInSector
).
assertInstanceOf
(
'
Number
'
)
})
...
...
@@ -467,12 +461,12 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetType
* @tc.desc Test getType api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1700
'
,
0
,
function
()
{
let
getType
=
mifareClassic
.
getType
();
let
getType
=
MifareClassicTag
.
getType
();
console
.
info
(
"
mifareClassic getType:
"
+
getType
);
expect
(
true
).
assertTrue
(
getType
>=
-
1
);
})
...
...
@@ -483,12 +477,12 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetTagSize
* @tc.desc Test getTagSize api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1800
'
,
0
,
function
()
{
let
tagSize
=
mifareClassic
.
getTagSize
();
let
tagSize
=
MifareClassicTag
.
getTagSize
();
console
.
info
(
"
mifareClassic tagSize:
"
+
tagSize
);
expect
(
tagSize
).
assertInstanceOf
(
'
Number
'
)
})
...
...
@@ -499,12 +493,12 @@ export default function nfcMifareClassicTag() {
* @tc.name testisEmulatedTag
* @tc.desc Test isEmulatedTag api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_1900
'
,
0
,
function
()
{
let
isEmulatedTag
=
mifareClassic
.
isEmulatedTag
();
let
isEmulatedTag
=
MifareClassicTag
.
isEmulatedTag
();
console
.
info
(
"
mifareClassic isEmulatedTag:
"
+
isEmulatedTag
);
expect
(
false
).
assertEqual
(
isEmulatedTag
);
})
...
...
@@ -515,13 +509,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetBlockIndex
* @tc.desc Test getBlockIndex api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_2000
'
,
0
,
function
()
{
let
sectorIndex
=
1
;
let
blockIndex
=
mifareClassic
.
getBlockIndex
(
sectorIndex
);
let
blockIndex
=
MifareClassicTag
.
getBlockIndex
(
sectorIndex
);
console
.
info
(
"
mifareClassic blockIndex:
"
+
blockIndex
);
expect
(
true
).
assertTrue
(
blockIndex
>=
0
);
})
...
...
@@ -532,13 +526,13 @@ export default function nfcMifareClassicTag() {
* @tc.name testgetSectorIndex
* @tc.desc Test getSectorIndex api.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareClassic_js_2100
'
,
0
,
function
()
{
let
blockIndex
=
1
;
let
sectorIndex
=
mifareClassic
.
getSectorIndex
(
blockIndex
);
let
sectorIndex
=
MifareClassicTag
.
getSectorIndex
(
blockIndex
);
console
.
info
(
"
mifareClassic sectorIndex:
"
+
sectorIndex
);
expect
(
true
).
assertTrue
(
sectorIndex
>=
0
);
})
...
...
communication/nfc_Controller/src/main/js/test/nfc.MifareUltralightTag.js
浏览文件 @
0d7698e9
...
...
@@ -38,12 +38,26 @@ let mifareUltralightTaginfo = {
"
tagRfDiscId
"
:
1
,
};
let
MifareUltralightType
=
{
TYPE_UNKOWN
:
0x04
,
TYPE_ULTRALIGHT
:
1
,
TYPE_ULTRALIGHT_C
:
2
,
}
let
MifareUltralightTag
=
null
;
export
default
function
nfcMifareUltralightTag
()
{
describe
(
'
nfcMifareUltralightTag
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
[NFC_test]beforeAll called
'
)
})
beforeEach
(
function
()
{
try
{
MifareUltralightTag
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
console
.
info
(
'
mifareUltralight is
'
+
mifareUltralight
)
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
console
.
info
(
'
[NFC_test]beforeEach called
'
)
})
afterEach
(
function
()
{
...
...
@@ -58,20 +72,15 @@ export default function nfcMifareUltralightTag() {
* @tc.name testreadMultiplePages
* @tc.desc Test readMultiplePages api by promise.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareUltralight_0100
'
,
0
,
async
function
(
done
)
{
let
mifareUltralight
;
try
{
mifareUltralight
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
console
.
info
(
'
mifareUltralight is
'
+
mifareUltralight
)
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
let
pageIndex
=
1
;
await
mifareUltralight
.
readMultiplePages
(
pageIndex
).
then
((
data
)
=>
{
await
MifareUltralightTag
.
readMultiplePages
(
pageIndex
).
then
((
data
)
=>
{
console
.
info
(
"
mifareUltralight readMultiplePages1 data:
"
+
data
+
"
json1:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
>=
0
);
done
();
...
...
@@ -88,19 +97,13 @@ export default function nfcMifareUltralightTag() {
* @tc.name testreadMultiplePages
* @tc.desc Test readMultiplePages api by callback.
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareUltralight_0200
'
,
0
,
async
function
(
done
)
{
let
mifareUltralight
;
try
{
mifareUltralight
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
let
pageIndex
=
1
;
mifareUltralight
.
readMultiplePages
(
pageIndex
,
(
err
,
data
)
=>
{
MifareUltralightTag
.
readMultiplePages
(
pageIndex
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareUltralight readMultiplePages2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
...
...
@@ -115,82 +118,15 @@ export default function nfcMifareUltralightTag() {
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0300
* @tc.name testwriteSinglePages
* @tc.desc Test writeSinglePages api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareUltralight_0300
'
,
0
,
async
function
(
done
)
{
let
mifareUltralight
;
try
{
mifareUltralight
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
let
pageIndex
=
1
;
let
datatype
=
[
0x01
,
0x02
];
await
mifareUltralight
.
writeSinglePage
(
pageIndex
,
datatype
).
then
((
data
)
=>
{
console
.
info
(
"
mifareUltralight writeSinglePages1 data:
"
+
data
+
"
json1:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
>=
0
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
"
mifareUltralight writeSinglePages1 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
sleep
(
3000
);
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0400
* @tc.name testwriteSinglePages
* @tc.desc Test writeSinglePages api by callback.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareUltralight_0400
'
,
0
,
async
function
(
done
)
{
let
mifareUltralight
;
try
{
mifareUltralight
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
let
pageIndex
=
1
;
let
datatype
=
[
0x01
,
0x02
];
mifareUltralight
.
writeSinglePage
(
pageIndex
,
datatype
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
"
mifareUltralight writeSinglePages2 err:
"
+
err
);
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
"
mifareUltralight writeSinglePages2 data:
"
+
data
+
"
json2:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
>=
0
);
}
});
sleep
(
3000
);
done
();
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0500
* @tc.name testgetType
* @tc.desc Gets the type of Mifare Ultralight label
* @tc.size MEDIUM
* @ since
7
* @ since
9
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_Communication_NFC_mifareUltralight_0500
'
,
0
,
function
()
{
let
mifareUltralight
;
try
{
mifareUltralight
=
tag
.
getMifareUltralight
(
mifareUltralightTaginfo
);
}
catch
(
error
){
console
.
info
(
'
mifareUltralight error
'
+
error
)
}
let
getType
=
mifareUltralight
.
getType
();
let
getType
=
MifareUltralightTag
.
getType
();
console
.
info
(
"
mifareUltralight getType:
"
+
getType
);
expect
(
true
).
assertTrue
(
getType
>=
-
1
);
})
...
...
communication/nfc_Controller/src/main/js/test/nfc.NDEFTag.js
0 → 100644
浏览文件 @
0d7698e9
此差异已折叠。
点击以展开。
communication/nfc_Controller/src/main/js/test/nfc.TagABFV.js
浏览文件 @
0d7698e9
此差异已折叠。
点击以展开。
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
浏览文件 @
0d7698e9
...
...
@@ -198,3 +198,4 @@ export default function actsWifiEventTest() {
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
}
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
浏览文件 @
0d7698e9
...
...
@@ -85,6 +85,8 @@ export default function actsWifiFunctionTest() {
"
passphrase:
"
+
result
.
passphrase
+
"
interface:
"
+
result
.
interface
+
"
groupName:
"
+
result
.
groupName
+
"
frequency:
"
+
result
.
frequency
+
"
goIpAddress:
"
+
result
.
goIpAddress
);
console
.
info
(
"
[wifi_test] clientDevices:
"
+
JSON
.
stringify
(
result
.
clientDevices
));
console
.
info
(
"
[wifi_test] ownerInfo:
"
+
JSON
.
stringify
(
result
.
WifiP2pDevice
));
resolve
();
});
});
...
...
@@ -124,7 +126,6 @@ export default function actsWifiFunctionTest() {
expect
(
createGroupResult
).
assertTrue
();
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
let
resultLength
=
Object
.
keys
(
data
).
length
;
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
networkId
==
-
999
);
});
...
...
@@ -274,7 +275,7 @@ export default function actsWifiFunctionTest() {
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
frequency
==
2412
);
expect
(
true
).
assertEqual
(
2412
<
data
.
frequency
<
2484
);
});
let
removeGroupResult
=
wifi
.
removeGroup
();
await
sleep
(
2000
);
...
...
@@ -312,7 +313,7 @@ export default function actsWifiFunctionTest() {
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
frequency
==
574
5
);
expect
(
true
).
assertEqual
(
5160
<
data
.
frequency
<
586
5
);
});
let
removeGroupResult
=
await
wifi
.
removeGroup
();
await
sleep
(
2000
);
...
...
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
浏览文件 @
0d7698e9
...
...
@@ -14,6 +14,7 @@
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
wifi
from
'
@ohos.wifi
'
function
sleep
(
delay
)
{
...
...
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
浏览文件 @
0d7698e9
...
...
@@ -17,6 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import
wifi
from
'
@ohos.wifi
'
function
sleep
(
delay
)
{
return
new
Promise
(
resovle
=>
setTimeout
(
resovle
,
delay
))
}
...
...
@@ -166,3 +167,4 @@ export default function actsWifiEventTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js
浏览文件 @
0d7698e9
...
...
@@ -76,7 +76,7 @@ export default function actsWifiFunctionsTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0002
* @tc.name test
G
etScanInfos
* @tc.name test
g
etScanInfos
* @tc.desc Test getScanInfos promise and callback API functionality.
* @tc.type Function
* @tc.level Level 0
...
...
@@ -308,7 +308,7 @@ export default function actsWifiFunctionsTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0034
* @tc.name test
G
etScanInfosSync
* @tc.name test
g
etScanInfosSync
* @tc.desc Test getScanInfos Sync API functionality.
* @tc.type Function
* @tc.level Level 0
...
...
@@ -325,3 +325,5 @@ export default function actsWifiFunctionsTest() {
})
}
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
浏览文件 @
0d7698e9
...
...
@@ -188,7 +188,8 @@ describe('geolocationTest_geo1', function () {
+
JSON
.
stringify
(
data
)[
0
].
placeName
+
JSON
.
stringify
(
data
)[
0
].
postalCode
+
JSON
.
stringify
(
data
)[
0
].
premises
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
);
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
done
();
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
ca648ff7
·
11月 03, 2022
mentioned in commit
ca648ff7
mentioned in commit ca648ff75672da34f15bde304d51ca2c4a8686be
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录