Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9820d875
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看板
未验证
提交
9820d875
编写于
3月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2245 元能力适配新任务栈xts测试用例修改
Merge pull request !2245 from mingxihua/master
上级
9b1be37e
87d61a87
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
838 addition
and
2810 deletion
+838
-2810
aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
...fifthscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...hscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+97
-292
aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
...firstscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...tscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+72
-281
aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
...ourthscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...hscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+90
-307
aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
...econdscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...dscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+73
-278
aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
...thirdscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...dscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+86
-283
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json
...k_standard/abilitymanager/actsamstestfifthscene/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
...fifthscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...hscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+98
-287
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json
...k_standard/abilitymanager/actsamstestfirstscene/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
...firstscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...tscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+66
-253
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json
..._standard/abilitymanager/actsamstestfourthscene/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
...ourthscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...hscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+90
-291
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json
..._standard/abilitymanager/actsamstestsecondscene/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
...econdscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...dscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+65
-266
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json
...k_standard/abilitymanager/actsamstestthirdscene/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
...thirdscene/entry/src/main/js/default/pages/index/index.js
+1
-0
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
...dscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+76
-257
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json
...k_standard/abilitymanager/clearmissionscallback/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json
...abilitymanager/clearmissionscallback/src/main/config.json
+1
-1
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js
...ionscallback/src/main/js/test/MangerAbilityJsunit.test.js
+3
-3
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json
...wk_standard/abilitymanager/clearmissionspromise/Test.json
+1
-1
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json
.../abilitymanager/clearmissionspromise/src/main/config.json
+1
-1
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js
...sionspromise/src/main/js/test/MangerAbilityJsunit.test.js
+3
-3
未找到文件。
aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -55,16 +43,20 @@ describe('ActsAmsCallBackFifthScene', function () {
console
.
info
(
'
----ActsAmsCallBackFifthScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsCallBackFifthScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamscallbackfifthscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamscallbackfifthscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamscallbackfifthscene
'
)
{
console
.
log
(
"
ActsAmsCallBackFifthScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsCallBackFifthScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -76,8 +68,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -89,8 +85,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -102,9 +102,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
()
,
5000
);
setTimeout
(
done
,
5000
);
});
function
timeout
(
done
)
{
...
...
@@ -114,346 +117,147 @@ describe('ActsAmsCallBackFifthScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_6600
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_6600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
a
bilityManager
.
getAllRunningProcesse
s
(
a
ppManager
.
getProcessRunningInfo
s
(
(
error
,
info
)
=>
{
console
.
info
(
'
getAllRunningProcesse
s error.code
\
console
.
info
(
'
Acts_Ams_test_6600 getProcessRunningInfo
s error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_6600 getAllRunningProcesses JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_6600 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_7000
* @tc.name :
queryRecentAbility
MissionInfos : Query Recent Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_7000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
,
(
error
,
data
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_7000 queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_6800
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_6800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
,
missionManager
.
getMissionInfos
(
""
,
maxnum
,
(
error
,
data
)
=>
{
console
.
info
(
'
queryRunningAbility
MissionInfos error.code :
\
console
.
info
(
'
Acts_Ams_test_7000 get
MissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_6800 queryRunningAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9000
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_9000
'
,
0
,
async
function
(
done
)
{
abilityManager
.
getActiveProcessInfos
(
(
error
,
info
)
=>
{
console
.
info
(
'
getActiveProcessInfos error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_9000 getActiveProcessInfos data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10000
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_10000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getActiveAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_10000 getActiveAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_11000
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_11000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getPreviousAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_11000 getPreviousAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
console
.
info
(
'
Acts_Ams_test_7000 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_7200
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it
(
'
Acts_Ams_test_7200
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMission
(
result
[
1
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_7200 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
1
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_7200
remove
Mission error.code
\
console
.
info
(
'
Acts_Ams_test_7200
clear
Mission error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_7600
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it
(
'
Acts_Ams_test_7600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_7600 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_7600 moveMissionTo
Top
error.code
\
console
.
info
(
'
Acts_Ams_test_7600 moveMissionTo
Front
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_12000
* @tc.name :
deleteMissions
: Remove Missions
* @tc.name :
clearMission
: Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_12000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
deleteMissions
([
result
[
0
].
id
],
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_12000 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_12000
deleteMissions
error.code
\
console
.
info
(
'
Acts_Ams_test_12000
clearMission
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
...
...
@@ -463,14 +267,15 @@ describe('ActsAmsCallBackFifthScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it
(
'
Acts_Ams_test_8000
'
,
0
,
async
function
(
done
)
{
a
bility
Manager
.
killProcessesByBundleName
(
'
com.ix.verify.io
'
,
a
pp
Manager
.
killProcessesByBundleName
(
'
com.ix.verify.io
'
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_8000 killProcessesByBundleName error.code:
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -40,6 +40,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -52,16 +40,20 @@ describe('ActsAmsCallBackFirstScene', function () {
console
.
info
(
'
----ActsAmsCallBackFirstScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsCallBackFirstScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamscallbackfirstscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamscallbackfirstscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamscallbackfirstscene
'
)
{
console
.
log
(
"
ActsAmsCallBackFirstScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsCallBackFirstScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -73,7 +65,10 @@ describe('ActsAmsCallBackFirstScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -85,53 +80,41 @@ describe('ActsAmsCallBackFirstScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_0200
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
a
bilityManager
.
getAllRunningProcesse
s
(
a
ppManager
.
getProcessRunningInfo
s
(
(
error
,
info
)
=>
{
console
.
info
(
'
getAllRunningProcesse
s error.code
\
console
.
info
(
'
Acts_Ams_test_0200 getProcessRunningInfo
s error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_0200 getAllRunningProcesses data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0200 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
});
...
...
@@ -140,231 +123,33 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0400
* @tc.name :
queryRunningAbility
MissionInfos : Query Running Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_0400
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
,
missionManager
.
getMissionInfos
(
""
,
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbility
MissionInfos error.code :
\
console
.
info
(
'
Acts_Ams_test_0400 get
MissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_0400 queryRunningAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_0600
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_0600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRunningAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_0600 queryRecentAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8600
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_8600
'
,
0
,
async
function
(
done
)
{
abilityManager
.
getActiveProcessInfos
(
(
error
,
info
)
=>
{
console
.
info
(
'
getActiveProcessInfos error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_8600 getActiveProcessInfos data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9600
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_9600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getActiveAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_9600 getActiveAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10600
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_10600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getPreviousAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_10600 getPreviousAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0400 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
...
...
@@ -373,18 +158,21 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_1400
* @tc.name :
remove
Missions : Remove Missions
* @tc.name :
clear
Missions : Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_1400
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
missionID
=
result
[
0
].
id
+
100
;
abilityManager
.
removeMissions
([
missionID
],
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1400 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
missionID
=
result
[
0
].
missionId
+
100
;
missionManager
.
clearMission
(
missionID
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_1400
remove
Missions error.code
\
console
.
info
(
'
Acts_Ams_test_1400
clear
Missions error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertLarger
(
0
);
expect
(
error
.
code
).
assertLarger
(
-
1
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -392,17 +180,20 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0800
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it
(
'
Acts_Ams_test_0800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMission
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0800 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_0800
remove
Mission error.code
\
console
.
info
(
'
Acts_Ams_test_0800
clear
Mission error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -414,35 +205,35 @@ describe('ActsAmsCallBackFirstScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it
(
'
Acts_Ams_test_1600
'
,
0
,
async
function
(
done
)
{
a
bility
Manager
.
killProcessesByBundleName
(
'
com.ix.simulate.feature
'
,
a
pp
Manager
.
killProcessesByBundleName
(
'
com.ix.simulate.feature
'
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_1600 killProcessesByBundleName error.code:
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_1200
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it
(
'
Acts_Ams_test_1200
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1200 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_1200 moveMissionTo
Top
error.code
\
console
.
info
(
'
Acts_Ams_test_1200 moveMissionTo
Front
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,30 +12,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
"
com.example.SimulateFeatureAbilityFir
"
,
"
com.example.VerifyActThirdAbility
"
,
"
com.example.VerifyIoThirdAbility
"
,
"
com.example.SimulateEntryAbility
Fir
"
,
"
com.example.SimulateEntryAbility
"
,
"
com.example.actsamscallbackfourthscene.MainAbility
"
]
...
...
@@ -58,16 +46,20 @@ describe('ActsAmsCallBackFourthScene', function () {
console
.
info
(
'
----ActsAmsCallBackFourthScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsCallBackFourthScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamscallbackfourthscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamscallbackfourthscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamscallbackfourthscene
'
)
{
console
.
log
(
"
ActsAmsCallBackFourthScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsCallBackFourthScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -79,8 +71,12 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -92,8 +88,12 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -105,19 +105,26 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
{
deviceId
:
""
,
bundleName
:
"
com.ix.simulate.entry
"
,
abilityName
:
"
com.example.SimulateEntryAbility
"
,
abilityName
:
"
com.example.SimulateEntryAbility
Fir
"
,
action
:
"
action1
"
,
parameters
:
{},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
...
...
@@ -130,53 +137,41 @@ describe('ActsAmsCallBackFourthScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_5000
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_5000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
a
bilityManager
.
getAllRunningProcesse
s
(
a
ppManager
.
getProcessRunningInfo
s
(
(
error
,
info
)
=>
{
console
.
info
(
'
getAllRunningProcesse
s error.code
\
console
.
info
(
'
Acts_Ams_test_5000 getProcessRunningInfo
s error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_5000 getAllRunningProcesses JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5000 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
});
...
...
@@ -186,251 +181,33 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5400
* @tc.name :
queryRecentAbility
MissionInfos : Query Recent Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_5400
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
100
;
var
flag
=
1
;
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
,
(
error
,
data
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
data
.
length
+
'
]
'
);
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5400 queryRecentAbilityMissionInfos id:
\
'
+
data
[
i
].
id
+
'
baseAbility.deviceId:
\
'
+
data
[
i
].
baseAbility
.
deviceId
+
'
baseAbility.bundleName:
\
'
+
data
[
i
].
baseAbility
.
bundleName
+
'
baseAbility.abilityName:
\
'
+
data
[
i
].
baseAbility
.
abilityName
+
'
topAbility.deviceId:
\
'
+
data
[
i
].
topAbility
.
deviceId
+
'
topAbility.bundleName:
\
'
+
data
[
i
].
topAbility
.
bundleName
+
'
topAbility.abilityName:
\
'
+
data
[
i
].
topAbility
.
abilityName
+
'
missionDescription.label:
\
'
+
data
[
i
].
missionDescription
.
label
+
'
missionDescription.iconPath:
\
'
+
data
[
i
].
missionDescription
.
iconPath
);
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_5200
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_5200
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
,
missionManager
.
getMissionInfos
(
""
,
maxnum
,
(
error
,
data
)
=>
{
console
.
info
(
'
queryRunningAbility
MissionInfos error.code :
\
console
.
info
(
'
Acts_Ams_test_5400 get
MissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
data
.
length
+
'
]
'
);
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
expect
(
data
.
length
).
assertEqual
(
5
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5200 queryRunningAbilityMissionInfos id:
\
'
+
data
[
i
].
id
+
'
baseAbility.deviceId:
\
'
+
data
[
i
].
baseAbility
.
deviceId
+
'
baseAbility.bundleName:
\
'
+
data
[
i
].
baseAbility
.
bundleName
+
'
baseAbility.abilityName:
\
'
+
data
[
i
].
baseAbility
.
abilityName
+
'
topAbility.deviceId:
\
'
+
data
[
i
].
topAbility
.
deviceId
+
'
topAbility.bundleName:
\
'
+
data
[
i
].
topAbility
.
bundleName
+
'
topAbility.abilityName:
\
'
+
data
[
i
].
topAbility
.
abilityName
+
'
missionDescription.label:
\
'
+
data
[
i
].
missionDescription
.
label
+
'
missionDescription.iconPath:
\
'
+
data
[
i
].
missionDescription
.
iconPath
);
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8900
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_8900
'
,
0
,
async
function
(
done
)
{
abilityManager
.
getActiveProcessInfos
(
(
error
,
info
)
=>
{
console
.
info
(
'
getActiveProcessInfos error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_8900 getActiveProcessInfos data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9900
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_9900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getActiveAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_9900 getActiveAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10900
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_10900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getPreviousAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_10900 getPreviousAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
console
.
info
(
'
Acts_Ams_test_5400 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
...
...
@@ -439,18 +216,20 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5600
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it
(
'
Acts_Ams_test_5600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMission
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5600 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_5600
remove
Mission error.code
\
console
.
info
(
'
Acts_Ams_test_5600
clear
Mission error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -458,18 +237,20 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_6000
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it
(
'
Acts_Ams_test_6000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
moveMissionToTop
(
result
[
1
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_6000 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
moveMissionToFront
(
result
[
1
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_6000 moveMissionTo
Top
error.code
\
console
.
info
(
'
Acts_Ams_test_6000 moveMissionTo
Front
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -481,7 +262,7 @@ describe('ActsAmsCallBackFourthScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it
(
'
Acts_Ams_test_6400
'
,
0
,
async
function
(
done
)
{
ability
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxx
'
,
mission
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxx
'
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_6400 killProcessesByBundleName error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
...
...
@@ -494,20 +275,22 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_11900
* @tc.name :
delete
Missions : delete Missions
* @tc.name :
clear
Missions : delete Missions
* @tc.desc : delete Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_11900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
deleteMissions
([
result
[
1
].
id
,
result
[
0
].
id
],
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_11900 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearAllMissions
(
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_11900
delete
Missions error.code:
\
console
.
info
(
'
Acts_Ams_test_11900
clearAll
Missions error.code:
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -54,16 +42,20 @@ describe('ActsAmsCallBackSecondScene', function () {
console
.
info
(
'
----ActsAmsCallBackSecondScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsCallBackSecondScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamscallbacksecondscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamscallbacksecondscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamscallbacksecondscene
'
)
{
console
.
log
(
"
ActsAmsCallBackSecondScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsCallBackSecondScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -75,8 +67,12 @@ describe('ActsAmsCallBackSecondScene', function () {
parameters
:
{},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -88,6 +84,9 @@ describe('ActsAmsCallBackSecondScene', function () {
parameters
:
{},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
...
...
@@ -100,53 +99,41 @@ describe('ActsAmsCallBackSecondScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_1800
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
a
bilityManager
.
getAllRunningProcesse
s
(
a
ppManager
.
getProcessRunningInfo
s
(
(
error
,
info
)
=>
{
console
.
info
(
'
getAllRunningProcesse
s error.code
\
console
.
info
(
'
Acts_Ams_test_1800 getProcessRunningInfo
s error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_1800 getAllRunningProcesses data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1800 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
});
...
...
@@ -155,231 +142,33 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2000
* @tc.name :
queryRunningAbility
MissionInfos : Query Running Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_2000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_2000 queryRunningAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_2200
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_2200
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
flag
=
1
;
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
,
missionManager
.
getMissionInfos
(
""
,
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRunningAbility
MissionInfos error.code :
\
console
.
info
(
'
Acts_Ams_test_2000 get
MissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_2200 queryRecentAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8700
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_8700
'
,
0
,
async
function
(
done
)
{
abilityManager
.
getActiveProcessInfos
(
(
error
,
info
)
=>
{
console
.
info
(
'
getActiveProcessInfos error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_8700 getActiveProcessInfos data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9700
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_9700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getActiveAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_9700 getActiveAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2000 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10700
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_10700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getPreviousAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_10700 getPreviousAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
...
...
@@ -388,17 +177,20 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2400
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it
(
'
Acts_Ams_test_2400
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMission
(
result
[
1
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2400 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
1
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_2400
remove
Mission error.code
\
console
.
info
(
'
Acts_Ams_test_2400
clear
Mission error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -406,17 +198,20 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2800
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it
(
'
Acts_Ams_test_2800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2800 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_2800 moveMissionTo
Top
error.code
\
console
.
info
(
'
Acts_Ams_test_2800 moveMissionTo
Front
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
...
...
@@ -428,7 +223,7 @@ describe('ActsAmsCallBackSecondScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it
(
'
Acts_Ams_test_3200
'
,
0
,
async
function
(
done
)
{
a
bility
Manager
.
killProcessesByBundleName
(
'
XXXXXXXXXXXX
'
,
a
pp
Manager
.
killProcessesByBundleName
(
'
XXXXXXXXXXXX
'
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_3200 killProcessesByBundleName error.code:
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
...
...
@@ -440,22 +235,22 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_3000
* @tc.name :
remove
Missions: Remove Missions
* @tc.name :
clear
Missions: Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_3000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMissions
([
result
[
0
].
id
],
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3000 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_3000
removeMissions
error.code
\
console
.
info
(
'
Acts_Ams_test_3000
clearMission
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,22 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -52,16 +41,20 @@ describe('ActsAmsCallBackThirdScene', function () {
console
.
info
(
'
----ActsAmsCallBackThirdScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsCallBackThirdScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamscallbackthirdscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamscallbackthirdscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamscallbackthirdscene
'
)
{
console
.
log
(
"
ActsAmsCallBackThirdScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsCallBackThirdScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -73,8 +66,12 @@ describe('ActsAmsCallBackThirdScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -86,7 +83,10 @@ describe('ActsAmsCallBackThirdScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -98,53 +98,41 @@ describe('ActsAmsCallBackThirdScene', function () {
}
function
sleep
(
delay
)
{
var
startTime
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_3400
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_3400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
a
bilityManager
.
getAllRunningProcesse
s
(
a
ppManager
.
getProcessRunningInfo
s
(
(
error
,
info
)
=>
{
console
.
info
(
'
getAllRunningProcesse
s error.code
\
console
.
info
(
'
Acts_Ams_test_3400 getProcessRunningInfo
s error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_3400 getAllRunningProcesses data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3400 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
});
...
...
@@ -153,231 +141,33 @@ describe('ActsAmsCallBackThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3600
* @tc.name :
queryRunningAbility
MissionInfos : Query Running Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_3600
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_3600 queryRunningAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_3800
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_3800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
flag
=
2
;
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRunningAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_3800 queryRecentAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8800
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it
(
'
Acts_Ams_test_8800
'
,
0
,
async
function
(
done
)
{
abilityManager
.
getActiveProcessInfos
(
(
error
,
info
)
=>
{
console
.
info
(
'
getActiveProcessInfos error.code
\
'
+
error
.
code
+
'
, data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_8800 getActiveProcessInfos data
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9800
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_9800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getActiveAbilityMissionInfos
(
maxnum
,
missionManager
.
getMissionInfos
(
""
,
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbility
MissionInfos error.code :
\
console
.
info
(
'
Acts_Ams_test_3600 get
MissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_9800 getActiveAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3600 getMissionInfos info[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
});
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10800
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it
(
'
Acts_Ams_test_10800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
abilityManager
.
getPreviousAbilityMissionInfos
(
maxnum
,
(
error
,
info
)
=>
{
console
.
info
(
'
queryRecentAbilityMissionInfos error.code :
\
'
+
error
.
code
+
'
,data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_10800 getPreviousAbilityMissionInfos info
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
info
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
info
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
info
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
});
...
...
@@ -386,55 +176,68 @@ describe('ActsAmsCallBackThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_4000
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it
(
'
Acts_Ams_test_4000
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
removeMission
(
result
[
1
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_4000 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
1
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_4000
remove
Mission error.code
\
console
.
info
(
'
Acts_Ams_test_4000
clear
Mission error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_4400
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it
(
'
Acts_Ams_test_4400
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
,
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_4400 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_4400 moveMissionTo
Top
error.code
\
console
.
info
(
'
Acts_Ams_test_4400 moveMissionTo
Front
error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_11800
* @tc.name :
delete
Missions : delete Missions
* @tc.name :
clear
Missions : delete Missions
* @tc.desc : delete Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_11800
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
abilityManager
.
deleteMissions
([
result
[
0
].
id
],
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_11800 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
missionManager
.
clearMission
(
result
[
0
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_11800
delete
Missions error.code
\
console
.
info
(
'
Acts_Ams_test_11800
clear
Missions error.code
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
expect
(
error
.
code
).
assertEqual
(
0
);
done
();
});
}
);
done
();
setTimeout
(
timeout
,
5000
);
})
...
...
@@ -444,15 +247,15 @@ describe('ActsAmsCallBackThirdScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it
(
'
Acts_Ams_test_4800
'
,
0
,
async
function
(
done
)
{
a
bility
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxxxx
'
,
a
pp
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxxxx
'
,
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_4800 killProcessesByBundleName error.code:
\
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
2097215
);
expect
(
error
.
code
).
assertEqual
(
2097215
);
done
();
});
}
);
done
();
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json
浏览文件 @
9820d875
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
30
0000"
,
"package"
:
"com.example.actsamstestfifthscene"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,30 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
"
com.example.SimulateFeatureAbilityFir
"
,
"
com.example.VerifyIoThirdAbility
"
,
"
com.example.actsamstestfifthscene.MainAbility
"
,
"
com.example.SimulateFeatureAbilitySed
"
"
com.example.actsamstestfifthscene.MainAbility
"
]
var
bundleNameList
=
[
...
...
@@ -47,24 +33,25 @@ var bundleNameList = [
"
com.ohos.telephonydataability
"
,
"
com.ohos.contactsdataability
"
,
"
com.ix.simulate.feature
"
,
"
com.example.actsamstestfifthscene
"
,
"
com.ix.verify.io
"
"
com.example.actsamstestfifthscene
"
]
describe
(
'
ActsAmsTestFifthScene
'
,
function
()
{
console
.
info
(
'
----ActsAmsTestFifthScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsTestFifthScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamstestfifthscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamstestfifthscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
}
console
.
log
(
"
ActsAmsTestFifthScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsTestFifthScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -81,8 +68,12 @@ describe('ActsAmsTestFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -99,8 +90,12 @@ describe('ActsAmsTestFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -117,7 +112,10 @@ describe('ActsAmsTestFifthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -129,314 +127,127 @@ describe('ActsAmsTestFifthScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_65
00
* @tc.name : getAllRunningProcesse
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_
65
00
'
,
0
,
async
function
(
done
)
{
* @tc.number : Acts_Ams_test_01
00
* @tc.name : getProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_
01
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
var
info
=
await
abilityManager
.
getAllRunningProcesses
();
console
.
info
(
'
getAllRunningProcesses data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_6500 getAllRunningProcesses JSON String:
'
+
JSON
.
stringify
(
info
));
var
info
=
await
appManager
.
getProcessRunningInfos
();
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0100 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_75
00
* @tc.name : moveMissionToTop
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_
75
00
'
,
0
,
async
function
(
done
)
{
* @tc.number : Acts_Ams_test_11
00
* @tc.name : moveMissionToFront
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_
11
00
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
moveMissionToTop
(
result
[
1
].
id
);
console
.
info
(
'
Acts_Ams_test_7500 moveMissionToTop data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
).
catch
(
err
=>
{
console
.
log
(
'
Acts_Ams_test_1100 getMissionInfos failed:
'
+
err
);
});
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1100 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_1100 moveMissionToFront data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
sleep
(
1000
);
var
ret
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
expect
(
result
[
1
].
baseAbility
.
bundleName
).
assertEqual
(
ret
[
0
].
baseAbility
.
bundleName
);
expect
(
result
[
1
].
topAbility
.
bundleName
).
assertEqual
(
ret
[
0
].
topAbility
.
bundleName
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_69
00
* @tc.name : queryRecentAbilityMissionInfos : Query Recent
Ability Mission Infos
* @tc.desc : Query Recent
Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_
69
00
'
,
0
,
async
function
(
done
)
{
* @tc.number : Acts_Ams_test_03
00
* @tc.name : getMissionInfos : Query Running
Ability Mission Infos
* @tc.desc : Query Running
Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_
03
00
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
info
(
'
queryRecentAbilityMissionInfos data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_
6900 queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
).
catch
(
err
=>
{
console
.
log
(
'
Acts_Ams_test_0300 getMissionInfos failed:
'
+
err
);
}
);
console
.
info
(
'
Acts_Ams_test_
0300 getMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8500
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_8500
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
getActiveProcessInfos
();
console
.
info
(
'
Acts_Ams_test_8500 getActiveProcessInfos JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9500
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_9500
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getActiveAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_9500 getActiveAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0300 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10500
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_10500
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getPreviousAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_10500 getPreviousAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
* @tc.number : Acts_Ams_test_0700
* @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it
(
'
Acts_Ams_test_0700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
).
catch
(
err
=>
{
console
.
log
(
'
Acts_Ams_test_0700 getMissionInfos failed:
'
+
err
);
});
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0700 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_6700
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_6700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
data
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
console
.
info
(
'
queryRunningAbilityMissionInfos data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_6700 queryRunningAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_11500
* @tc.name : deleteMissions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it
(
'
Acts_Ams_test_11500
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
deleteMissions
([
result
[
1
].
id
]);
console
.
info
(
'
Acts_Ams_test_11500 deleteMissions data [
'
+
info
+
'
]
'
);
var
info
=
await
missionManager
.
clearMission
(
result
[
1
].
missionId
);
console
.
info
(
'
Acts_Ams_test_0700 clearMission data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_7900
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_7900
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
killProcessesByBundleName
(
'
com.ix.verify.io
'
);
console
.
info
(
'
Acts_Ams_test_7900 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
* @tc.number : Acts_Ams_test_1500
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_1500
'
,
0
,
async
function
(
done
)
{
var
info
=
await
appManager
.
killProcessesByBundleName
(
'
com.ix.simulate.feature
'
);
console
.
info
(
'
Acts_Ams_test_1500 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json
浏览文件 @
9820d875
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
30
0000"
,
"package"
:
"com.example.actsamstestfirstscene"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -52,14 +40,17 @@ describe('ActsAmsTestFirstScene', function () {
console
.
info
(
'
----ActsAmsTestFirstScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsTestFirstScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamstestfirstscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamstestfirstscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamstestfirstscene
'
)
{
console
.
log
(
"
ActsAmsTestFirstScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsTestFirstScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
...
...
@@ -78,7 +69,10 @@ describe('ActsAmsTestFirstScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -90,65 +84,57 @@ describe('ActsAmsTestFirstScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_0100
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
var
info
=
await
abilityManager
.
getAllRunningProcesses
();
console
.
info
(
'
Acts_Ams_test_0100 getAllRunningProcesses JSON String:
'
+
JSON
.
stringify
(
info
));
var
info
=
await
appManager
.
getProcessRunningInfos
();
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0100 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_1100
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_1100
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_1100 moveMissionToTop data [
'
+
info
+
'
]
'
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0100 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_1100 moveMissionToFront data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -156,209 +142,30 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0300
* @tc.name :
queryRunningAbility
MissionInfos : Query Running Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_0300
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
data
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
console
.
info
(
'
Acts_Ams_test_0300 queryRunningAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_0500
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_0500
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
info
(
'
Acts_Ams_test_0500 queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8100
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_8100
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
getActiveProcessInfos
();
console
.
info
(
'
Acts_Ams_test_8100 getActiveProcessInfos JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9100
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_9100
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getActiveAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_9100 getActiveAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0300 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10100
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_10100
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getPreviousAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_10100 getPreviousAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
2
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -366,14 +173,17 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0700
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it
(
'
Acts_Ams_test_0700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMission
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_0700 removeMission data [
'
+
info
+
'
]
'
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_0700 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
clearMission
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_0700 clearMission data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -381,16 +191,19 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_11100
* @tc.name :
delete
Missions: delete Missions
* @tc.name :
clear
Missions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it
(
'
Acts_Ams_test_11100
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_11100 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
expect
(
result
.
length
).
assertEqual
(
1
);
var
missionID
=
result
[
0
].
i
d
+
1
;
var
info
=
await
abilityManager
.
deleteMissions
([
missionID
]
);
console
.
info
(
'
Acts_Ams_test_11100
delete
Missions data [
'
+
info
+
'
]
'
);
var
missionID
=
result
[
0
].
missionI
d
+
1
;
var
info
=
await
missionManager
.
clearMission
(
missionID
);
console
.
info
(
'
Acts_Ams_test_11100
clear
Missions data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertLarger
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -402,10 +215,10 @@ describe('ActsAmsTestFirstScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_1500
'
,
0
,
async
function
(
done
)
{
var
info
=
await
a
bility
Manager
.
killProcessesByBundleName
(
'
com.ix.simulate.feature
'
);
var
info
=
await
a
pp
Manager
.
killProcessesByBundleName
(
'
com.ix.simulate.feature
'
);
console
.
info
(
'
Acts_Ams_test_1500 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json
浏览文件 @
9820d875
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
30
0000"
,
"package"
:
"com.example.actsamstestfourthscene"
,
"shell-timeout"
:
"60000"
},
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,31 +12,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
"
com.example.SimulateFeatureAbilityFir
"
,
"
com.example.VerifyActThirdAbility
"
,
"
com.example.VerifyIoThirdAbility
"
,
"
com.example.actsamstestfourthscene.MainAbility
"
,
"
com.example.
SimulateEntryAbilityFir
"
"
com.example.
VerifyIoThirdAbility
"
]
var
bundleNameList
=
[
...
...
@@ -48,25 +34,28 @@ var bundleNameList = [
"
com.ohos.telephonydataability
"
,
"
com.ohos.contactsdataability
"
,
"
com.ix.simulate.feature
"
,
"
com.ix.verify.io
"
,
"
com.ix.simulate.entry
"
,
"
com.example.actsamstestfourthscene
"
,
"
com.ix.verify.
act
"
"
com.ix.verify.
io
"
]
describe
(
'
ActsAmsTestFourthScene
'
,
function
()
{
console
.
info
(
'
----ActsAmsTestFourthScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsTestFourthScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamstestfourthscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamstestfourthscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamstestfourthscene
'
)
{
console
.
log
(
"
ActsAmsTestFourthScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsTestFourthScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -83,8 +72,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -101,8 +94,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -119,8 +116,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFourthScene VerifyActThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -137,7 +138,10 @@ describe('ActsAmsTestFourthScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestFourthScene SimulateEntryAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -149,67 +153,28 @@ describe('ActsAmsTestFourthScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_
49
00
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.number : Acts_Ams_test_
17
00
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_
49
00
'
,
0
,
async
function
(
done
)
{
it
(
'
Acts_Ams_test_
17
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
var
info
=
await
abilityManager
.
getAllRunningProcesses
();
console
.
info
(
'
getAllRunningProcesses data length [
'
+
info
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_4900 getAllRunningProcesses JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8400
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_8400
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
getActiveProcessInfos
();
console
.
info
(
'
Acts_Ams_test_8400 getActiveProcessInfos JSON String:
'
+
JSON
.
stringify
(
info
));
var
info
=
await
appManager
.
getProcessRunningInfos
();
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1700 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
...
...
@@ -226,205 +191,33 @@ describe('ActsAmsTestFourthScene', function () {
})
/*
* @tc.number : Acts_Ams_test_
53
00
* @tc.name :
queryRecentAbility
MissionInfos : Query Recent Ability Mission Infos
* @tc.number : Acts_Ams_test_
21
00
* @tc.name :
get
MissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_
53
00
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
10
0
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
info
(
'
queryRecentAbilityMissionInfos
data length [
'
+
data
.
length
+
'
]
'
);
it
(
'
Acts_Ams_test_
21
00
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
2
0
;
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
)
;
console
.
info
(
'
Acts_Ams_test_2100 getMissionInfos error.code :
\
'
+
error
.
code
+
'
,
data length [
'
+
data
.
length
+
'
]
'
);
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5300 queryRecentAbilityMissionInfos id:
\
'
+
data
[
i
].
id
+
'
baseAbility.deviceId:
\
'
+
data
[
i
].
baseAbility
.
deviceId
+
'
baseAbility.bundleName:
\
'
+
data
[
i
].
baseAbility
.
bundleName
+
'
baseAbility.abilityName:
\
'
+
data
[
i
].
baseAbility
.
abilityName
+
'
topAbility.deviceId:
\
'
+
data
[
i
].
topAbility
.
deviceId
+
'
topAbility.bundleName:
\
'
+
data
[
i
].
topAbility
.
bundleName
+
'
topAbility.abilityName:
\
'
+
data
[
i
].
topAbility
.
abilityName
+
'
missionDescription.label:
\
'
+
data
[
i
].
missionDescription
.
label
+
'
missionDescription.iconPath:
\
'
+
data
[
i
].
missionDescription
.
iconPath
);
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_5100
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_5100
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
data
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
console
.
info
(
'
queryRunningAbilityMissionInfos data length [
'
+
data
.
length
+
'
]
'
);
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5100 queryRunningAbilityMissionInfos id:
\
'
+
data
[
i
].
id
+
'
baseAbility.deviceId:
\
'
+
data
[
i
].
baseAbility
.
deviceId
+
'
baseAbility.bundleName:
\
'
+
data
[
i
].
baseAbility
.
bundleName
+
'
baseAbility.abilityName:
\
'
+
data
[
i
].
baseAbility
.
abilityName
+
'
topAbility.deviceId:
\
'
+
data
[
i
].
topAbility
.
deviceId
+
'
topAbility.bundleName:
\
'
+
data
[
i
].
topAbility
.
bundleName
+
'
topAbility.abilityName:
\
'
+
data
[
i
].
topAbility
.
abilityName
+
'
missionDescription.label:
\
'
+
data
[
i
].
missionDescription
.
label
+
'
missionDescription.iconPath:
\
'
+
data
[
i
].
missionDescription
.
iconPath
);
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9400
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_9400
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getActiveAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_9400 getActiveAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
expect
(
data
.
length
).
assertEqual
(
5
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2100 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10400
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_10400
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getPreviousAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_10400 getPreviousAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
4
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -437,9 +230,11 @@ describe('ActsAmsTestFourthScene', function () {
*/
it
(
'
Acts_Ams_test_5500
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMission
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_5500 removeMission data [
'
+
info
+
'
]
'
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5500 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
abilityManager
.
clearMission
(
result
[
0
].
id
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
done
();
...
...
@@ -448,31 +243,35 @@ describe('ActsAmsTestFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5900
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_5900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_5900 moveMissionToTop data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
var
maxnum
=
20
;
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_5900 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_5900 moveMissionToFront data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_
6
100
* @tc.name :
removeMissions: Remove Missions
* @tc.desc : Remove Mission
s
(by Promise)
* @tc.number : Acts_Ams_test_
2
100
* @tc.name :
clearMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it
(
'
Acts_Ams_test_6100
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
30
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMissions
([
result
[
0
].
id
,
result
[
1
].
id
]);
console
.
info
(
'
Acts_Ams_test_6100 removeMissions data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
var
maxnum
=
20
;
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_6100 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
clearAllMissions
();
console
.
info
(
'
Acts_Ams_test_6100 clearAllMissions data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -484,7 +283,7 @@ describe('ActsAmsTestFourthScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_6300
'
,
0
,
async
function
(
done
)
{
var
info
=
await
a
bility
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxxxxx
'
);
var
info
=
await
a
pp
Manager
.
killProcessesByBundleName
(
'
xxxxxxxxxxxx
'
);
console
.
info
(
'
Acts_Ams_test_6300 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
2097215
);
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json
浏览文件 @
9820d875
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
30
0000"
,
"package"
:
"com.example.actsamstestsecondscene"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -54,16 +42,20 @@ describe('ActsAmsTestSecondScene', function () {
console
.
info
(
'
----ActsAmsTestSecondScene----
'
);
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsTestSecondScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamstestsecondscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamstestsecondscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamstestsecondscene
'
)
{
console
.
log
(
"
ActsAmsTestSecondScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsTestSecondScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -80,8 +72,12 @@ describe('ActsAmsTestSecondScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -98,7 +94,10 @@ describe('ActsAmsTestSecondScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -110,50 +109,39 @@ describe('ActsAmsTestSecondScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_1700
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_1700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
var
info
=
await
a
bilityManager
.
getAllRunningProcesse
s
();
console
.
info
(
'
Acts_Ams_test_1700 get
AllRunningProcesse
s JSON String:
'
+
JSON
.
stringify
(
info
));
var
info
=
await
a
ppManager
.
getProcessRunningInfo
s
();
console
.
info
(
'
Acts_Ams_test_1700 get
ProcessRunningInfo
s JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1700 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -161,14 +149,17 @@ describe('ActsAmsTestSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2700
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_2700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_2700 moveMissionToTop data [
'
+
info
+
'
]
'
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2700 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_2700 moveMissionToFront data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -176,240 +167,49 @@ describe('ActsAmsTestSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_1900
* @tc.name :
queryRunningAbility
MissionInfos : Query Running Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_1900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
data
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
console
.
info
(
'
queryRunningAbilityMissionInfos data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_1900 queryRunningAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_2100
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_2100
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
info
(
'
queryRecentAbilityMissionInfos data length [
'
+
data
.
length
+
'
]
'
);
console
.
info
(
'
Acts_Ams_test_2100 queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8200
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_8200
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
getActiveProcessInfos
();
console
.
info
(
'
Acts_Ams_test_8200 getActiveProcessInfos JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9200
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_9200
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getActiveAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_9200 getActiveAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
info
(
'
Acts_Ams_test_1900 getMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_1900 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10200
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_10200
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getPreviousAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_10200 getPreviousAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_11200
* @tc.name : deleteMissions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it
(
'
Acts_Ams_test_11200
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
deleteMissions
([
result
[
0
].
id
]);
console
.
info
(
'
Acts_Ams_test_11200 deleteMissions data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_2100
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it
(
'
Acts_Ams_test_2300
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMission
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_2300 removeMission data [
'
+
info
+
'
]
'
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_2300 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
clearMission
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_2300 clearMission data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -421,11 +221,10 @@ describe('ActsAmsTestSecondScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_3100
'
,
0
,
async
function
(
done
)
{
var
info
=
await
a
bility
Manager
.
killProcessesByBundleName
(
'
XXXXXXXXXXXX
'
);
var
info
=
await
a
pp
Manager
.
killProcessesByBundleName
(
'
XXXXXXXXXXXX
'
);
console
.
info
(
'
Acts_Ams_test_3100 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
2097215
);
done
();
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json
浏览文件 @
9820d875
...
...
@@ -2,7 +2,7 @@
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
30
0000"
,
"package"
:
"com.example.actsamstestthirdscene"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
浏览文件 @
9820d875
...
...
@@ -39,6 +39,7 @@ export default {
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
this
.
timeout
=
10000
require
(
'
../../../test/List.test
'
)
core
.
execute
()
...
...
aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
featureAbility
from
'
@ohos.ability.featureability
'
import
missionManager
from
'
@ohos.application.missionManager
'
import
appManager
from
"
@ohos.application.appManager
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
WeightReasonCode
=
{
REASON_UNKNOWN
:
0
,
WEIGHT_FOREGROUND
:
100
,
WEIGHT_FOREGROUND_SERVICE
:
125
,
WEIGHT_VISIBLE
:
200
,
WEIGHT_PERCEPTIBLE
:
230
,
WEIGHT_SERVICE
:
300
,
WEIGHT_TOP_SLEEPING
:
325
,
WEIGHT_CANT_SAVE_STATE
:
350
,
WEIGHT_CACHED
:
400
,
WEIGHT_GONE
:
1000
}
var
abilityNameList
=
[
"
com.ohos.launcher.MainAbility
"
,
"
com.ohos.callui.ServiceAbility
"
,
...
...
@@ -54,16 +42,20 @@ describe('ActsAmsTestThirdScene', function () {
beforeAll
(
async
function
(
done
)
{
var
maxnum
=
10
;
var
flag
=
1
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
log
(
'
queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
log
(
'
ActsAmsTestThirdScene beforeAll getMissionInfos data:
'
+
JSON
.
stringify
(
data
));
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
baseAbility
.
bundleName
!=
'
com.example.actsamstestthirdscene
'
&&
data
[
i
].
topAbility
.
bundleName
!=
'
com.example.actsamstestthirdscene
'
)
{
var
info
=
abilityManager
.
removeMission
(
data
[
i
].
id
);
console
.
log
(
'
removeMission data [
'
+
info
+
'
]
'
);
if
(
data
[
i
].
want
.
bundleName
!=
'
com.example.actsamstestthirdscene
'
)
{
console
.
log
(
"
ActsAmsTestThirdScene, missionId:
"
+
data
[
i
].
missionId
)
missionManager
.
clearMission
(
data
[
i
].
missionId
,
(
error
,
info
)
=>
{
console
.
info
(
'
ActsAmsTestThirdScene beforeAll clearMission error.code
\
'
+
error
.
code
+
'
, want.bundleName:
'
+
data
[
i
].
want
.
bundleName
);
}
);
}
}
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -80,8 +72,12 @@ describe('ActsAmsTestThirdScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
await
featureAbility
.
startAbility
(
{
want
:
...
...
@@ -98,7 +94,10 @@ describe('ActsAmsTestThirdScene', function () {
parameters
:
{},
},
},
},
(
error
,
data
)
=>
{
console
.
info
(
'
ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code
\
'
+
error
.
code
+
'
, data length [
'
+
data
.
length
+
'
]
'
);
}
);
setTimeout
(
done
(),
5000
);
});
...
...
@@ -110,92 +109,39 @@ describe('ActsAmsTestThirdScene', function () {
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
endTime
=
(
new
Date
()).
getTime
();
for
(
let
index
=
1
;
index
>
0
;
index
++
)
{
if
(
endTime
-
startTime
>
delay
)
{
break
;
}
else
{
endTime
=
(
new
Date
()).
getTime
();
}
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
delay
)
{
break
;
}
}
}
/*
* @tc.number : Acts_Ams_test_3300
* @tc.name : get
AllRunningProcesse
s : Get All Running Processes Info
* @tc.name : get
ProcessRunningInfo
s : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_3300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
sleep begin
"
);
sleep
(
5000
);
console
.
info
(
"
sleep end
"
);
var
info
=
await
a
bilityManager
.
getAllRunningProcesse
s
();
console
.
info
(
'
Acts_Ams_test_3300 get
AllRunningProcesse
s JSON String:
'
+
JSON
.
stringify
(
info
));
var
info
=
await
a
ppManager
.
getProcessRunningInfo
s
();
console
.
info
(
'
Acts_Ams_test_3300 get
ProcessRunningInfo
s JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3300 getProcessRunningInfo[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
info
[
i
]));
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
pkgList
)).
assertEqual
(
true
);
expect
(
info
[
i
].
pkgList
.
length
).
assertEqual
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
lastMemoryLevel
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
lastMemoryLevel
).
assertEqual
(
1
);
expect
(
typeof
(
info
[
i
].
weight
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weight
).
assertEqual
(
-
1
);
expect
(
typeof
(
info
[
i
].
weightReasonCode
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
weightReasonCode
).
assertEqual
(
WeightReasonCode
.
REASON_UNKNOWN
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_3500
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_3500
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
data
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
console
.
info
(
'
Acts_Ams_test_3500 queryRunningAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -203,166 +149,31 @@ describe('ActsAmsTestThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3700
* @tc.name :
queryRecentAbility
MissionInfos : Query Recent Ability Mission Infos
* @tc.name :
get
MissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_3700
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
flag
=
2
;
var
data
=
await
abilityManager
.
queryRecentAbilityMissionInfos
(
maxnum
,
flag
);
console
.
info
(
'
Acts_Ams_test_3700 queryRecentAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
id
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
id
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
baseAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
baseAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
baseAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
baseAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
missionDescription
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
missionDescription
.
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_8300
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it
(
'
Acts_Ams_test_8300
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
getActiveProcessInfos
();
console
.
info
(
'
Acts_Ams_test_8300 getActiveProcessInfos JSON String:
'
+
JSON
.
stringify
(
info
));
expect
(
Array
.
isArray
(
info
)).
assertEqual
(
true
);
expect
(
info
.
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
info
.
length
;
i
++
)
{
expect
(
typeof
(
info
[
i
].
pid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
pid
).
assertLarger
(
0
);
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_9300
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_9300
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getActiveAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_9300 getActiveAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
var
data
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
console
.
info
(
'
Acts_Ams_test_3700 getMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3700 getMissionInfos data[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
data
[
i
]));
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
}
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_10300
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it
(
'
Acts_Ams_test_10300
'
,
0
,
async
function
(
done
)
{
var
upperLimit
=
20
;
var
data
=
await
abilityManager
.
getPreviousAbilityMissionInfos
(
upperLimit
);
console
.
info
(
'
Acts_Ams_test_10300 getPreviousAbilityMissionInfos data
'
+
JSON
.
stringify
(
data
));
expect
(
Array
.
isArray
(
data
)).
assertEqual
(
true
);
expect
(
data
.
length
).
assertEqual
(
3
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
typeof
(
data
[
i
].
missionId
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
missionId
).
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
deviceId
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
bottomAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
bottomAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
bottomAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
topAbility
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
topAbility
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
topAbility
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
topAbility
.
uri
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
uri
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
topAbility
.
shortName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
topAbility
.
shortName
.
length
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
windowMode
)).
assertEqual
(
"
number
"
);
expect
(
data
[
i
].
windowMode
).
assertEqual
(
0
);
expect
(
typeof
(
data
[
i
].
want
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
[
i
].
want
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
want
.
bundleName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
bundleName
.
length
).
assertLarger
(
0
);
expect
(
bundleNameList
.
indexOf
(
data
[
i
].
want
.
bundleName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
want
.
abilityName
)).
assertEqual
(
"
string
"
);
expect
(
data
[
i
].
want
.
abilityName
.
length
).
assertLarger
(
0
);
expect
(
abilityNameList
.
indexOf
(
data
[
i
].
want
.
abilityName
)).
assertLarger
(
-
1
);
expect
(
typeof
(
data
[
i
].
label
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
[
i
].
iconPath
)).
assertEqual
(
"
string
"
);
}
done
();
setTimeout
(
timeout
,
5000
);
...
...
@@ -370,45 +181,54 @@ describe('ActsAmsTestThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3900
* @tc.name :
remove
Mission : Remove Mission
* @tc.name :
clear
Mission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it
(
'
Acts_Ams_test_3900
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMission
(
result
[
1
].
id
);
console
.
info
(
'
Acts_Ams_test_3900 removeMission data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_3900 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
clearMission
(
result
[
1
].
missionId
);
console
.
info
(
'
Acts_Ams_test_3900 clearMission data [
'
+
info
+
'
]
'
);
expect
(
info
.
code
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_4300
* @tc.name : moveMissionTo
Top
: Move Mission To Top
* @tc.name : moveMissionTo
Front
: Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it
(
'
Acts_Ams_test_4300
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
moveMissionToTop
(
result
[
0
].
id
);
console
.
info
(
'
Acts_Ams_test_4300 moveMissionToTop data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_4300 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
moveMissionToFront
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_4300 moveMissionToFront data [
'
+
info
+
'
]
'
);
expect
(
info
.
code
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
/*
* @tc.number : Acts_Ams_test_4500
* @tc.name :
remove
Missions: Remove Missions
* @tc.name :
clear
Missions: Remove Missions
* @tc.desc : Remove Missions(by Promise)
*/
it
(
'
Acts_Ams_test_4500
'
,
0
,
async
function
(
done
)
{
var
maxnum
=
20
;
var
result
=
await
abilityManager
.
queryRunningAbilityMissionInfos
(
maxnum
);
var
info
=
await
abilityManager
.
removeMissions
([
result
[
0
].
id
]);
console
.
info
(
'
Acts_Ams_test_4500 removeMissions data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
0
);
var
result
=
await
missionManager
.
getMissionInfos
(
""
,
maxnum
);
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
console
.
info
(
'
Acts_Ams_test_4500 getMissionInfos result[
'
+
i
+
"
]:
"
+
JSON
.
stringify
(
result
[
i
]));
}
var
info
=
await
missionManager
.
clearMission
(
result
[
0
].
missionId
);
console
.
info
(
'
Acts_Ams_test_4500 clearMission data [
'
+
info
+
'
]
'
);
expect
(
info
.
code
).
assertEqual
(
0
);
done
();
setTimeout
(
timeout
,
5000
);
})
...
...
@@ -419,11 +239,10 @@ describe('ActsAmsTestThirdScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it
(
'
Acts_Ams_test_4700
'
,
0
,
async
function
(
done
)
{
var
info
=
await
a
bility
Manager
.
killProcessesByBundleName
(
'
XXXXXXXX
'
);
var
info
=
await
a
pp
Manager
.
killProcessesByBundleName
(
'
XXXXXXXX
'
);
console
.
info
(
'
Acts_Ams_test_4700 killProcessesByBundleName data [
'
+
info
+
'
]
'
);
expect
(
info
).
assertEqual
(
2097215
);
expect
(
info
.
code
).
assertEqual
(
2097215
);
done
();
setTimeout
(
timeout
,
5000
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json
浏览文件 @
9820d875
...
...
@@ -3,7 +3,7 @@
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"120000"
,
"package"
:
"com.
ohos.launcher
"
,
"package"
:
"com.
example.myapplication11
"
,
"abilityName"
:
"com.ohos.launcherSed11.MainAbility"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json
浏览文件 @
9820d875
{
"app"
:
{
"bundleName"
:
"com.
ohos.launcher
"
,
"bundleName"
:
"com.
example.myapplication11
"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1000000
,
...
...
aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.ability
Manager
'
import
missionManager
from
'
@ohos.application.mission
Manager
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsAmsCallBackSixth Scene
'
,
function
()
{
...
...
@@ -51,7 +51,7 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by CallBack)
*/
it
(
'
Acts_Ams_test_12200
'
,
0
,
async
function
(
done
)
{
abilityManager
.
clear
Missions
(
missionManager
.
clearAll
Missions
(
(
error
,
info
)
=>
{
console
.
info
(
'
Acts_Ams_test_12200 clearMissions error.code
'
+
error
.
code
+
'
,data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
...
...
@@ -59,4 +59,4 @@ describe('ActsAmsCallBackSixth Scene', function () {
});
done
();
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json
浏览文件 @
9820d875
...
...
@@ -3,7 +3,7 @@
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"120000"
,
"package"
:
"com.
ohos.launcher
"
,
"package"
:
"com.
example.myapplication111
"
,
"abilityName"
:
"com.ohos.launcherSed111.MainAbility"
,
"shell-timeout"
:
"600000"
},
...
...
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json
浏览文件 @
9820d875
{
"app"
:
{
"bundleName"
:
"com.
ohos.launcher
"
,
"bundleName"
:
"com.
example.myapplication111
"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1000000
,
...
...
aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
9820d875
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.ability
Manager
'
import
missionManager
from
'
@ohos.application.mission
Manager
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsAmsCallBackSixth Scene
'
,
function
()
{
...
...
@@ -51,10 +51,10 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by Promise)
*/
it
(
'
Acts_Ams_test_12100
'
,
0
,
async
function
(
done
)
{
var
info
=
await
abilityManager
.
clear
Missions
();
var
info
=
await
missionManager
.
clearAll
Missions
();
console
.
info
(
'
Acts_Ams_test_12100 clearMissions data [
'
+
info
+
'
]
'
);
expect
(
typeof
(
info
)).
assertEqual
(
"
number
"
);
expect
(
info
).
assertEqual
(
0
);
done
();
})
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录