Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
eb382a27
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看板
未验证
提交
eb382a27
编写于
4月 02, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2945 XTS代码整改
Merge pull request !2945 from ry/master
上级
940d85e8
e753c461
变更
10
展开全部
显示空白变更内容
内联
并排
Showing
10 changed file
with
860 addition
and
2875 deletion
+860
-2875
appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
...est/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
+177
-297
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsCleanCacheTest.test.js
...test/entry/src/main/js/test/ActsBmsCleanCacheTest.test.js
+0
-163
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js
...stest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js
+0
-1307
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
.../entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
+87
-161
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
.../entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
+156
-54
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/List.test.js
...r/actsbmsgetinfostest/entry/src/main/js/test/List.test.js
+1
-3
appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
...etest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
+188
-197
appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
...ctsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
+228
-151
appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
.../entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
+23
-43
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
...emanagertest/entry/src/main/js/test/ExampleJsunit.test.js
+0
-499
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
浏览文件 @
eb382a27
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsCleanCacheTest.test.js
已删除
100644 → 0
浏览文件 @
940d85e8
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
bundle
from
'
@ohos.bundle
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
const
BUNDLE_PATH1
=
'
/data/test/bmsThirdBundleTest1.hap
'
;
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
describe
(
'
ActsCleancache
'
,
function
()
{
/*
* @tc.number: bms_cleancache_0200
* @tc.name: cleancache callback by other callback
* @tc.desc: 1.cleancache callback
* 2.cleancache for right input
*/
it
(
'
bms_cleancache_0100
'
,
0
,
async
function
(
done
){
console
.
info
(
'
=====================bms_cleancache_0100==================
'
);
let
bundlePath
=
[
BUNDLE_PATH1
]
bundle
.
getBundleInstaller
().
then
(
installer
=>
{
function
onReceiveinstallEvent
(
err
,
data
)
{
console
.
log
(
'
bms_cleancache_0100 install called:
'
+
data
)
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
bundle
.
cleanBundleCacheFiles
(
'
com.example.third1
'
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
bms_cleancache_0100 test query system app err is
'
+
err
)
expect
(
err
).
assertEqual
(
1
);
}
expect
(
err
).
assertEqual
(
undefined
);
installer
.
uninstall
(
BUNDLE_NAME1
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
}
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
done
();
});
}
)
}
installer
.
install
([
'
/data/test/bmsThirdBundleTest1.hap
'
],
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
,
},
onReceiveinstallEvent
);
})
})
/*
* @tc.number: bms_cleancache_0200
* @tc.name: cleancache callback by other callback
* @tc.desc: 1.cleancache callback
* 2.cleancache for null input
*/
it
(
'
bms_cleancache_0200
'
,
0
,
async
function
(
done
){
console
.
info
(
'
=====================bms_cleancache_0100==================
'
);
let
bundlePath
=
[
BUNDLE_PATH1
]
bundle
.
getBundleInstaller
().
then
(
installer
=>
{
function
onReceiveinstallEvent
(
err
,
data
)
{
console
.
log
(
'
bms_cleancache_0100 install called:
'
+
data
)
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
bundle
.
cleanBundleCacheFiles
(
null
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
bms_cleancache_0200 test query system app err is
'
+
err
)
expect
(
err
).
assertEqual
(
2
);
}
installer
.
uninstall
(
BUNDLE_NAME1
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
}
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
done
();
});
}
)
}
installer
.
install
([
'
/data/test/bmsThirdBundleTest1.hap
'
],
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
,
},
onReceiveinstallEvent
);
})
})
/*
* @tc.number: bms_cleancache_0300
* @tc.name: cleancache callback by other callback
* @tc.desc: 1.cleancache callback
* 2.cleancache for wrong input
*/
it
(
'
bms_cleancache_0300
'
,
0
,
async
function
(
done
){
console
.
info
(
'
=====================bms_cleancache_0100==================
'
);
let
bundlePath
=
[
BUNDLE_PATH1
]
bundle
.
getBundleInstaller
().
then
(
installer
=>
{
function
onReceiveinstallEvent
(
err
,
data
)
{
console
.
log
(
'
bms_cleancache_0300 install called:
'
+
data
)
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
bundle
.
cleanBundleCacheFiles
(
"
wrong bundle name
"
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
bms_cleancache_0300 test query system app err is
'
+
err
)
expect
(
err
).
assertEqual
(
1
);
}
installer
.
uninstall
(
BUNDLE_NAME1
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
}
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
done
();
});
}
)
}
installer
.
install
([
'
/data/test/bmsThirdBundleTest1.hap
'
],
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
,
},
onReceiveinstallEvent
);
})
})
})
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js
已删除
100644 → 0
浏览文件 @
940d85e8
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
浏览文件 @
eb382a27
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
浏览文件 @
eb382a27
...
...
@@ -15,60 +15,57 @@
import
bundle
from
'
@ohos.bundle
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
const
BUNDLE_PATH1
=
'
/data/test/bmsThirdBundleTest1.hap
'
;
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
const
BUNDLE_PATH1
=
[
'
/data/test/bmsThirdBundleTest1.hap
'
];
const
SYSTEM_PATH
=
'
/data/test/bmsSystemBundleTest2.hap
'
;
const
SYSTEM_NAME
=
'
com.example.system2
'
;
const
ABILITIY_NAME8
=
'
com.example.system2.MainAbility
'
;
const
USERID
=
100
;
let
installParam
=
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
};
describe
(
'
ActsBmsQueryAbilityByWant
'
,
function
()
{
/*
* @tc.number: bms_queryAbilityByWant_0100
* @tc.name: queryAbilityByWant callback by other callback
* @tc.desc: 1.queryAbilityByWant callback
* 2.queryAbilityByWant for third app
*/
it
(
'
bms_queryAbilityByWant_0100
'
,
0
,
async
function
(
done
){
console
.
info
(
'
=====================bms_queryAbilityByWant_0100==================
'
);
let
bundlePath
=
[
BUNDLE_PATH1
]
bundle
.
getBundleInstaller
().
then
(
installer
=>
{
function
onReceiveinstallEvent
(
err
,
data
)
{
console
.
log
(
'
bms_queryAbilityByWant_0100 install called:
'
+
data
)
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
it
(
'
bms_queryAbilityByWant_0100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInstaller
().
then
(
installer
=>
{
installer
.
install
(
BUNDLE_PATH1
,
installParam
,
onReceiveinstallEvent
);
async
function
onReceiveinstallEvent
(
err
,
data
)
{
checkInstallOrUninstall
(
err
,
data
);
await
bundle
.
queryAbilityByWant
({
action
:
[
'
action.system.home
'
],
entities
:
[
'
entity.system.home
'
],
bundleName
:
BUNDLE_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
).
then
(
data
=>
{
expect
(
data
).
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
1
);
});
bundle
.
queryAbilityByWant
({
action
:
[
'
action.system.home
'
],
entities
:
[
'
entity.system.home
'
],
bundleName
:
BUNDLE_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
100
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
'
bms_queryAbilityByWant_0100 test query system app err is
'
+
err
)
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
1
);
}
installer
.
uninstall
(
BUNDLE_NAME1
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
}
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
expect
(
data
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
installer
.
uninstall
(
BUNDLE_NAME1
,
installParam
,
(
err
,
data
)
=>
{
checkInstallOrUninstall
(
err
,
data
);
done
();
});
});
}
)
}
installer
.
install
([
'
/data/test/bmsThirdBundleTest1.hap
'
],
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
,
},
onReceiveinstallEvent
);
})
})
});
});
/*
* @tc.number: bms_queryAbilityByWant_0200
...
...
@@ -76,27 +73,132 @@ describe('ActsBmsQueryAbilityByWant', function () {
* @tc.desc: 1.queryAbilityByWant callback
* 2.queryAbilityByWant for systemapp
*/
it
(
'
bms_queryAbilityByWant_0200
'
,
0
,
async
function
(
done
){
console
.
info
(
'
=====================bms_queryAbilityByWant_0200==================
'
);
bundle
.
queryAbilityByWant
(
it
(
'
bms_queryAbilityByWant_0200
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
action
:
[
'
action.system.home
'
],
entities
:
[
'
entity.system.home
'
]
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
100
).
then
(
data
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
let
jsondata
=
JSON
.
stringify
(
data
[
i
]);
console
.
log
(
'
bms_queryAbilityByWant_0200 test query system app
'
+
jsondata
)
expect
(
data
[
i
].
applicationInfo
.
systemApp
).
assertEqual
(
true
)
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
).
then
(
data
=>
{
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
expect
(
data
[
i
].
applicationInfo
.
systemApp
).
assertEqual
(
true
);
}
done
();
}
).
catch
(
err
=>
{
console
.
log
(
'
bms_queryAbilityByWant_0200 test query system app err is
'
+
err
)
expect
(
err
).
assertFail
()
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
action
:
[
'
action.system.home
'
],
entities
:
[
'
entity.system.home
'
]
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
,
(
err
,
data
)
=>
{
if
(
err
)
{
expect
(
err
).
assertFail
();
}
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
expect
(
data
[
i
].
applicationInfo
.
systemApp
).
assertEqual
(
true
);
}
done
();
});
});
/*
* @tc.number: bms_queryAbilityByEntities_0300
* @tc.name: Use the implicit query method in queryAbilityByWant to get abilityInfos
* @tc.desc: The entities in the parameter want pass in the new field, and use the implicit query to get abilitInfos
*/
it
(
'
bms_queryAbilityByEntities_0300
'
,
0
,
async
function
(
done
)
{
let
installer
=
await
bundle
.
getBundleInstaller
();
installer
.
install
([
SYSTEM_PATH
],
installParam
,
async
(
err
,
data
)
=>
{
checkInstallOrUninstall
(
err
,
data
);
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
"
entity.app.music
"
,
"
entity.app.email
"
,
"
entity.app.contacts
"
,
"
entity.app.maps
"
,
"
entity.app.browser
"
,
"
entity.app.calendar
"
,
"
entity.app.messaging
"
,
"
entity.app.files
"
,
"
entity.app.gallery
"
],
elementName
:
{
deviceId
:
'
0
'
,
bundleName
:
''
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
expect
(
dataInfos
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
dataInfos
[
0
]);
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
"
entity.app.music
"
,
"
entity.app.email
"
,
"
entity.app.contacts
"
,
"
entity.app.maps
"
,
"
entity.app.browser
"
,
"
entity.app.calendar
"
,
"
entity.app.messaging
"
,
"
entity.app.files
"
,
"
entity.app.gallery
"
],
elementName
:
{
deviceId
:
'
0
'
,
bundleName
:
''
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
,
(
err
,
data
)
=>
{
expect
(
data
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
data
[
0
]);
});
installer
.
uninstall
(
SYSTEM_NAME
,
installParam
,
(
err
,
data
)
=>
{
checkInstallOrUninstall
(
err
,
data
);
done
();
})
})
});
});
});
async
function
cheackAbilityInfos
(
data
)
{
expect
(
data
.
name
).
assertEqual
(
ABILITIY_NAME8
);
expect
(
data
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
data
.
description
).
assertEqual
(
'
$string:mainability_description
'
);
expect
(
data
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
data
.
srcPath
).
assertEqual
(
""
);
expect
(
data
.
srcLanguage
).
assertEqual
(
"
js
"
);
expect
(
data
.
isVisible
).
assertEqual
(
false
);
expect
(
data
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
data
.
deviceCapabilities
.
length
).
assertEqual
(
0
);
expect
(
data
.
deviceTypes
[
0
]).
assertEqual
(
'
phone
'
);
expect
(
data
.
process
).
assertEqual
(
''
);
expect
(
data
.
uri
).
assertEqual
(
''
);
expect
(
data
.
bundleName
).
assertEqual
(
SYSTEM_NAME
);
expect
(
data
.
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
Object
.
keys
(
data
.
applicationInfo
).
length
).
assertLarger
(
0
);
expect
(
data
.
type
).
assertEqual
(
1
);
expect
(
data
.
orientation
).
assertEqual
(
0
);
expect
(
data
.
launchMode
).
assertEqual
(
1
);
expect
(
data
.
backgroundModes
).
assertEqual
(
0
);
expect
(
data
.
descriptionId
).
assertLarger
(
0
);
expect
(
data
.
formEnabled
).
assertEqual
(
false
);
expect
(
data
.
iconId
).
assertLarger
(
0
);
expect
(
data
.
labelId
).
assertLarger
(
0
);
expect
(
data
.
subType
).
assertEqual
(
0
);
expect
(
data
.
readPermission
).
assertEqual
(
""
);
expect
(
data
.
writePermission
).
assertEqual
(
""
);
expect
(
data
.
targetAbility
).
assertEqual
(
""
);
expect
(
data
.
theme
).
assertEqual
(
""
);
expect
(
data
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
data
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
data
.
enabled
).
assertEqual
(
true
);
}
function
checkInstallOrUninstall
(
err
,
data
)
{
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
0
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
}
})
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/List.test.js
浏览文件 @
eb382a27
...
...
@@ -12,7 +12,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./ActsBmsFormsInfoTest.test.js
'
)
require
(
'
./ActsBmsQueryAbilityByWant.test.js
'
)
require
(
'
./ActsBmsCleanCacheTest.test.js
'
)
require
(
'
./ActsBmsGetBackGroundModes.test.js
'
)
appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
浏览文件 @
eb382a27
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
浏览文件 @
eb382a27
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
浏览文件 @
eb382a27
...
...
@@ -15,16 +15,22 @@
import
bundle
from
'
@ohos.bundle
'
import
innerBundleManager
from
'
@ohos.bundle.innerBundleManager
'
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
const
STATUS_INSTALL_PERMISSION_DENIED
=
0X44
;
const
STATUS_UNINSTALL_PERMISSION_DENIED
=
0X45
;
const
LAUNCHER_BUNDLE_NAME
=
'
com.ohos.launcher
'
;
const
LAUNCHER_MAIN_ABILITY
=
'
com.ohos.launcher.MainAbility
'
;
const
DEFAULT_FLAG
=
0
;
const
DEFAULT_USER_ID
=
100
;
const
INVALID_CODE
=
1
;
const
BUNDLE_PATH
=
[
'
/data/test/bmsJstest1.hap
'
];
const
BUNDLE_NAME1
=
'
com.example.myapplication1
'
;
let
installParam
=
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
};
describe
(
'
ActsBmsJsUnPermissionTest
'
,
function
()
{
...
...
@@ -34,14 +40,8 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test js install
*/
it
(
'
bms_JsInstallPermissionTest_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
bms_JsInstallPermissionTest start
'
);
let
bundlePath
=
[
'
/data/test/bmsJstest1.hap
'
];
let
installer
=
await
bundle
.
getBundleInstaller
();
installer
.
install
(
bundlePath
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
},
OnReceiveInstallEvent
);
installer
.
install
(
BUNDLE_PATH
,
installParam
,
OnReceiveInstallEvent
);
async
function
OnReceiveInstallEvent
(
err
,
data
)
{
expect
(
err
.
code
).
assertEqual
(
-
1
);
expect
(
data
.
status
).
assertEqual
(
STATUS_INSTALL_PERMISSION_DENIED
);
...
...
@@ -56,14 +56,8 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test js uninstall
*/
it
(
'
bms_JsUnInstallPermissionTest_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
bms_JsUnInstallPermissionTest start
'
);
let
bundleName
=
'
com.example.myapplication1
'
;
let
installer
=
await
bundle
.
getBundleInstaller
();
installer
.
uninstall
(
bundleName
,
{
userId
:
100
,
installFlag
:
1
,
isKeepData
:
false
},
OnReceiveUnInstallEvent
);
installer
.
uninstall
(
BUNDLE_NAME1
,
installParam
,
OnReceiveUnInstallEvent
);
async
function
OnReceiveUnInstallEvent
(
err
,
data
)
{
expect
(
err
.
code
).
assertEqual
(
-
1
);
expect
(
data
.
status
).
assertEqual
(
STATUS_UNINSTALL_PERMISSION_DENIED
);
...
...
@@ -78,8 +72,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getApplicationInfo
*/
it
(
'
getApplicationInfoTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getApplicationInfoTest_100 start
'
);
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -94,8 +87,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getAllApplicationInfo
*/
it
(
'
getAllApplicationInfoTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getAllApplicationInfoTest_100 start
'
);
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -110,8 +102,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getBundleInfo
*/
it
(
'
getBundleInfoTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getBundleInfoTest_100 start
'
);
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -126,8 +117,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getAllBundleInfo
*/
it
(
'
getAllBundleInfoTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getAllBundleInfoTest_100 start
'
);
bundle
.
getAllBundleInfo
(
DEFAULT_FLAG
).
then
(
data
=>
{
await
bundle
.
getAllBundleInfo
(
DEFAULT_FLAG
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -142,8 +132,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test queryAbilityByWant
*/
it
(
'
queryAbilityByWantTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
queryAbilityByWantTest_100 start
'
);
bundle
.
queryAbilityByWant
({
await
bundle
.
queryAbilityByWant
({
bundleName
:
LAUNCHER_BUNDLE_NAME
,
abilityName
:
LAUNCHER_MAIN_ABILITY
},
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
...
...
@@ -161,8 +150,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getLaunchWantForBundle
*/
it
(
'
getLaunchWantForBundleTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getLaunchWantForBundleTest_100 start
'
);
bundle
.
getLaunchWantForBundle
(
LAUNCHER_BUNDLE_NAME
).
then
(
data
=>
{
await
bundle
.
getLaunchWantForBundle
(
LAUNCHER_BUNDLE_NAME
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -177,8 +165,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test setApplicationEnabled
*/
it
(
'
setApplicationEnabledTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
setApplicationEnabledTest_100 start
'
);
bundle
.
setApplicationEnabled
(
LAUNCHER_BUNDLE_NAME
,
false
).
then
(
data
=>
{
await
bundle
.
setApplicationEnabled
(
LAUNCHER_BUNDLE_NAME
,
false
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -193,12 +180,11 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test setAbilityEnabled
*/
it
(
'
setAbilityEnabledTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
setAbilityEnabledTest_100 start
'
);
let
abilityInfo
=
{
bundleName
:
LAUNCHER_BUNDLE_NAME
,
name
:
LAUNCHER_MAIN_ABILITY
};
bundle
.
setAbilityEnabled
(
abilityInfo
,
false
).
then
(
data
=>
{
await
bundle
.
setAbilityEnabled
(
abilityInfo
,
false
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -213,8 +199,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getLauncherAbilityInfos
*/
it
(
'
getLauncherAbilityInfosTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getLauncherAbilityInfosTest_100 start
'
);
innerBundleManager
.
getLauncherAbilityInfos
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
innerBundleManager
.
getLauncherAbilityInfos
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -229,8 +214,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getAllLauncherAbilityInfos
*/
it
(
'
getAllLauncherAbilityInfosTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getAllLauncherAbilityInfosTest_100 start
'
);
innerBundleManager
.
getAllLauncherAbilityInfos
(
DEFAULT_USER_ID
).
then
(
data
=>
{
await
innerBundleManager
.
getAllLauncherAbilityInfos
(
DEFAULT_USER_ID
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -245,8 +229,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getShortcutInfos
*/
it
(
'
getShortcutInfosTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getShortcutInfosTest_100 start
'
);
innerBundleManager
.
getShortcutInfos
(
LAUNCHER_BUNDLE_NAME
).
then
(
data
=>
{
await
innerBundleManager
.
getShortcutInfos
(
LAUNCHER_BUNDLE_NAME
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
...
...
@@ -262,7 +245,6 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.level 0
*/
it
(
'
getAbilityLabelTest_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
[getAbilityLabelTest_100] promise START
'
);
await
bundle
.
getAbilityLabel
(
LAUNCHER_BUNDLE_NAME
,
LAUNCHER_MAIN_ABILITY
)
.
then
((
data
)
=>
{
expect
().
assertFail
();
...
...
@@ -280,14 +262,12 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getAbilityInfo
*/
it
(
'
getAbilityInfo_100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
'
getAbilityInfo_100 start
'
);
bundle
.
getAbilityInfo
(
LAUNCHER_BUNDLE_NAME
,
LAUNCHER_MAIN_ABILITY
).
then
(
data
=>
{
await
bundle
.
getAbilityInfo
(
LAUNCHER_BUNDLE_NAME
,
LAUNCHER_MAIN_ABILITY
).
then
(
data
=>
{
expect
().
assertFail
();
done
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
done
();
});
})
});
})
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
eb382a27
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录