Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b1556900
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看板
提交
b1556900
编写于
11月 17, 2021
作者:
O
openharmony_ci
提交者:
Gitee
11月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1096 BMS xts update
Merge pull request !1096 from blackleon/1116
上级
aa06a4e4
c01ccf61
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
7 deletion
+32
-7
appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js
...try/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js
+32
-7
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js
浏览文件 @
b1556900
...
...
@@ -26,21 +26,32 @@ const NUM_TEN = 10;
const
INVALID_NUM
=
-
1
;
const
START_ABILITY_TIMEOUT
=
3000
;
const
START_RECORD
=
900
;
const
TIMEOUT
=
3000
;
var
START_COUNT
=
1
;
var
RECORD_COUNT
=
0
;
describe
(
'
ActsBmsModuleUsageRecordTest
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
continue
;
}
}
beforeAll
(
async
(
done
)
=>
{
var
subscriber
;
let
id
;
async
function
subscribeCallBack
(
err
,
data
)
{
clearTimeout
(
id
);
console
.
debug
(
'
=====subscribeCallBack=====
'
+
data
.
event
);
sleep
(
TIMEOUT
);
let
records
=
await
bundle
.
getModuleUsageRecords
(
START_RECORD
);
console
.
debug
(
'
=====get moduleUsageRecord finish=====
'
);
RECORD_COUNT
=
records
.
length
;
for
(
let
i
=
0
,
len
=
records
.
length
;
i
<
len
;
i
++
)
{
if
(
records
[
i
].
bundleName
==
'
com.example.third1
'
)
{
START_COUNT
=
records
[
i
].
launchedCount
;
console
.
debug
(
'
=====START_COUNT is =====
'
+
START_COUNT
);
}
}
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
);
...
...
@@ -120,6 +131,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console
.
debug
(
'
=============bundleName is=========
'
+
JSON
.
stringify
(
records
[
i
].
bundleName
));
dataMap
.
set
(
records
[
i
].
bundleName
,
records
[
i
]);
}
expect
(
dataMap
.
has
(
BUNDLE_NAME
)).
assertTrue
();
if
(
dataMap
.
has
(
BUNDLE_NAME
))
{
let
data
=
dataMap
.
get
(
BUNDLE_NAME
);
expect
(
data
.
bundleName
).
assertEqual
(
'
com.example.third1
'
);
...
...
@@ -150,7 +162,16 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
);
checkModuleUsageRecord
(
data
);
var
result
=
checkIsExist
(
data
,
BUNDLE_NAME
);
expect
(
result
).
assertEqual
(
true
);
expect
(
result
).
assertTrue
();
if
(
result
)
{
let
counts
=
new
Map
();
console
.
debug
(
'
======LaunchedCount======
'
+
START_COUNT
);
for
(
let
i
=
0
,
length
=
data
.
length
;
i
<
length
;
i
++
)
{
counts
.
set
(
data
[
i
].
bundleName
,
data
[
i
].
launchedCount
);
console
.
debug
(
'
=============launchedCount is=========
'
+
data
[
i
].
launchedCount
);
}
expect
(
counts
.
get
(
BUNDLE_NAME
)).
assertEqual
(
START_COUNT
);
}
done
();
});
})
...
...
@@ -166,7 +187,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
);
checkModuleUsageRecord
(
data
);
var
result
=
checkIsExist
(
data
,
BUNDLE_NAME
);
expect
(
result
).
assert
Equal
(
true
);
expect
(
result
).
assert
True
(
);
if
(
result
)
{
let
counts
=
new
Map
();
console
.
debug
(
'
======LaunchedCount======
'
+
START_COUNT
);
...
...
@@ -190,7 +211,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var
records
=
await
bundle
.
getModuleUsageRecords
(
RECORD_COUNT
+
NUM_TWO
);
checkModuleUsageRecord
(
records
);
var
result
=
checkIsExist
(
records
,
BUNDLE_NAME
);
expect
(
result
).
assert
Equal
(
true
);
expect
(
result
).
assert
True
(
);
if
(
result
)
{
let
counts
=
new
Map
();
console
.
debug
(
'
======LaunchedCount======
'
+
START_COUNT
);
...
...
@@ -371,7 +392,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
"
SUCCESS
"
);
var
records
=
await
bundle
.
getModuleUsageRecords
(
RECORD_COUNT
+
NUM_TEN
)
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
Equal
(
true
);
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
True
(
);
done
();
});
});
...
...
@@ -409,7 +430,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect
(
data
.
statusMessage
).
assertEqual
(
"
SUCCESS
"
);
bundle
.
getModuleUsageRecords
(
RECORD_COUNT
+
NUM_TEN
,
(
err
,
records
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
Equal
(
true
);
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
True
(
);
done
();
})
});
...
...
@@ -430,10 +451,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
clearTimeout
(
id
);
START_COUNT
+=
1
;
expect
(
data
.
event
).
assertEqual
(
'
ACTS_Third1_Publish_CommonEvent
'
);
sleep
(
TIMEOUT
);
await
bundle
.
getModuleUsageRecords
(
RECORD_COUNT
+
NUM_TEN
,
(
err
,
records
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
var
result
=
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
);
expect
(
result
).
assert
Equal
(
true
);
expect
(
result
).
assert
True
(
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
);
done
();
})
...
...
@@ -448,6 +470,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
function
timeout
()
{
console
.
debug
(
'
=====timeout======
'
);
expect
().
assertFail
();
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
done
();
}
...
...
@@ -500,8 +523,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
clearTimeout
(
id
);
START_COUNT
+=
1
;
expect
(
data
.
event
).
assertEqual
(
'
ACTS_Third1_Publish_CommonEvent
'
);
sleep
(
TIMEOUT
);
var
records
=
await
bundle
.
getModuleUsageRecords
(
RECORD_COUNT
+
NUM_TEN
)
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
Equal
(
true
);
expect
(
checkLaunchCount
(
records
,
BUNDLE_NAME
,
START_COUNT
)).
assert
True
(
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
);
done
();
}
...
...
@@ -515,6 +539,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
function
timeout
()
{
console
.
debug
(
'
=====timeout======
'
);
expect
().
assertFail
();
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
done
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录