Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6f2c6e1d
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看板
提交
6f2c6e1d
编写于
8月 26, 2022
作者:
C
chenxuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hiappeventsubjscommit
Signed-off-by:
N
chenxuihui
<
chenxuhui2@huawei.com
>
上级
1a6e4e40
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
45 deletion
+43
-45
hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSub.test.js
...iappeventsubjstest/src/main/js/test/HiAppEventSub.test.js
+43
-45
未找到文件。
hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSub.test.js
浏览文件 @
6f2c6e1d
...
@@ -120,13 +120,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -120,13 +120,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub02
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub02
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub02 start
'
)
console
.
info
(
'
testHiAppEventSub02 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
holder
=
HiAppEvent
.
addWatcher
({
let
holder
=
HiAppEvent
.
addWatcher
({
...
@@ -593,7 +593,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -593,7 +593,7 @@ describe('HiAppEventSubTest', function () {
console
.
info
(
'
HiAppEventSub07 end
'
)
console
.
info
(
'
HiAppEventSub07 end
'
)
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_0800
* @tc.number DFX_DFT_HiAppEvent_Sub_0800
* @tc.name 验证调用hiAppEvent.addWatcher,domain为无效,事件订阅失败
* @tc.name 验证调用hiAppEvent.addWatcher,domain为无效,事件订阅失败
...
@@ -647,7 +647,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -647,7 +647,7 @@ describe('HiAppEventSubTest', function () {
console
.
info
(
'
HiAppEventSub08 end
'
)
console
.
info
(
'
HiAppEventSub08 end
'
)
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_0900
* @tc.number DFX_DFT_HiAppEvent_Sub_0900
* @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为FAULT,事件订阅成功
* @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为FAULT,事件订阅成功
...
@@ -1004,7 +1004,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -1004,7 +1004,7 @@ describe('HiAppEventSubTest', function () {
{
{
domain
:
"
default
"
,
domain
:
"
default
"
,
eventTypes
:
[
HiAppEvent
.
EventType
.
FAULT
,
HiAppEvent
.
EventType
.
STATISTIC
,
eventTypes
:
[
HiAppEvent
.
EventType
.
FAULT
,
HiAppEvent
.
EventType
.
STATISTIC
,
HiAppEvent
.
EventType
.
SECURITY
,
HiAppEvent
.
EventType
.
BEHAVIOR
]
HiAppEvent
.
EventType
.
SECURITY
,
HiAppEvent
.
EventType
.
BEHAVIOR
]
}
}
],
],
triggerCondition
:
{
triggerCondition
:
{
...
@@ -1091,7 +1091,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -1091,7 +1091,7 @@ describe('HiAppEventSubTest', function () {
appEventFilters
:
[
appEventFilters
:
[
{
{
eventTypes
:
[
HiAppEvent
.
EventType
.
FAULT
,
HiAppEvent
.
EventType
.
STATISTIC
,
eventTypes
:
[
HiAppEvent
.
EventType
.
FAULT
,
HiAppEvent
.
EventType
.
STATISTIC
,
HiAppEvent
.
EventType
.
SECURITY
,
HiAppEvent
.
EventType
.
BEHAVIOR
]
HiAppEvent
.
EventType
.
SECURITY
,
HiAppEvent
.
EventType
.
BEHAVIOR
]
}
}
],
],
triggerCondition
:
{
triggerCondition
:
{
...
@@ -1258,13 +1258,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -1258,13 +1258,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub16
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub16
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub16 start
'
)
console
.
info
(
'
testHiAppEventSub16 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1341,13 +1341,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -1341,13 +1341,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub17
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub17
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub17 start
'
)
console
.
info
(
'
testHiAppEventSub17 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1627,7 +1627,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -1627,7 +1627,7 @@ describe('HiAppEventSubTest', function () {
console
.
info
(
'
HiAppEventSub21 end
'
)
console
.
info
(
'
HiAppEventSub21 end
'
)
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2200
* @tc.number DFX_DFT_HiAppEvent_Sub_2200
* @tc.name 验证调用hiAppEvent.addWatcher,timeout=1,事件订阅成功
* @tc.name 验证调用hiAppEvent.addWatcher,timeout=1,事件订阅成功
...
@@ -1635,13 +1635,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -1635,13 +1635,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub22
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub22
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub22 start
'
)
console
.
info
(
'
testHiAppEventSub22 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1689,7 +1689,6 @@ describe('HiAppEventSubTest', function () {
...
@@ -1689,7 +1689,6 @@ describe('HiAppEventSubTest', function () {
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2300
* @tc.number DFX_DFT_HiAppEvent_Sub_2300
* @tc.name 验证调用hiAppEvent.addWatcher,timeout=0,事件订阅失败
* @tc.name 验证调用hiAppEvent.addWatcher,timeout=0,事件订阅失败
...
@@ -1697,13 +1696,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -1697,13 +1696,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub23
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub23
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub23 start
'
)
console
.
info
(
'
testHiAppEventSub23 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1751,7 +1750,6 @@ describe('HiAppEventSubTest', function () {
...
@@ -1751,7 +1750,6 @@ describe('HiAppEventSubTest', function () {
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2400
* @tc.number DFX_DFT_HiAppEvent_Sub_2400
* @tc.name 验证调用hiAppEvent.addWatcher,未设置触发条件,事件订阅失败
* @tc.name 验证调用hiAppEvent.addWatcher,未设置触发条件,事件订阅失败
...
@@ -1759,13 +1757,13 @@ describe('HiAppEventSubTest', function () {
...
@@ -1759,13 +1757,13 @@ describe('HiAppEventSubTest', function () {
*/
*/
it
(
'
HiAppEventSub24
'
,
3
,
async
function
(
done
)
{
it
(
'
HiAppEventSub24
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub24 start
'
)
console
.
info
(
'
testHiAppEventSub24 start
'
)
function
sleep
(
numberMillis
){
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1815,13 +1813,15 @@ describe('HiAppEventSubTest', function () {
...
@@ -1815,13 +1813,15 @@ describe('HiAppEventSubTest', function () {
* @tc.name 验证调用hiAppEvent.addWatcher,触发条件仅timeout有效,事件订阅成功
* @tc.name 验证调用hiAppEvent.addWatcher,触发条件仅timeout有效,事件订阅成功
* @tc.desc HiAppEvent write interface test.
* @tc.desc HiAppEvent write interface test.
*/
*/
function
sleep
(
numberMillis
){
it
(
'
HiAppEventSub28
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventSub28 start
'
)
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
var
exitTime
=
now
.
getTime
()
+
numberMillis
;
while
(
true
){
while
(
true
)
{
now
=
new
Date
();
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
if
(
now
.
getTime
()
>
exitTime
)
return
;
return
;
}
}
}
}
let
result
=
HiAppEvent
.
addWatcher
({
let
result
=
HiAppEvent
.
addWatcher
({
...
@@ -1923,7 +1923,6 @@ describe('HiAppEventSubTest', function () {
...
@@ -1923,7 +1923,6 @@ describe('HiAppEventSubTest', function () {
},
1000
)
},
1000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2500
* @tc.number DFX_DFT_HiAppEvent_Sub_2500
* @tc.name 验证调用removeWatcher,watcher为已有watcher,订阅者、相关订阅事件删除成功
* @tc.name 验证调用removeWatcher,watcher为已有watcher,订阅者、相关订阅事件删除成功
...
@@ -1962,7 +1961,6 @@ describe('HiAppEventSubTest', function () {
...
@@ -1962,7 +1961,6 @@ describe('HiAppEventSubTest', function () {
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2600
* @tc.number DFX_DFT_HiAppEvent_Sub_2600
* @tc.name 验证调用removeWatcher,watcher无效,订阅者、相关订阅事件删除失败
* @tc.name 验证调用removeWatcher,watcher无效,订阅者、相关订阅事件删除失败
...
@@ -1999,7 +1997,7 @@ describe('HiAppEventSubTest', function () {
...
@@ -1999,7 +1997,7 @@ describe('HiAppEventSubTest', function () {
console
.
info
(
'
HiAppEventSub26 end
'
)
console
.
info
(
'
HiAppEventSub26 end
'
)
},
2000
)
},
2000
)
})
})
/**
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_2700
* @tc.number DFX_DFT_HiAppEvent_Sub_2700
* @tc.name 验证清理接口功能
* @tc.name 验证清理接口功能
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录