Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6589be6f
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看板
提交
6589be6f
编写于
11月 30, 2022
作者:
I
inter515
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用例调整
Signed-off-by:
N
inter515
<
ry.renyi@huawei.com
>
上级
6b94c70c
变更
81
展开全部
隐藏空白更改
内联
并排
Showing
81 changed file
with
6965 addition
and
2 deletion
+6965
-2
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
+3
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn
...le_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn
+35
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/Test.json
...e_standard/bundlemanager/actsbmsaccesstokentest/Test.json
+52
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/signature/openharmony_sx.p7b
...nager/actsbmsaccesstokentest/signature/openharmony_sx.p7b
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json
...bundlemanager/actsbmsaccesstokentest/src/main/config.json
+101
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/app.js
...ger/actsbmsaccesstokentest/src/main/js/MainAbility/app.js
+22
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/i18n/en-US.json
...msaccesstokentest/src/main/js/MainAbility/i18n/en-US.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/i18n/zh-CN.json
...msaccesstokentest/src/main/js/MainAbility/i18n/zh-CN.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.css
...sstokentest/src/main/js/MainAbility/pages/index/index.css
+24
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.hml
...sstokentest/src/main/js/MainAbility/pages/index/index.hml
+20
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.js
...esstokentest/src/main/js/MainAbility/pages/index/index.js
+33
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/app.js
...ger/actsbmsaccesstokentest/src/main/js/TestAbility/app.js
+31
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/i18n/en-US.json
...msaccesstokentest/src/main/js/TestAbility/i18n/en-US.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/i18n/zh-CN.json
...msaccesstokentest/src/main/js/TestAbility/i18n/zh-CN.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.css
...sstokentest/src/main/js/TestAbility/pages/index/index.css
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.hml
...sstokentest/src/main/js/TestAbility/pages/index/index.hml
+5
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.js
...esstokentest/src/main/js/TestAbility/pages/index/index.js
+26
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
...tokentest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js
...tokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js
+194
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/List.test.js
...ager/actsbmsaccesstokentest/src/main/js/test/List.test.js
+19
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/resources/base/element/string.json
...cesstokentest/src/main/resources/base/element/string.json
+28
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/resources/base/media/icon.png
...bmsaccesstokentest/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
...try/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
+71
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js
...ostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js
+208
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
...ostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
+73
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/List.test.js
...manager/actsbmsgetinfostest/src/main/js/test/List.test.js
+3
-1
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn
...ndle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn
+35
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json
...dle_standard/bundlemanager/actsbmshapmoduletest/Test.json
+52
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/signature/openharmony_sx.p7b
...manager/actsbmshapmoduletest/signature/openharmony_sx.p7b
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json
...d/bundlemanager/actsbmshapmoduletest/src/main/config.json
+101
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/app.js
...nager/actsbmshapmoduletest/src/main/js/MainAbility/app.js
+22
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/i18n/en-US.json
...sbmshapmoduletest/src/main/js/MainAbility/i18n/en-US.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/i18n/zh-CN.json
...sbmshapmoduletest/src/main/js/MainAbility/i18n/zh-CN.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.css
...pmoduletest/src/main/js/MainAbility/pages/index/index.css
+24
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.hml
...pmoduletest/src/main/js/MainAbility/pages/index/index.hml
+20
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.js
...apmoduletest/src/main/js/MainAbility/pages/index/index.js
+32
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/app.js
...nager/actsbmshapmoduletest/src/main/js/TestAbility/app.js
+31
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/i18n/en-US.json
...sbmshapmoduletest/src/main/js/TestAbility/i18n/en-US.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/i18n/zh-CN.json
...sbmshapmoduletest/src/main/js/TestAbility/i18n/zh-CN.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.css
...pmoduletest/src/main/js/TestAbility/pages/index/index.css
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.hml
...pmoduletest/src/main/js/TestAbility/pages/index/index.hml
+5
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.js
...apmoduletest/src/main/js/TestAbility/pages/index/index.js
+26
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
...oduletest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/test/ActsBmsHapModuleTest.test.js
...pmoduletest/src/main/js/test/ActsBmsHapModuleTest.test.js
+211
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/test/List.test.js
...anager/actsbmshapmoduletest/src/main/js/test/List.test.js
+19
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/resources/base/element/string.json
...hapmoduletest/src/main/resources/base/element/string.json
+28
-0
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/resources/base/media/icon.png
...tsbmshapmoduletest/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsJsTest.test.js
...ager/actsbmsjstest/src/main/js/test/ActsBmsJsTest.test.js
+229
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/List.test.js
...bundlemanager/actsbmsjstest/src/main/js/test/List.test.js
+3
-1
bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
...ontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
+136
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn
...undle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn
+35
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/Test.json
...ndle_standard/bundlemanager/actsbmsmetadatatest/Test.json
+60
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/signature/openharmony_sx.p7b
...emanager/actsbmsmetadatatest/signature/openharmony_sx.p7b
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json
...rd/bundlemanager/actsbmsmetadatatest/src/main/config.json
+101
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/app.js
...anager/actsbmsmetadatatest/src/main/js/MainAbility/app.js
+22
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/i18n/en-US.json
...tsbmsmetadatatest/src/main/js/MainAbility/i18n/en-US.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/i18n/zh-CN.json
...tsbmsmetadatatest/src/main/js/MainAbility/i18n/zh-CN.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.css
...etadatatest/src/main/js/MainAbility/pages/index/index.css
+24
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.hml
...etadatatest/src/main/js/MainAbility/pages/index/index.hml
+20
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.js
...metadatatest/src/main/js/MainAbility/pages/index/index.js
+33
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/app.js
...anager/actsbmsmetadatatest/src/main/js/TestAbility/app.js
+31
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/i18n/en-US.json
...tsbmsmetadatatest/src/main/js/TestAbility/i18n/en-US.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/i18n/zh-CN.json
...tsbmsmetadatatest/src/main/js/TestAbility/i18n/zh-CN.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.css
...etadatatest/src/main/js/TestAbility/pages/index/index.css
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.hml
...etadatatest/src/main/js/TestAbility/pages/index/index.hml
+5
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.js
...metadatatest/src/main/js/TestAbility/pages/index/index.js
+26
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
...adatatest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/test/ActsBmsMetaDataTest.test.js
...metadatatest/src/main/js/test/ActsBmsMetaDataTest.test.js
+228
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/test/List.test.js
...manager/actsbmsmetadatatest/src/main/js/test/List.test.js
+18
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/resources/base/element/string.json
...smetadatatest/src/main/resources/base/element/string.json
+28
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/resources/base/media/icon.png
...ctsbmsmetadatatest/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetAbilityIcon.test.ets
...eretstest/entry/src/main/ets/test/GetAbilityIcon.test.ets
+164
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetAbilityLabelJsUnit.test.ets
...st/entry/src/main/ets/test/GetAbilityLabelJsUnit.test.ets
+163
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetLaunchWantForBundle.test.ets
...t/entry/src/main/ets/test/GetLaunchWantForBundle.test.ets
+134
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetNameForUid.test.ets
...geretstest/entry/src/main/ets/test/GetNameForUid.test.ets
+106
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetQueryAbilityByWant.test.ets
...st/entry/src/main/ets/test/GetQueryAbilityByWant.test.ets
+1015
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
...stest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
+244
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsApplicationEnabledETSUnit.ets
...t/entry/src/main/ets/test/IsApplicationEnabledETSUnit.ets
+109
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets
...undlemanageretstest/entry/src/main/ets/test/List.test.ets
+18
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
...est/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
+343
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js
...sbundlemanagertest/src/main/js/test/ExampleJsunit.test.js
+1765
-0
未找到文件。
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
浏览文件 @
6589be6f
...
...
@@ -17,10 +17,13 @@ group("bundlemanager") {
testonly = true
if (is_standard_system) {
deps = [
"actsbmsaccesstokentest:ActsBmsAccessTokenTest",
"actsbmsetsunpermissiontest:ActsBmsEtsUnPermissionTest",
"actsbmsgetinfostest:ActsBmsGetInfosTest",
"actsbmshapmoduletest:ActsBmsHapModuleTest",
"actsbmsjstest:ActsBmsJsTest",
"actsbmsjsunpermissiontest:ActsBmsJsUnPermissionTest",
"actsbmsmetadatatest:ActsBmsMetaDataTest",
"actsbundlemanageretstest:ActsBundleManagerEtsTest",
"actsbundlemanagerstagetest:ActsBundleMgrStageEtsTest",
"actsbundlemanagertest:ActsBundleManagerTest",
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn
0 → 100644
浏览文件 @
6589be6f
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsAccessTokenTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsAccessTokenTest"
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/Test.json
0 → 100644
浏览文件 @
6589be6f
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"120000"
,
"shell-timeout"
:
"120000"
,
"bundle-name"
:
"com.example.actsbmsaccesstokentest"
,
"package-name"
:
"com.example.actsbmsaccesstokentest"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsBmsAccessTokenTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
,
"mkdir /data/test"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"bmsAccessTokenTest1.hap->/data/test/bmsAccessTokenTest1.hap"
,
"bmsAccessTokenTest2.hap->/data/test/bmsAccessTokenTest2.hap"
,
"bmsAccessTokenTest3.hap->/data/test/bmsAccessTokenTest3.hap"
,
"bmsAccessTokenTest4.hap->/data/test/bmsAccessTokenTest4.hap"
,
"bmsAccessTokenTest5.hap->/data/test/bmsAccessTokenTest5.hap"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"bm install -p /data/test/bmsAccessTokenTest1.hap"
,
"bm install -p /data/test/bmsAccessTokenTest4.hap"
,
"bm install -p /data/test/bmsAccessTokenTest3.hap"
,
"bm install -p /data/test/bmsAccessTokenTest2.hap"
,
"bm install -p /data/test/bmsAccessTokenTest5.hap"
],
"teardown-command"
:
[
"bm uninstall -n com.example.bmsaccesstoken1"
,
"bm uninstall -n com.example.bmsaccesstoken2"
,
"bm uninstall -n com.example.bmsaccesstoken3"
,
"rm -rf /data/test/"
]
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
6589be6f
文件已添加
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json
0 → 100644
浏览文件 @
6589be6f
{
"app"
:
{
"bundleName"
:
"com.example.actsbmsaccesstokentest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsbmsaccesstokentest"
,
"name"
:
".entry"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
},
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<!--
Copyright (c) 2022 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.
-->
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/MainAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
'
Test AccessToken
'
},
onInit
()
{
this
.
title
=
'
Test AccessToken
'
;
},
onShow
()
{
console
.
info
(
'
onReady finish
'
)
},
onReady
()
{
},
onBackPress
(){
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/ActsBmsAccessTokenTest.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'
@ohos/hypium
'
const
BUNDLE_NAME1
=
'
com.example.bmsaccesstoken1
'
;
const
BUNDLE_NAME2
=
'
com.example.bmsaccesstoken2
'
;
const
BUNDLE_NAME3
=
'
com.example.bmsaccesstoken3
'
;
let
userId
=
0
;
export
default
function
ActsBmsAccessTokenTest
()
{
describe
(
'
ActsBmsAccessTokenTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: BMS_SECURITY_INITIALIZE_0004
* @tc.name: getAccessTokenIdOfEntry
* @tc.desc: get the accessTokenId
*/
it
(
'
getAccessTokenIdOfEntry
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
)
.
then
(
applicationInfo
=>
{
console
.
info
(
'
accessTokenId:
'
+
applicationInfo
.
accessTokenId
);
expect
(
applicationInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
expect
(
applicationInfo
.
accessTokenId
).
assertLarger
(
0
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0001
* @tc.name: getReqPermissionOfEntry
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it
(
'
getReqPermissionOfEntry
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
BUNDLE_NAME3
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_REQUESTED_PERMISSION
)
.
then
(
bundleInfo
=>
{
expect
(
bundleInfo
.
name
).
assertEqual
(
BUNDLE_NAME3
);
expect
(
bundleInfo
.
reqPermissions
.
length
).
assertEqual
(
3
);
expect
(
bundleInfo
.
reqPermissions
[
0
]).
assertEqual
(
"
ohos.permission.ALPHA
"
);
expect
(
bundleInfo
.
reqPermissions
[
1
]).
assertEqual
(
"
ohos.permission.BETA
"
);
expect
(
bundleInfo
.
reqPermissions
[
2
]).
assertEqual
(
"
ohos.permission.KEEP_BACKGROUND_RUNNING
"
);
expect
(
bundleInfo
.
reqPermissionStates
.
length
).
assertEqual
(
3
);
expect
(
bundleInfo
.
reqPermissionStates
[
0
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
1
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
2
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0008
* @tc.name: getReqPermissionUpdateEntry
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it
(
'
getReqPermissionUpdateEntry
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_REQUESTED_PERMISSION
)
.
then
(
bundleInfo
=>
{
expect
(
bundleInfo
.
name
).
assertEqual
(
BUNDLE_NAME2
);
expect
(
bundleInfo
.
reqPermissions
.
length
).
assertEqual
(
5
);
expect
(
bundleInfo
.
reqPermissions
[
0
]).
assertEqual
(
"
ohos.permission.ALPHA
"
);
expect
(
bundleInfo
.
reqPermissions
[
1
]).
assertEqual
(
"
ohos.permission.KEEP_BACKGROUND_RUNNING
"
);
expect
(
bundleInfo
.
reqPermissions
[
2
]).
assertEqual
(
"
ohos.permission.LOCATION_IN_BACKGROUND
"
);
expect
(
bundleInfo
.
reqPermissions
[
3
]).
assertEqual
(
"
ohos.permission.USE_BLUETOOTH
"
);
expect
(
bundleInfo
.
reqPermissions
[
4
]).
assertEqual
(
"
ohos.permission.VIBRATE
"
);
expect
(
bundleInfo
.
reqPermissionStates
.
length
).
assertEqual
(
5
);
expect
(
bundleInfo
.
reqPermissionStates
[
0
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
1
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
expect
(
bundleInfo
.
reqPermissionStates
[
2
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
3
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
expect
(
bundleInfo
.
reqPermissionStates
[
4
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYPERMISSION_0003
* @tc.name: getReqPermissionUpdateEntryAndFeature
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it
(
'
getReqPermissionUpdateEntryAndFeature
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_REQUESTED_PERMISSION
)
.
then
(
bundleInfo
=>
{
expect
(
bundleInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
expect
(
bundleInfo
.
reqPermissions
.
length
).
assertEqual
(
6
);
expect
(
bundleInfo
.
reqPermissions
[
0
]).
assertEqual
(
"
ohos.permission.ALPHA
"
);
expect
(
bundleInfo
.
reqPermissions
[
1
]).
assertEqual
(
"
ohos.permission.BETA
"
);
expect
(
bundleInfo
.
reqPermissions
[
2
]).
assertEqual
(
"
ohos.permission.KEEP_BACKGROUND_RUNNING
"
);
expect
(
bundleInfo
.
reqPermissions
[
3
]).
assertEqual
(
"
ohos.permission.LOCATION_IN_BACKGROUND
"
);
expect
(
bundleInfo
.
reqPermissions
[
4
]).
assertEqual
(
"
ohos.permission.USE_BLUETOOTH
"
);
expect
(
bundleInfo
.
reqPermissions
[
5
]).
assertEqual
(
"
ohos.permission.VIBRATE
"
);
expect
(
bundleInfo
.
reqPermissionStates
.
length
).
assertEqual
(
6
);
expect
(
bundleInfo
.
reqPermissionStates
[
0
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
1
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
2
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
expect
(
bundleInfo
.
reqPermissionStates
[
3
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_DENIED
);
expect
(
bundleInfo
.
reqPermissionStates
[
4
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
expect
(
bundleInfo
.
reqPermissionStates
[
5
]).
assertEqual
(
bundle
.
GrantStatus
.
PERMISSION_GRANTED
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/**
* @tc.number BMS_SECURITY_INITIALIZE_0013
* @tc.name getAccessTokenIdWithDefault
* @tc.desc Test getBundleInfos interfaces with with a flag
*/
it
(
"
getAccessTokenIdWithDefault
"
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
)
.
then
((
applicationInfo
)
=>
{
console
.
info
(
"
getAccessTokenIdWithDefault accessTokenId:
"
+
applicationInfo
.
accessTokenId
);
expect
(
applicationInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
expect
(
applicationInfo
.
accessTokenId
).
assertLarger
(
0
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/**
* @tc.number BMS_SECURITY_INITIALIZE_0014
* @tc.name getAccessTokenIdWithGetAbilities
* @tc.desc Test getBundleInfos interfaces with a flag
*/
it
(
"
getAccessTokenIdWithGetAbilities
"
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
)
.
then
((
applicationInfo
)
=>
{
console
.
info
(
"
getAccessTokenIdWithGetAbilities accessTokenId:
"
+
applicationInfo
.
accessTokenId
);
expect
(
applicationInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
expect
(
applicationInfo
.
accessTokenId
).
assertLarger
(
0
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
/**
* @tc.number BMS_SECURITY_INITIALIZE_0015
* @tc.name getAccessTokenIdWithGetPermission
* @tc.desc Test getBundleInfos interfaces with a flag
*/
it
(
"
getAccessTokenIdWithGetPermission
"
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
)
.
then
((
applicationInfo
)
=>
{
console
.
info
(
"
getAccessTokenIdWithGetPermission accessTokenId:
"
+
applicationInfo
.
accessTokenId
);
expect
(
applicationInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
expect
(
applicationInfo
.
accessTokenId
).
assertLarger
(
0
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
).
assertFail
();
done
();
});
});
});
}
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
ActsBmsAccessTokenTest
from
'
./ActsBmsAccessTokenTest.test.js
'
export
default
function
testsuite
()
{
ActsBmsAccessTokenTest
()
}
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
6589be6f
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"actsbmsallshortcutinfotest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
6589be6f
6.6 KB
bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
浏览文件 @
6589be6f
...
...
@@ -42,6 +42,60 @@ export default function actsBmsJsUnPermissionTest() {
})
});
/**
* @tc.number getApplicationInfos_1300
* @tc.name getApplicationInfosUnPermission
* @tc.desc test getAllApplicationInfo
*/
it
(
'getApplicationInfosUnPermission'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
)
.
then
(
data
=>
{
expect
()
.
assertFail
();
})
.
catch
(
err
=>
{
expect
(
err
.
code
)
.
assertEqual
(
INVALID_CODE
);
});
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
(
err
,
data
)
=>
{
expect
(
err
.
code
)
.
assertEqual
(
INVALID_CODE
);
expect
(
data
)
.
assertEqual
(
undefined
);
done
();
});
});
/**
* @tc.number getBundleInfo_2000
* @tc.name getBundleInfoUnPermission
* @tc.desc test getBundleInfo
*/
it
(
'getBundleInfoUnPermission'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
BUNDLE_NAME_OTHER
,
DEFAULT_FLAG
,
{
userId
:
userId
})
.
then
(
data
=>
{
expect
()
.
assertFail
();
})
.
catch
(
err
=>
{
expect
(
err
)
.
assertEqual
(
INVALID_CODE
);
});
bundle
.
getBundleInfo
(
BUNDLE_NAME_OTHER
,
DEFAULT_FLAG
,
{
userId
:
userId
},
(
err
,
data
)
=>
{
expect
(
err
)
.
assertEqual
(
INVALID_CODE
);
expect
(
data
)
.
assertEqual
(
undefined
);
done
();
});
});
/**
* @tc.number getApplicationInfo_1800
* @tc.name getApplicationInfoUnPermission
* @tc.desc test getApplicationInfo
*/
it
(
'getApplicationInfoUnPermission'
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME_OTHER
,
DEFAULT_FLAG
)
.
then
(
data
=>
{
expect
()
.
assertFail
();
})
.
catch
(
err
=>
{
expect
(
err
.
code
)
.
assertEqual
(
INVALID_CODE
);
});
bundle
.
getApplicationInfo
(
BUNDLE_NAME_OTHER
,
DEFAULT_FLAG
,
(
err
,
data
)
=>
{
expect
(
err
.
code
)
.
assertEqual
(
INVALID_CODE
);
expect
(
data
)
.
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: SUB_BMS_HAP_STATUS_0011
* @tc.name: hasInstalledUnPermissionSelf
...
...
@@ -94,6 +148,23 @@ export default function actsBmsJsUnPermissionTest() {
})
});
/*
* @tc.number: SUB_BMS_APPINFO_GETABILITYICON_0006
* @tc.name: getAbilityIconUnPermission
* @tc.desc: test getAbilityIcon without permission
*/
it
(
'getAbilityIconUnPermission'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAbilityIcon
(
BUNDLE_NAME_OTHER
,
ABILITIY_NAME_OTHER
)
.
then
(
pixelmap
=>
{
expect
(
pixelmap
)
.
assertFail
();
})
.
catch
(
err
=>
{
expect
(
err
)
.
assertEqual
(
1
);
});
bundle
.
getAbilityIcon
(
BUNDLE_NAME_OTHER
,
ABILITIY_NAME_OTHER
,
(
err
,
pixelmap
)
=>
{
expect
(
err
)
.
assertEqual
(
1
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_GETABILITYINFO_0008
* @tc.name: getAbilityInfoUnPermissionSelf
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsGetBackGroundModes.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
const
BUNDLE_NAME2
=
'
com.example.third2
'
;
const
BUNDLE_NAME4
=
'
com.example.third4
'
;
const
BUNDLE_NAME5
=
'
com.example.third5
'
;
const
BUNDLE_NAME6
=
'
com.example.third6
'
;
const
ABILITIY_NAME1
=
"
com.example.third5.MainAbilityA
"
;
const
ABILITIY_NAME2
=
"
com.example.third5.MainAbilityB
"
;
const
ABILITIY_NAME3
=
"
com.example.third2.MainAbilityA
"
;
const
ABILITIY_NAME4
=
"
com.example.third4.MainAbility
"
;
const
ABILITIY_NAME5
=
"
com.example.third1.MainAbilityA
"
;
const
ABILITIY_NAME6
=
"
com.example.third3.MainAbilityA
"
;
const
NUM_TWO
=
2
;
const
NUM_THREE
=
3
;
const
NUM_FOUR
=
4
;
const
NUM_NINE
=
9
;
const
DATATRANSFER
=
1
;
const
AUDIOPLAYBACK
=
2
;
const
AUDIORECORDING
=
4
;
const
LOCATION
=
8
;
const
BLUETOOTHINTERACTION
=
16
;
const
MULTIDEVICECONNECTION
=
32
;
const
WIFIINTERACTION
=
64
;
const
VOIP
=
128
;
const
TASKKEEPING
=
256
;
let
userId
=
0
;
export
default
function
ActsBmsGetBackGroundModes
()
{
describe
(
'
ActsBmsGetBackGroundModes
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0085
* @tc.name: getBackgroundModesMultiAbility
* @tc.desc: Get the information of the background modes from multi-ability application
*/
it
(
'
getBackgroundModesMultiAbility
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
deviceId
:
'
0
'
,
bundleName
:
BUNDLE_NAME5
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_FOUR
);
if
(
dataInfos
.
length
==
NUM_FOUR
)
{
expect
(
dataInfos
[
NUM_TWO
].
name
).
assertEqual
(
ABILITIY_NAME1
);
expect
(
dataInfos
[
NUM_TWO
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
expect
(
dataInfos
[
NUM_THREE
].
name
).
assertEqual
(
ABILITIY_NAME2
);
expect
(
dataInfos
[
NUM_THREE
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
VOIP
);
}
let
bundleInfos
=
await
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
userId
);
for
(
let
i
=
0
;
i
<
bundleInfos
.
length
;
i
++
)
{
if
(
bundleInfos
[
i
].
name
==
BUNDLE_NAME5
)
{
for
(
let
j
=
0
;
j
<
bundleInfos
[
i
].
abilityInfos
.
length
;
j
++
)
{
if
(
bundleInfos
[
i
].
abilityInfos
[
j
].
name
==
ABILITIY_NAME1
)
{
expect
(
bundleInfos
[
i
].
abilityInfos
[
j
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
}
else
if
(
bundleInfos
[
i
].
abilityInfos
[
j
].
name
==
ABILITIY_NAME2
)
{
expect
(
bundleInfos
[
i
].
abilityInfos
[
j
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
VOIP
);
}
}
}
}
let
data3
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME5
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
expect
(
data3
.
abilityInfos
[
2
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
expect
(
data3
.
abilityInfos
[
3
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
VOIP
);
done
();
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0086
* @tc.name: getBackgroundModesAllModes
* @tc.desc: Get all background modes information, and each ability of the application
* contains one of the background mode
*/
it
(
'
getBackgroundModesAllModes
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
deviceId
:
'
0
'
,
bundleName
:
BUNDLE_NAME6
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_NINE
);
for
(
let
i
=
0
,
len
=
dataInfos
.
length
;
i
<
len
;
i
++
)
{
expect
(
dataInfos
[
i
].
backgroundModes
).
assertEqual
(
1
<<
i
);
}
done
();
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0087
* @tc.name: getBackgroundModesInvalidModes
* @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes
*/
it
(
'
getBackgroundModesInvalidModes
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
deviceId
:
'
0
'
,
bundleName
:
BUNDLE_NAME2
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_TWO
);
if
(
dataInfos
.
length
==
NUM_TWO
)
{
expect
(
dataInfos
[
1
].
name
).
assertEqual
(
ABILITIY_NAME3
)
expect
(
dataInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
}
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
userId
,
(
err
,
bundleInfos
)
=>
{
for
(
let
i
=
0
;
i
<
bundleInfos
.
length
;
i
++
)
{
if
(
bundleInfos
[
i
].
name
==
BUNDLE_NAME2
)
{
for
(
let
j
=
0
;
j
<
bundleInfos
[
i
].
abilityInfos
.
length
;
j
++
)
{
if
(
bundleInfos
[
i
].
abilityInfos
[
j
].
name
==
ABILITIY_NAME3
)
{
expect
(
bundleInfos
[
i
].
abilityInfos
[
j
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
}
}
}
}
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data3
)
=>
{
expect
(
data3
.
abilityInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
done
();
});
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0088
* @tc.name: getBackgroundModesNotModes
* @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes
*/
it
(
'
getBackgroundModesNotModes
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
deviceId
:
'
0
'
,
bundleName
:
BUNDLE_NAME4
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
1
);
if
(
dataInfos
.
length
==
1
)
{
expect
(
dataInfos
[
0
].
name
).
assertEqual
(
ABILITIY_NAME4
)
expect
(
dataInfos
[
0
].
backgroundModes
).
assertEqual
(
0
)
}
done
();
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0089
* @tc.name: getBackgroundModesMultiHap
* @tc.desc: Get the backgroundModes information of the multi-hap package of the application
*/
it
(
'
getBackgroundModesMultiHap
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
deviceId
:
'
0
'
,
bundleName
:
BUNDLE_NAME1
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_FOUR
);
if
(
dataInfos
.
length
==
NUM_FOUR
)
{
expect
(
dataInfos
[
1
].
name
).
assertEqual
(
ABILITIY_NAME5
)
expect
(
dataInfos
[
1
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
expect
(
dataInfos
[
3
].
name
).
assertEqual
(
ABILITIY_NAME6
)
expect
(
dataInfos
[
3
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
}
done
();
});
})}
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
浏览文件 @
6589be6f
...
...
@@ -37,6 +37,35 @@ describe('ActsBmsQueryAbilityByWant', function () {
})
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYSYS_0008
* @tc.name: queryAbilityByWantThirdApp
* @tc.desc: 1.queryAbilityByWant callback
* 2.queryAbilityByWant for third app
*/
it
(
'
queryAbilityByWantThirdApp
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
({
action
:
ACTION_NAME
,
entities
:
[
ENTITY_NAME
],
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_NAME
,
entities
:
[
ENTITY_NAME
],
bundleName
:
BUNDLE_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
1
);
expect
(
data
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERYSYS_0007
* @tc.name: queryAbilityByWantSystemApp
...
...
@@ -77,6 +106,50 @@ describe('ActsBmsQueryAbilityByWant', function () {
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0084
* @tc.name: queryAbilityByWantImplicitByEntities
* @tc.desc: The entities in the parameter want pass in the new field, and use the implicit query to get abilitInfos
*/
it
(
'
queryAbilityByWantImplicitByEntities
'
,
0
,
async
function
(
done
)
{
let
dataInfos
=
await
bundle
.
queryAbilityByWant
({
action
:
ACTION_NAME
,
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
"
],
deviceId
:
'
0
'
,
bundleName
:
''
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
dataInfos
[
0
]);
bundle
.
queryAbilityByWant
({
action
:
ACTION_NAME
,
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
"
],
deviceId
:
'
0
'
,
bundleName
:
''
,
abilityName
:
''
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
,
(
err
,
data
)
=>
{
expect
(
data
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
data
[
0
]);
done
();
});
});
async
function
cheackAbilityInfos
(
data
)
{
expect
(
data
.
name
).
assertEqual
(
ABILITIY_NAME8
);
expect
(
data
.
label
).
assertEqual
(
'
$string:app_name
'
);
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/js/test/List.test.js
浏览文件 @
6589be6f
...
...
@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
ActsBmsQueryAbilityByWant
from
'
./ActsBmsQueryAbilityByWant.test.js
'
import
ActsBmsGetBackGroundModes
from
'
./ActsBmsQueryAbilityByWant.test.js
'
import
ActsBmsQueryAbilityByWant
from
'
./ActsBmsGetBackGroundModes.test.js
'
export
default
function
testsuite
()
{
ActsBmsGetBackGroundModes
()
ActsBmsQueryAbilityByWant
()
}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn
0 → 100644
浏览文件 @
6589be6f
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsHapModuleTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsHapModuleTest"
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json
0 → 100644
浏览文件 @
6589be6f
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"60000"
,
"shell-timeout"
:
"60000"
,
"bundle-name"
:
"com.example.actsbmshapmoduletest"
,
"package-name"
:
"com.example.actsbmshapmoduletest"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsBmsHapModuleTest.hap"
,
"bmsSystemBundleTest1.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
,
"mkdir /data/test"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap"
,
"bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap"
,
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap"
,
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"chmod 644 /data/test/*.hap"
,
"bm install -p /data/test/bmsMainAbilityFirstScene.hap"
,
"bm install -p /data/test/bmsMainAbilitySecondScene.hap"
,
"bm install -p /data/test/bmsThirdBundleTest2.hap"
,
"bm install -p /data/test/bmsThirdBundleTest5.hap"
],
"teardown-command"
:
[
"bm uninstall -n com.example.third2"
,
"bm uninstall -n com.example.third5"
,
"bm uninstall -n com.example.bmsmainabilityfirstscene"
,
"rm -rf /data/test/"
]
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
6589be6f
文件已添加
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json
0 → 100644
浏览文件 @
6589be6f
{
"app"
:
{
"bundleName"
:
"com.example.actsbmshapmoduletest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsbmshapmoduletest"
,
"name"
:
".entry"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
},
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<!--
Copyright (c) 2022 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.
-->
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/MainAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
'
Test HapModuleInfo
'
},
onInit
()
{
this
.
title
=
'
Test HapModuleInfo
'
;
},
onShow
()
{
console
.
info
(
'
onReady finish
'
)
},
onReady
()
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/test/ActsBmsHapModuleTest.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
'
@ohos/hypium
'
const
BUNDLE_NAME1
=
'
com.example.bmsmainabilityfirstscene
'
;
const
BUNDLE_NAME2
=
'
com.example.third2
'
;
const
BUNDLE_NAME3
=
'
com.example.third5
'
;
const
BUNDLE_NAME5
=
'
com.example.system1
'
;
const
FIRSTMAINABILITY
=
'
com.example.bmsmainabilityfirstscene.MainAbility
'
;
const
SECONDMAINABILITY
=
'
com.example.bmsmainabilitysecondscene.MainAbility
'
;
const
MODULE_NAME
=
'
entry
'
;
const
ICON
=
'
$media:icon
'
;
const
ICON_ID
=
16777218
;
const
LABEL
=
'
$string:app_name
'
;
const
LABEL_ID
=
16777216
;
const
DEVICE_TYPES
=
'
default
'
;
const
FIRST_SCENE_HAP_NAME
=
'
com.example.bmsmainabilityfirstscene.MyApplication
'
;
const
SECOND_SCENE_HAP_NAME
=
'
com.example.bmsmainabilitysecondscene.MyApplication
'
;
const
THIRD_TWO_HAP_NAME
=
'
com.example.third2.MyApplication
'
;
const
THIRD_FIVE_HAP_NAME
=
'
com.example.third5.BmsThirdBundle5
'
;
const
SYSTEM_ONE_HAP_NAME
=
'
com.example.system1.BmsSystemBundle1
'
;
export
default
function
ActsBmsHapModuleTest
()
{
describe
(
'
ActsBmsHapModuleTest
'
,
function
()
{
/*
* @tc.number: bms_getHapModuleInfo_0100
* @tc.name: get hapModuleInfo from one app by getBundleInfo
* @tc.desc: get the module information of the hap with type of entry
*/
it
(
'
bms_getHapModuleInfo_0100
'
,
0
,
async
function
(
done
)
{
let
dataInfo
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
bundle
.
getBundleInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
callback
);
async
function
callback
(
err
,
result
)
{
expect
(
JSON
.
stringify
(
result
)).
assertEqual
(
JSON
.
stringify
(
dataInfo
));
expect
(
result
.
hapModuleInfos
.
length
).
assertEqual
(
2
);
if
(
result
.
hapModuleInfos
.
length
>
0
)
{
let
hapModuleInfo
=
result
.
hapModuleInfos
[
0
];
expect
(
hapModuleInfo
.
name
).
assertEqual
(
FIRST_SCENE_HAP_NAME
);
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
MODULE_NAME
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
ICON
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
LABEL
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
LABEL_ID
);
expect
(
hapModuleInfo
.
iconId
).
assertEqual
(
ICON_ID
);
expect
(
hapModuleInfo
.
backgroundImg
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
deviceTypes
[
0
]).
assertEqual
(
DEVICE_TYPES
);
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
FIRSTMAINABILITY
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
done
();
}
}
});
/*
* @tc.number: bms_getHapModuleInfo_0200
* @tc.name: get hapModuleInfo from two modules by getBundleInfo
* @tc.desc: get the module information of the hap with type of feature
*/
it
(
'
bms_getHapModuleInfo_0200
'
,
0
,
async
function
(
done
)
{
let
dataInfo
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
bundle
.
getBundleInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
async
(
err
,
result
)
=>
{
expect
(
JSON
.
stringify
(
result
)).
assertEqual
(
JSON
.
stringify
(
dataInfo
));
expect
(
result
.
hapModuleInfos
.
length
).
assertEqual
(
2
);
if
(
result
.
hapModuleInfos
.
length
==
2
)
{
let
hapModuleInfo
=
result
.
hapModuleInfos
[
0
];
let
hapModuleInfo1
=
result
.
hapModuleInfos
[
1
];
checkHapMoudleInfos
(
hapModuleInfo
);
checkHapMoudleInfos
(
hapModuleInfo1
);
expect
(
hapModuleInfo
.
name
).
assertEqual
(
FIRST_SCENE_HAP_NAME
);
expect
(
hapModuleInfo1
.
name
).
assertEqual
(
SECOND_SCENE_HAP_NAME
);
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
MODULE_NAME
);
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
FIRSTMAINABILITY
);
expect
(
hapModuleInfo1
.
moduleName
).
assertEqual
(
'
bmsmainabilitysecondscene
'
);
expect
(
hapModuleInfo1
.
mainAbilityName
).
assertEqual
(
SECONDMAINABILITY
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
expect
(
hapModuleInfo1
.
installationFree
).
assertEqual
(
true
);
done
();
}
});
});
/*
* @tc.number: bms_getHapModuleInfo_0300
* @tc.name: get hapModuleInfo one app without mainAbility by getBundleInfo
* @tc.desc: get the module information of the hap without mainAbility
*/
it
(
'
bms_getHapModuleInfo_0300
'
,
0
,
async
function
(
done
)
{
let
result
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data
)
=>
{
expect
(
JSON
.
stringify
(
result
)).
assertEqual
(
JSON
.
stringify
(
data
));
expect
(
result
.
hapModuleInfos
.
length
).
assertEqual
(
1
);
if
(
result
.
hapModuleInfos
.
length
>
0
)
{
let
hapModuleInfo
=
result
.
hapModuleInfos
[
0
];
expect
(
hapModuleInfo
.
name
).
assertEqual
(
THIRD_TWO_HAP_NAME
);
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
MODULE_NAME
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
iconId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
backgroundImg
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
deviceTypes
[
0
]).
assertEqual
(
DEVICE_TYPES
);
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
done
();
}
});
});
/*
* @tc.number: bms_getHapModuleInfo_0400
* @tc.name: get hapModuleInfo through getBundleInfo, an application that adds mainAbility
* @tc.desc: get the module information of the hap with the added field mainAbility
*/
it
(
'
bms_getHapModuleInfo_0400
'
,
0
,
async
function
(
done
)
{
let
dataInfo
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME3
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
bundle
.
getBundleInfo
(
BUNDLE_NAME3
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
async
(
err
,
result
)
=>
{
expect
(
JSON
.
stringify
(
result
)).
assertEqual
(
JSON
.
stringify
(
dataInfo
));
expect
(
result
.
hapModuleInfos
.
length
).
assertEqual
(
1
);
if
(
result
.
hapModuleInfos
.
length
==
1
)
{
let
hapModuleInfo
=
result
.
hapModuleInfos
[
0
];
expect
(
hapModuleInfo
.
name
).
assertEqual
(
THIRD_FIVE_HAP_NAME
);
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
MODULE_NAME
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
ICON
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
LABEL
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
LABEL_ID
);
expect
(
hapModuleInfo
.
iconId
).
assertEqual
(
16777219
);
expect
(
hapModuleInfo
.
backgroundImg
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
deviceTypes
[
0
]).
assertEqual
(
DEVICE_TYPES
);
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
"
com.example.third5.AMainAbility
"
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
done
();
}
});
});
/*
* @tc.number: bms_getHapModuleInfo_0600
* @tc.name: get hapModuleInfo from the system through getBundleInfo
* @tc.desc: get module information of mainAbility system application
*/
it
(
'
bms_getHapModuleInfo_0600
'
,
0
,
async
function
(
done
)
{
let
dataInfo
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME5
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
bundle
.
getBundleInfo
(
BUNDLE_NAME5
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
callback
);
function
callback
(
err
,
data
)
{
expect
(
JSON
.
stringify
(
data
)).
assertEqual
(
JSON
.
stringify
(
dataInfo
));
expect
(
data
.
hapModuleInfos
.
length
).
assertEqual
(
1
);
if
(
data
.
hapModuleInfos
.
length
==
1
)
{
let
hapModuleInfo
=
data
.
hapModuleInfos
[
0
];
expect
(
hapModuleInfo
.
name
).
assertEqual
(
SYSTEM_ONE_HAP_NAME
);
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
MODULE_NAME
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
ICON
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
LABEL
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
LABEL_ID
);
expect
(
hapModuleInfo
.
iconId
).
assertEqual
(
16777219
);
expect
(
hapModuleInfo
.
backgroundImg
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
deviceTypes
[
0
]).
assertEqual
(
DEVICE_TYPES
);
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
"
com.example.system1.MainAbility
"
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
}
done
();
}
});
function
checkHapMoudleInfos
(
info
)
{
expect
(
info
.
description
).
assertEqual
(
''
);
expect
(
info
.
descriptionId
).
assertEqual
(
0
);
expect
(
info
.
icon
).
assertEqual
(
ICON
);
expect
(
info
.
labelId
).
assertEqual
(
LABEL_ID
);
expect
(
info
.
iconId
).
assertEqual
(
ICON_ID
);
expect
(
info
.
label
).
assertEqual
(
LABEL
);
expect
(
info
.
backgroundImg
).
assertEqual
(
""
);
expect
(
info
.
supportedModes
).
assertEqual
(
0
);
expect
(
info
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
info
.
deviceTypes
[
0
]).
assertEqual
(
DEVICE_TYPES
);
expect
(
info
.
abilityInfo
.
length
).
assertLarger
(
0
);
}
})}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
ActsBmsHapModuleTest
from
'
./ActsBmsHapModuleTest.test.js
'
export
default
function
testsuite
()
{
ActsBmsHapModuleTest
()
}
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
6589be6f
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"actsbmshapmoduletest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
6589be6f
6.6 KB
bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsJsTest.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
pkg
from
'
@system.package
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
const
NUM_TWO
=
2
;
const
NUM_FOUR
=
4
;
const
BUNDLE_NAME2
=
'
com.example.third2
'
;
const
BUNDLE_NAME3
=
'
com.example.third5
'
;
const
BUNDLE_NAME4
=
'
com.example.js
'
;
const
BUNDLE_NAME5
=
'
com.example.c
'
;
const
ABILITIY_NAME1
=
'
com.example.third2.MainAbility
'
;
const
ABILITIY_NAME2
=
'
com.example.third5.AMainAbility
'
;
const
ABILITIY_NAME3
=
'
com.example.third5.BMainAbility
'
;
const
ABILITIY_NAME4
=
'
com.example.js.MainAbility
'
;
const
ABILITIY_NAME5
=
'
.MainAbility
'
;
const
ABILITIY_NAME6
=
"
com.example.third2.MainAbilityA
"
;
const
ABILITIY_NAME7
=
"
com.example.third5.MainAbilityA
"
;
const
ABILITIY_NAME8
=
"
com.example.third5.MainAbilityB
"
;
export
default
function
ActsBmsJsTest
()
{
describe
(
'
ActsBmsJsTest
'
,
function
()
{
/*
* @tc.number: bms_getJsAbility_0100
* @tc.name: test the multi js ability
* @tc.desc: 1.install a js hap which has an ability with full domain name
* 2.check the ability name by the interface of getBundleInfo
*/
it
(
'
bms_getJsAbility_0100
'
,
0
,
async
function
(
done
)
{
let
result
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
expect
(
result
.
abilityInfos
.
length
).
assertEqual
(
NUM_TWO
);
if
(
result
.
abilityInfos
.
length
==
NUM_TWO
)
{
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
let
abilityInfo2
=
result
.
abilityInfos
[
1
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME1
);
expect
(
abilityInfo2
.
name
).
assertEqual
(
ABILITIY_NAME6
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
abilityInfo1
.
isVisible
).
assertEqual
(
true
);
expect
(
abilityInfo1
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
deviceTypes
[
0
]).
assertEqual
(
'
default
'
);
expect
(
abilityInfo1
.
process
).
assertEqual
(
BUNDLE_NAME2
);
expect
(
abilityInfo1
.
uri
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
bundleName
).
assertEqual
(
BUNDLE_NAME2
);
expect
(
abilityInfo1
.
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
Object
.
keys
(
abilityInfo1
.
applicationInfo
).
length
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
type
).
assertEqual
(
1
);
expect
(
abilityInfo2
.
type
).
assertEqual
(
2
);
expect
(
abilityInfo1
.
orientation
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
launchMode
).
assertEqual
(
1
);
expect
(
abilityInfo1
.
backgroundModes
).
assertEqual
(
0
);
expect
(
abilityInfo2
.
backgroundModes
).
assertEqual
(
510
);
expect
(
abilityInfo1
.
descriptionId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
formEnabled
).
assertEqual
(
false
);
expect
(
abilityInfo1
.
iconId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
labelId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
subType
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
}
done
();
});
/*
* @tc.number: bms_getJsAbility_0200
* @tc.name: test the multi js ability
* @tc.desc: 1.install a js hap with two ability
* 2.check the ability name by the interface of getBundleInfo
*/
it
(
'
bms_getJsAbility_0200
'
,
0
,
async
function
(
done
)
{
let
result
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME3
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
expect
(
result
.
abilityInfos
.
length
).
assertEqual
(
NUM_FOUR
);
if
(
result
.
abilityInfos
.
length
==
NUM_FOUR
)
{
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
let
abilityInfo2
=
result
.
abilityInfos
[
1
];
let
abilityInfo3
=
result
.
abilityInfos
[
2
];
let
abilityInfo4
=
result
.
abilityInfos
[
3
];
checkAbilityInfos
(
abilityInfo1
);
expect
(
abilityInfo2
.
metaData
.
length
).
assertEqual
(
1
);
expect
(
abilityInfo2
.
metaData
[
0
].
name
).
assertEqual
(
"
Data5B
"
);
expect
(
abilityInfo2
.
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
abilityInfo2
.
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo2
.
name
).
assertEqual
(
ABILITIY_NAME3
);
expect
(
abilityInfo3
.
name
).
assertEqual
(
ABILITIY_NAME7
);
expect
(
abilityInfo4
.
name
).
assertEqual
(
ABILITIY_NAME8
);
expect
(
abilityInfo3
.
type
).
assertEqual
(
2
);
expect
(
abilityInfo4
.
type
).
assertEqual
(
2
);
expect
(
abilityInfo3
.
backgroundModes
).
assertEqual
(
511
);
expect
(
abilityInfo4
.
backgroundModes
).
assertEqual
(
129
);
}
done
();
});
/*
* @tc.number: bms_getJsAbility_0300
* @tc.name: test the multi js ability
* @tc.desc: 1.install a js hap which has an ability with short domain name
* 2.check the ability name by the interface of getBundleInfo
*/
it
(
'
bms_getJsAbility_0300
'
,
0
,
async
function
(
done
)
{
let
result
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME4
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
expect
(
result
.
abilityInfos
.
length
).
assertEqual
(
1
);
if
(
result
.
abilityInfos
.
length
==
1
)
{
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME4
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
abilityInfo1
.
isVisible
).
assertEqual
(
true
);
expect
(
abilityInfo1
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
deviceTypes
[
0
]).
assertEqual
(
'
default
'
);
expect
(
abilityInfo1
.
process
).
assertEqual
(
BUNDLE_NAME4
);
expect
(
abilityInfo1
.
uri
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
bundleName
).
assertEqual
(
BUNDLE_NAME4
);
expect
(
abilityInfo1
.
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
Object
.
keys
(
abilityInfo1
.
applicationInfo
).
length
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
type
).
assertEqual
(
1
);
expect
(
abilityInfo1
.
orientation
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
launchMode
).
assertEqual
(
1
);
expect
(
abilityInfo1
.
backgroundModes
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
descriptionId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
formEnabled
).
assertEqual
(
false
);
expect
(
abilityInfo1
.
iconId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
labelId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
subType
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
}
done
();
});
/*
* @tc.number: bms_getJsAbility_0400
* @tc.name: test the multi js ability
* @tc.desc: 1.install a c++ hap which has an ability with short domain name
* 2.check the ability name by the interface of getBundleInfo
*/
it
(
'
bms_getJsAbility_0400
'
,
0
,
async
function
(
done
)
{
let
result
=
await
bundle
.
getBundleInfo
(
BUNDLE_NAME5
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
);
expect
(
result
.
abilityInfos
.
length
).
assertEqual
(
1
);
if
(
result
.
abilityInfos
.
length
==
1
)
{
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME5
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
abilityInfo1
.
isVisible
).
assertEqual
(
true
);
expect
(
abilityInfo1
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
deviceTypes
[
0
]).
assertEqual
(
'
default
'
);
expect
(
abilityInfo1
.
process
).
assertEqual
(
BUNDLE_NAME5
);
expect
(
abilityInfo1
.
uri
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
bundleName
).
assertEqual
(
BUNDLE_NAME5
);
expect
(
abilityInfo1
.
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
Object
.
keys
(
abilityInfo1
.
applicationInfo
).
length
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
type
).
assertEqual
(
1
);
expect
(
abilityInfo1
.
orientation
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
launchMode
).
assertEqual
(
1
);
expect
(
abilityInfo1
.
backgroundModes
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
descriptionId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
formEnabled
).
assertEqual
(
false
);
expect
(
abilityInfo1
.
iconId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
labelId
).
assertLarger
(
0
);
expect
(
abilityInfo1
.
subType
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
}
done
();
});
function
checkAbilityInfos
(
info
)
{
expect
(
info
.
name
).
assertEqual
(
ABILITIY_NAME2
);
expect
(
info
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
info
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
info
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
info
.
isVisible
).
assertEqual
(
true
);
expect
(
info
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
info
.
deviceTypes
[
0
]).
assertEqual
(
'
default
'
);
expect
(
info
.
process
).
assertEqual
(
BUNDLE_NAME3
);
expect
(
info
.
uri
).
assertEqual
(
""
);
expect
(
info
.
bundleName
).
assertEqual
(
BUNDLE_NAME3
);
expect
(
info
.
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
Object
.
keys
(
info
.
applicationInfo
).
length
).
assertLarger
(
0
);
expect
(
info
.
type
).
assertEqual
(
1
);
expect
(
info
.
orientation
).
assertEqual
(
0
);
expect
(
info
.
launchMode
).
assertEqual
(
1
);
expect
(
info
.
backgroundModes
).
assertEqual
(
0
);
expect
(
info
.
descriptionId
).
assertLarger
(
0
);
expect
(
info
.
formEnabled
).
assertEqual
(
false
);
expect
(
info
.
iconId
).
assertLarger
(
0
);
expect
(
info
.
labelId
).
assertLarger
(
0
);
expect
(
info
.
subType
).
assertEqual
(
0
);
expect
(
info
.
readPermission
).
assertEqual
(
""
);
expect
(
info
.
writePermission
).
assertEqual
(
""
);
expect
(
info
.
targetAbility
).
assertEqual
(
""
);
expect
(
info
.
metaData
.
length
).
assertEqual
(
1
);
expect
(
info
.
metaData
[
0
].
name
).
assertEqual
(
"
Data5A
"
);
expect
(
info
.
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
info
.
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
info
.
enabled
).
assertEqual
(
true
);
}
})}
bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/List.test.js
浏览文件 @
6589be6f
...
...
@@ -13,7 +13,9 @@
* limitations under the License.
*/
import
ActsBmsHasInstalldTest
from
'
./ActsBmsHasInstalldTest.test.js
'
import
ActsBmsHasInstalldTest
from
'
./ActsBmsJsTest.test.js
'
import
ActsBmsJsTest
from
'
./ActsBmsHasInstalldTest.test.js
'
export
default
function
testsuite
()
{
ActsBmsHasInstalldTest
()
ActsBmsJsTest
()
}
bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
浏览文件 @
6589be6f
...
...
@@ -37,6 +37,142 @@ describe('ActsBmsJsUnPermissionTest', function () {
})
});
/*
* @tc.number: getApplicationInfo_1900
* @tc.name: getApplicationInfoUnPermissionUserId
* @tc.desc: test getApplicationInfo
*/
it
(
'
getApplicationInfoUnPermissionUserId
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: getApplicationInfos_1500
* @tc.name: getApplicationInfosUnPermissionUserId
* @tc.desc: test getAllApplicationInfo
*/
it
(
'
getApplicationInfosUnPermissionUserId
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: getBundleInfo_2300
* @tc.name: getBundleInfoUnPermissionUserId
* @tc.desc: test getBundleInfo
*/
it
(
'
getBundleInfoUnPermissionUserId
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: getBundleInfos_1000
* @tc.name: getAllBundleInfoUnPermission
* @tc.desc: test getAllBundleInfo
*/
it
(
'
getAllBundleInfoUnPermission
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAllBundleInfo
(
DEFAULT_FLAG
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getAllBundleInfo
(
DEFAULT_FLAG
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0015
* @tc.name: queryAbilityByWantUnPermission
* @tc.desc: test queryAbilityByWant
*/
it
(
'
queryAbilityByWantUnPermission
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
({
bundleName
:
LAUNCHER_BUNDLE_NAME
,
abilityName
:
LAUNCHER_MAIN_ABILITY
},
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
queryAbilityByWant
({
bundleName
:
LAUNCHER_BUNDLE_NAME
,
abilityName
:
LAUNCHER_MAIN_ABILITY
},
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
console
.
info
(
"
data ===================:
"
+
data
);
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0010
* @tc.name: getLaunchWantForBundleUnPermission
* @tc.desc: test getLaunchWantForBundle
*/
it
(
'
getLaunchWantForBundleUnPermission
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getLaunchWantForBundle
(
LAUNCHER_BUNDLE_NAME
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getLaunchWantForBundle
(
LAUNCHER_BUNDLE_NAME
,
(
err
,
data
)
=>
{
expect
(
err
.
code
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_GETABILITYLABELP_0006
* @tc.name: getAbilityLabelUnPermission
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
'
getAbilityLabelUnPermission
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAbilityLabel
(
LAUNCHER_BUNDLE_NAME
,
LAUNCHER_MAIN_ABILITY
)
.
then
((
data
)
=>
{
expect
().
assertFail
();
})
.
catch
((
error
)
=>
{
expect
(
error
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getAbilityLabel
(
LAUNCHER_BUNDLE_NAME
,
LAUNCHER_MAIN_ABILITY
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_GETABILITYINFO_0006
* @tc.name: getAbilityInfoUnPermission
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn
0 → 100644
浏览文件 @
6589be6f
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsMetaDataTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsMetaDataTest"
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/Test.json
0 → 100644
浏览文件 @
6589be6f
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"60000"
,
"shell-timeout"
:
"60000"
,
"bundle-name"
:
"com.example.actsbmsmetadatatest"
,
"package-name"
:
"com.example.actsbmsmetadatatest"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsBmsMetaDataTest.hap"
,
"bmsSystemBundleTest1.hap"
,
"bmsVendorBundleTest1.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
,
"mkdir /data/test"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap"
,
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap"
,
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap"
,
"bmsSystemBundleTest1.hap->/data/test/bmsSystemBundleTest1.hap"
,
"bmsVendorBundleTest1.hap->/data/test/bmsVendorBundleTest1.hap"
,
"first_right.hap->/data/test/first_right.hap"
,
"second_right.hap->/data/test/second_right.hap"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"bm install -p /data/test/bmsThirdBundleTest1.hap"
,
"bm install -p /data/test/bmsThirdBundleTestA1.hap"
,
"bm install -p /data/test/bmsSystemBundleTest1.hap"
,
"bm install -p /data/test/bmsVendorBundleTest1.hap"
,
"bm install -p /data/test/bmsThirdBundleTest5.hap"
,
"bm install -p /data/test/first_right.hap"
,
"bm install -p /data/test/second_right.hap"
],
"teardown-command"
:
[
"bm uninstall -n com.example.third1"
,
"bm uninstall -n com.example.system1"
,
"bm uninstall -n com.example.vendor1"
,
"bm uninstall -n com.example.third5"
,
"bm uninstall -n com.example.l3jsdemo"
,
"rm -rf /data/test/"
]
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
6589be6f
文件已添加
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json
0 → 100644
浏览文件 @
6589be6f
{
"app"
:
{
"bundleName"
:
"com.example.actsbmsmetadatatest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsbmsmetadatatest"
,
"name"
:
".entry"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
},
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<!--
Copyright (c) 2022 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.
-->
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/MainAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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.
*/
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
'
Test MetaData
'
},
onInit
()
{
this
.
title
=
'
Test MetaData
'
;
},
onShow
()
{
console
.
info
(
'
onReady finish
'
)
},
onReady
()
{
},
onBackPress
(){
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/i18n/en-US.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
6589be6f
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
6589be6f
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.hml
0 → 100644
浏览文件 @
6589be6f
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestAbility/pages/index/index.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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.
*/
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/test/ActsBmsMetaDataTest.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
const
BUNDLE_NAME2
=
'
com.example.third5
'
;
const
BUNDLE_NAME3
=
'
com.example.noexist
'
;
const
BUNDLE_NAME4
=
'
com.example.system1
'
;
const
BUNDLE_NAME5
=
'
com.example.vendor1
'
;
const
BUNDLE_NAME6
=
'
com.example.l3jsdemo
'
;
const
ABILITY_NAME1
=
'
com.example.third1.MainAbility
'
;
const
ABILITY_NAME2
=
'
com.example.third5.AMainAbility
'
;
const
ABILITY_NAME3
=
'
com.example.noexist.MainAbility
'
;
const
ABILITY_NAME4
=
'
com.example.system1.MainAbility
'
;
const
ABILITY_NAME5
=
'
com.example.vendor1.MainAbility
'
;
const
ABILITY_NAME6
=
'
com.example.l3jsdemo.MainAbility
'
;
let
userId
=
0
;
export
default
function
ActsBmsMetaDataTest
()
{
describe
(
'
ActsBmsMetaDataTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: bms_getMetaData_0100
* @tc.name: test to get meta data for an application.
* @tc.desc: get an ability's meta data when update.
*/
it
(
'
bms_getMetaData_0100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME1
,
"
abilityName
"
:
ABILITY_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
DataA1
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME1
,
"
abilityName
"
:
ABILITY_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
DataA1
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
done
();
});
});
/*
* @tc.number: bms_getMetaData_0200
* @tc.name: test to get meta data for an application.
* @tc.desc: get an ability's meta data which contains two HAP packages.
*/
it
(
'
bms_getMetaData_0200
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME6
,
"
abilityName
"
:
ABILITY_NAME6
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
let
metaDataInfo
=
dataInfos
[
0
].
metaData
;
expect
(
metaDataInfo
[
0
].
name
).
assertEqual
(
"
Data3
"
);
expect
(
metaDataInfo
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaDataInfo
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME6
,
"
abilityName
"
:
ABILITY_NAME6
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data3
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
done
();
});
});
/*
* @tc.number: bms_getMetaData_0400
* @tc.name: test to get meta data for an application.
* @tc.desc: get an ability's meta data which has two ability.
*/
it
(
'
bms_getMetaData_0400
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
bundleName
:
BUNDLE_NAME2
,
abilityName
:
ABILITY_NAME2
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data5A
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME2
,
"
abilityName
"
:
ABILITY_NAME2
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data5A
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
done
();
});
});
/*
* @tc.number: bms_getMetaData_0500
* @tc.name: test to get meta data for an application that does not exist.
* @tc.desc: get an ability's meta data which does not exist.
*/
it
(
'
bms_getMetaData_0500
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
bundleName
:
BUNDLE_NAME3
,
abilityName
:
ABILITY_NAME3
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
expect
(
dataInfos
).
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
1
);
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME3
,
"
abilityName
"
:
ABILITY_NAME3
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
expect
(
err
).
assertEqual
(
1
);
expect
(
dataInfos
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
done
();
});
});
/*
* @tc.number: bms_getMetaData_0600
* @tc.name: test to get meta data for a system application.
* @tc.desc: get a system ability's meta data.
*/
it
(
'
bms_getMetaData_0600
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
bundleName
:
BUNDLE_NAME4
,
abilityName
:
ABILITY_NAME4
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data1S
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME4
,
"
abilityName
"
:
ABILITY_NAME4
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data1S
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
$string:mainability_description
"
);
done
();
});
});
/*
* @tc.number: bms_getMetaData_0700
* @tc.name: test to get meta data for a vendor application.
* @tc.desc: get a vendor ability's meta data.
*/
it
(
'
bms_getMetaData_0700
'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryAbilityByWant
(
{
bundleName
:
BUNDLE_NAME5
,
abilityName
:
ABILITY_NAME5
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
vendorName
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
vendorValue
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
vendorcustomizeData
"
);
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
});
bundle
.
queryAbilityByWant
(
{
"
bundleName
"
:
BUNDLE_NAME5
,
"
abilityName
"
:
ABILITY_NAME5
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
,
(
err
,
dataInfos
)
=>
{
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
vendorName
"
);
expect
(
metaData
[
0
].
value
).
assertEqual
(
"
vendorValue
"
);
expect
(
metaData
[
0
].
extra
).
assertEqual
(
"
vendorcustomizeData
"
);
done
();
});
});
})}
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
6589be6f
/*
* 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
ActsBmsMetaDataTest
from
'
./ActsBmsMetaDataTest.test.js
'
export
default
function
testsuite
()
{
ActsBmsMetaDataTest
()
}
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
6589be6f
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"actsbmsmetadatatest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
6589be6f
6.6 KB
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetAbilityIcon.test.ets
0 → 100644
浏览文件 @
6589be6f
/*
* 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 image from '@ohos.multimedia.image'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
const BUNDLE_NAME = "com.open.harmony.packagemag";
const ABILITIY_NAME = "com.open.harmony.packagemag.MainAbility";
const SERVICE_NAME = "com.open.harmony.packagemag.ServiceAbility";
const BUNDLE_NAME_OTHER = "com.example.l3jsdemo";
const ABILITIY_NAME_OTHER = "com.example.l3jsdemo.MainAbility";
const BUNDLE_NAME_ERROR = "com.ohos.packagemag";
const ABILITIY_NAME_ERROR = "com.ohos.packagemag.MainAbility";
export default function getAbilityIcon() {
describe('ActsBmsGetAbilityIconTest', function () {
/*
* @tc.number: bms_getAbilityIcon_0100
* @tc.name: test getAbilityIcon
* @tc.desc: get the abilityIcon
*/
it('bms_getAbilityIcon_0100', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME_OTHER, ABILITIY_NAME_OTHER).then(pixelmap => {
console.log('bms_getAbilityIcon_0100 success: ' + pixelmap.getBytesNumberPerRow());
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getAbilityIcon(BUNDLE_NAME_OTHER, ABILITIY_NAME_OTHER, (err, pixelmap) => {
expect(err).assertEqual(0);
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
done();
});
});
/*
* @tc.number: bms_getAbilityIcon_0200
* @tc.name: test getAbilityIcon
* @tc.desc: get the abilityIcon
*/
it('bms_getAbilityIcon_0200', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME).then(pixelmap => {
console.log('bms_getAbilityIcon_0200 success: ' + pixelmap.getBytesNumberPerRow());
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME, (err, pixelmap) => {
expect(err).assertEqual(0);
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
done();
});
});
/*
* @tc.number: bms_getAbilityIcon_0300
* @tc.name: test getAbilityIcon
* @tc.desc: get the abilityIcon
*/
it('bms_getAbilityIcon_0300', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, SERVICE_NAME).then(pixelmap => {
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertEqual(1);
});
bundle.getAbilityIcon(BUNDLE_NAME, SERVICE_NAME, (err, pixelmap) => {
expect(err).assertEqual(1);
done();
});
});
/*
* @tc.number: bms_getAbilityIcon_0400
* @tc.name: test getAbilityIcon
* @tc.desc: get the abilityIcon
*/
it('bms_getAbilityIcon_0400', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME_ERROR).then(pixelmap => {
expect(pixelmap !== null).assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err))
expect(err).assertEqual(1);
});
await bundle.getAbilityIcon(BUNDLE_NAME_ERROR, ABILITIY_NAME).then(pixelmap => {
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err))
expect(err).assertEqual(1);
});
await bundle.getAbilityIcon("", "").then(pixelmap => {
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err))
expect(err).assertEqual(1);
});
bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME_ERROR, (err, pixelmap) => {
console.log('bms_getAbilityIcon_0100 success: ' + pixelmap);
expect(err).assertEqual(1);
bundle.getAbilityIcon(BUNDLE_NAME_ERROR, ABILITIY_NAME, (err, pixelmap) => {
expect(err).assertEqual(1);
bundle.getAbilityIcon("", "", (err, pixelmap) => {
expect(err).assertEqual(1);
done();
});
});
});
});
/*
* @tc.number: bms_getAbilityIcon_0500
* @tc.name: test getAbilityIcon
* @tc.desc: get the abilityIcon
*/
it('bms_getAbilityIcon_0500', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, undefined).then(pixelmap => {
expect(pixelmap).assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertEqual(2);
});
await bundle.getAbilityIcon(undefined, ABILITIY_NAME).then(pixelmap => {
expect(pixelmap).assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertEqual(2);
});
await bundle.getAbilityIcon(undefined, undefined).then(pixelmap => {
expect(pixelmap).assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertEqual(2);
});
bundle.getAbilityIcon(BUNDLE_NAME, undefined, (err, pixelmap) => {
console.log('bms_getAbilityIcon_0100 success: ' + pixelmap);
expect(err).assertEqual(2);
bundle.getAbilityIcon(undefined, ABILITIY_NAME, (err, pixelmap) => {
expect(err).assertEqual(2);
bundle.getAbilityIcon(undefined, undefined, (err, pixelmap) => {
expect(err).assertEqual(2);
done();
});
});
});
});
});
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetAbilityLabelJsUnit.test.ets
0 → 100644
浏览文件 @
6589be6f
/**
* 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 { describe, it, expect } from 'hypium/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const SERVICE_ABILITY_NAME = 'com.open.harmony.packagemag.ServiceAbility';
const OTHER_BUNDLE_NAME = 'com.example.l3jsdemo';
const OTHER_ABILITY_NAME = 'com.example.l3jsdemo.MainAbility';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
export default function getAbilityLabel() {
describe('getAbilityLabel_test', function () {
/*
* @tc.number: getAbilityLabel_test_0100
* @tc.name: Test getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('getAbilityLabel_test_0100', 0, async function (done) {
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME).then((data) => {
expect(data).assertEqual("entry_MainAbility");
}).catch((error) => {
expect(error).assertFail();
});
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
expect(error).assertNull();
expect(data).assertEqual("entry_MainAbility");
done();
});
});
/*
* @tc.number: getAbilityLabel_test_0200
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('getAbilityLabel_test_0200', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
expect(data).assertEqual("bmsfirstright");
}).catch((error) => {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
expect(data).assertEqual("bmsfirstright");
expect(error).assertNull();
done();
});
});
/*
* @tc.number: getAbilityLabel_test_0300
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('getAbilityLabel_test_0300', 0, async function (done) {
await Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
done();
});
});
/*
* @tc.number: getAbilityLabel_test_0400
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('getAbilityLabel_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR).then((data) => {
expect(data).assertFail();
}).catch((error) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
expect(error).assertEqual(1);
});
await Bundle.getAbilityLabel("", "").then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel("", "", (error, data) => {
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
done();
});
});
});
/*
* @tc.number: getAbilityLabel_test_0500
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('getAbilityLabel_test_0500', 0, async function (done) {
await Bundle.getAbilityLabel(undefined, OTHER_ABILITY_NAME).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, undefined).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.getAbilityLabel(undefined, undefined).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
Bundle.getAbilityLabel(undefined, OTHER_ABILITY_NAME, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, undefined, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel(undefined, undefined, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
done();
});
});
});
});
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetLaunchWantForBundle.test.ets
0 → 100644
浏览文件 @
6589be6f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file expect 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 bundleMgr from '@ohos.bundle';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index';
const NAME1 = "com.example.third1";
const NAME2 = "com.example.l3jsdemo";
const NAME3 = "com.notexist.com";
const ABILITYNAME1 = "com.example.third1.MainAbility";
const ABILITYNAME2 = "com.example.l3jsdemo.MainAbility";
export default function getLaunchWantForBundle() {
describe('GetLaunchWantForBundleTest', function () {
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0069
* @tc.name: testGetLaunchWantForBundle.
* @tc.desc: Test getLaunchWantForBundle api by promise and callback.
* @tc.size MediumTest
* @tc.type Function
* @tc.level Level 1
*/
it('testGetLaunchWantForBundle', 0, async function (done) {
await bundleMgr.getLaunchWantForBundle(NAME1).then(res => {
expect(res.bundleName).assertEqual(NAME1);
expect(res.abilityName).assertEqual(ABILITYNAME1);
expect(res.deviceId).assertEqual('');
expect(res.action).assertEqual('action.system.home');
expect(res.entities[0]).assertEqual('entity.system.home');
}).catch(err => {
expect(err).assertFail();
});
bundleMgr.getLaunchWantForBundle(NAME1, (err, res) => {
expect(err.code).assertEqual(0);
expect(res.bundleName).assertEqual(NAME1);
expect(res.abilityName).assertEqual(ABILITYNAME1);
expect(res.deviceId).assertEqual('');
expect(res.action).assertEqual('action.system.home');
expect(res.entities[0]).assertEqual('entity.system.home');
done();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0012
* @tc.name: testGetLaunchWantForBundleWithManyHaps.
* @tc.desc: Test getLaunchWantForBundle api by promise and callback.
* @tc.size MediumTest
* @tc.type Function
* @tc.level Level 1
*/
it('testGetLaunchWantForBundleWithManyHaps', 0, async function (done) {
await bundleMgr.getLaunchWantForBundle(NAME2).then(res => {
expect(res.bundleName).assertEqual(NAME2);
expect(res.abilityName).assertEqual(ABILITYNAME2);
expect(res.deviceId).assertEqual('');
expect(res.action).assertEqual('action.system.home');
expect(res.entities[0]).assertEqual('entity.system.home');
}).catch(err => {
expect(err).assertFail();
});
bundleMgr.getLaunchWantForBundle(NAME2, (err, res) => {
expect(err.code).assertEqual(0);
expect(res.bundleName).assertEqual(NAME2);
expect(res.abilityName).assertEqual(ABILITYNAME2);
expect(res.deviceId).assertEqual('');
expect(res.action).assertEqual('action.system.home');
expect(res.entities[0]).assertEqual('entity.system.home');
done();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0013
* @tc.name: testGetLaunchWantForBundleWithNotExist.
* @tc.desc: Test getLaunchWantForBundle api by promise and callback.
* @tc.size MediumTest
* @tc.type Function
* @tc.level Level 2
*/
it('testGetLaunchWantForBundleWithNotExist', 0, async function (done) {
await bundleMgr.getLaunchWantForBundle(NAME3).then(res => {
expect().assertFail();
}).catch(err => {
expect(err.code).assertEqual(1);
});
bundleMgr.getLaunchWantForBundle(NAME3, (err, res) => {
if (err) {
expect(err.code).assertEqual(1);
done();
return;
}
expect().assertFail();
done();
});
});
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0014
* @tc.name: testGetLaunchWantForBundleWithInvalidParam.
* @tc.desc: Test getLaunchWantForBundle api by promise and callback.
* @tc.size MediumTest
* @tc.type Function
* @tc.level Level 3
*/
it('testGetLaunchWantForBundleWithInvalidParam', 0, async function (done) {
await bundleMgr.getLaunchWantForBundle(null).then(res => {
expect().assertFail();
}).catch(err => {
expect(err.code).assertEqual(1);
});
bundleMgr.getLaunchWantForBundle(null, (err, res) => {
if (err) {
expect(err.code).assertEqual(1);
done();
return;
}
expect().assertFail();
done();
});
});
});
}
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetNameForUid.test.ets
0 → 100644
浏览文件 @
6589be6f
/*
* 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 'hypium/index'
const BUNDLE_NAME1 = 'com.example.l3jsdemo';
const BUNDLE_NAME2 = 'com.open.harmony.packagemag';
export default function getNameForUid() {
describe('ActsBmsgetNameForUidTest', function () {
/**
* @tc.number getNameForUid_0100
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with other hap.
*/
it('getNameForUid_0100', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT);
await bundle.getNameForUid(dataInfo.uid).then(data => {
expect(data).assertEqual(BUNDLE_NAME1);
}).catch(err => {
console.info("getNameForUid fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getNameForUid(dataInfo.uid, (err, data) => {
console.info("getNameForUid result:" + JSON.stringify(data));
expect(data).assertEqual(BUNDLE_NAME1);
expect(err).assertEqual(0);
done();
});
});
/**
* @tc.number getNameForUid_0200
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with hap.
*/
it('getNameForUid_0200', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME2,bundle.BundleFlag.GET_BUNDLE_DEFAULT);
await bundle.getNameForUid(dataInfo.uid).then(data => {
expect(data).assertEqual(BUNDLE_NAME2);
}).catch(err => {
console.info("getNameForUid fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getNameForUid(dataInfo.uid, (err, data) => {
console.info("getNameForUid result:" + JSON.stringify(data));
expect(data).assertEqual(BUNDLE_NAME2);
expect(err).assertEqual(0);
done();
});
});
/**
* @tc.number getNameForUid_0300
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with notexist hap.
*/
it('getNameForUid_0300', 0, async function (done) {
await bundle.getNameForUid(123456).then(data => {
expect(data).assertFail();
}).catch(err => {
console.info("getNameForUid fail:" + JSON.stringify(err));
expect(err).assertEqual(1);
});
bundle.getNameForUid(123456, (err, data) => {
console.info("getNameForUid result:" + JSON.stringify(data));
expect(err).assertEqual(1);
done()
});
});
/**
* @tc.number getNameForUid_0400
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with error param.
*/
it('getNameForUid_0400', 0, async function (done) {
await bundle.getNameForUid(undefined).then(data => {
expect(data).assertFail();
}).catch(err => {
console.info("getNameForUid fail:" + JSON.stringify(err));
expect(err).assertEqual(2);
});
bundle.getNameForUid(undefined, (err, data) => {
console.info("getNameForUid result:" + JSON.stringify(data));
expect(err).assertEqual(2);
done()
});
});
});
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetQueryAbilityByWant.test.ets
0 → 100644
浏览文件 @
6589be6f
此差异已折叠。
点击以展开。
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
0 → 100644
浏览文件 @
6589be6f
/**
* 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 { describe, it, expect } from 'hypium/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.example.l3jsdemo';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const ABILITY_NAME_OTHER = 'com.example.l3jsdemo.MainAbility';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
const ABILITY_ERROR1 = {
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
};
const ABILITY_ERROR2 = {
bundleName: "",
name: ABILITY_NAME
};
const ABILITY_ERROR3 = {
bundleName: BUNDLE_NAME,
name: ""
};
const ABILITY_ERROR4 = {
bundleName: undefined,
name: ABILITY_NAME
};
const ABILITY_ERROR5 = {
bundleName: BUNDLE_NAME,
name: undefined
};
const ABILITY_ERROR6 = {
bundleName: undefined,
name: undefined
};
const ABILITY_ERROR7 = {
bundleName: "",
name: ""
};
export default function isAbilityEnabledETSUnit() {
describe('isAbilityEnabled_test', function () {
/*
* @tc.number: isAbilityEnabled_test_0100
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface
*/
it('isAbilityEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
if (error.code != 0) {
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
expect(data).assertTrue();
done();
});
});
/*
* @tc.number: isAbilityEnabled_test_0200
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0200', 0, async function (done) {
let abilityInfo1 = generateAbilityInfoForTest(ABILITY_ERROR1.bundleName,ABILITY_ERROR1.name);
let abilityInfo2 = generateAbilityInfoForTest(ABILITY_ERROR2.bundleName,ABILITY_ERROR2.name);
let abilityInfo3 = generateAbilityInfoForTest(ABILITY_ERROR3.bundleName,ABILITY_ERROR3.name);
let abilityInfo7 = generateAbilityInfoForTest(ABILITY_ERROR7.bundleName,ABILITY_ERROR7.name);
Bundle.isAbilityEnabled(abilityInfo1).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(abilityInfo2).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(abilityInfo3).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(abilityInfo7).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(abilityInfo1, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(abilityInfo2, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(abilityInfo3, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(abilityInfo7, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
done();
});
});
});
});
});
/*
* @tc.number: isAbilityEnabled_test_0300
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0300', 0, async function (done) {
let abilityInfo4 = generateAbilityInfoForTest(ABILITY_ERROR4.bundleName,ABILITY_ERROR4.name);
let abilityInfo5 = generateAbilityInfoForTest(ABILITY_ERROR5.bundleName,ABILITY_ERROR5.name);
let abilityInfo6 = generateAbilityInfoForTest(ABILITY_ERROR6.bundleName,ABILITY_ERROR6.name);
Bundle.isAbilityEnabled(abilityInfo4).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error.code).assertEqual(2);
});
Bundle.isAbilityEnabled(abilityInfo5).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error.code).assertEqual(2);
});
Bundle.isAbilityEnabled(abilityInfo6).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error.code).assertEqual(2);
});
Bundle.isAbilityEnabled(abilityInfo4, (error, data) => {
expect(error.code).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(abilityInfo5, (error, data) => {
expect(error.code).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(abilityInfo6, (error, data) => {
expect(error.code).assertEqual(2);
expect(data).assertEqual(undefined);
done();
});
});
});
});
/*
* @tc.number: isAbilityEnabled_test_0400
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface
*/
it('isAbilityEnabled_test_0400', 0, async function (done) {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_OTHER,ABILITY_NAME_OTHER);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertTrue();
done();
});
});
function generateAbilityInfoForTest(bundleName, name) {
let map1 = new Map([
["", [{
"name": "", "value": "", "extra": ""
}]]
]);
let map2 = new Map([
["", [{
"name": "", "value": "", "resource": ""
}]]
]);
let resource = {
"bundleName": "", "moduleName": "", "id": 0
}
let abilityInfo = {
bundleName: bundleName,
name: name,
label: "",
description: "",
icon: "",
labelId: 0,
descriptionId: 0,
iconId: 0,
moduleName: "",
process: "",
targetAbility: "",
backgroundModes: 0,
isVisible: true,
formEnabled: true,
type: 0,
subType: 0,
orientation: 0,
launchMode: 0,
permissions: [], deviceTypes: [], deviceCapabilities: [], readPermission: "", writePermission: "",
applicationInfo: {
name: "", description: "", descriptionId: 0, systemApp: true, enabled: true, label: "",
labelId: "", labelIndex: 0, icon: "", iconId: "", iconIndex: 0, process: "", supportedModes: 0, moduleSourceDirs: [],
permissions: [], moduleInfos: [], entryDir: "", codePath: "", metaData: map1, metadata: map2,
removable: true, accessTokenId: 0, uid: 0, entityType: "", fingerprint: "",
iconResource: resource, labelResource: resource, descriptionResource: resource,
appDistributionType :"" ,appProvisionType :""
},
uri: "", metaData: [], metadata: [], enabled: true, supportWindowMode: [],
maxWindowRatio: 0, minWindowRatio: 0, maxWindowWidth: 0, minWindowWidth: 0, maxWindowHeight: 0, minWindowHeight: 0
};
return abilityInfo;
}
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsApplicationEnabledETSUnit.ets
0 → 100644
浏览文件 @
6589be6f
/**
* 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 { describe, it, expect } from 'hypium/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.example.l3jsdemo';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
export default function IsApplicationEnabledETSUnit() {
describe('isApplicationEnabled_test', function () {
/*
* @tc.number: context_isApplicationEnabled_test_0100
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
*/
it('isApplicationEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.isApplicationEnabled(BUNDLE_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
expect(error.code).assertEqual(0);
expect(data).assertTrue();
done();
});
});
/*
* @tc.number: isApplicationEnabled_test_0200
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
*/
it('isApplicationEnabled_test_0200', 0, async function (done) {
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isApplicationEnabled("").then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isApplicationEnabled(undefined).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error.code).assertEqual(2);
});
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
Bundle.isApplicationEnabled("", (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertFalse();
Bundle.isApplicationEnabled(undefined, (error, data) => {
expect(error.code).assertEqual(2);
expect(data).assertEqual(undefined);
done();
});
});
});
});
/*
* @tc.number: isApplicationEnabled_test_0300
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
*/
it('isApplicationEnabled_test_0300', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.isApplicationEnabled(BUNDLE_NAME_OTHER).then((data) => {
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.isApplicationEnabled(BUNDLE_NAME_OTHER, (error, data) => {
expect(error.code).assertEqual(0);
expect(data).assertTrue();
done();
});
});
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets
浏览文件 @
6589be6f
...
...
@@ -12,16 +12,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import getLaunchWantForBundle from './GetLaunchWantForBundle.test.ets';
import getabilityInfo from './GetabilityInfo.test.ets';
import getApplicationInfoJsunit from './getApplicationInfoJsunit.test.ets';
import getAllAppInfoJsunit from './getAllApplicationInfoJsunit.test.ets';
import getAbilityLabelJsUnit from "./GetAbilityLabelJsUnit.test.ets";
import isAbilityEnableETSUnit from "./IsAbilityEnabledETSUnit.ets";
import isApplicationEnabledETSUnit from "./IsApplicationEnabledETSUnit.ets";
import getAbilityIcon from "./GetAbilityIcon.test.ets";
import getNameForUid from "./GetNameForUid.test.ets";
import getBundleArchiveInfo from "./getBundleArchiveInfo.test.ets";
import getQueryAbilityByWant from './GetQueryAbilityByWant.test.ets';
import isDefaultApplicationTest from './IsDefaultApplication.test.ets';
import getBundleInfoForSelf from './GetBundleInfoForSelf.test.ets';
export default function testsuite() {
getBundleInfoForSelf();
getBundleArchiveInfo();
getAbilityIcon();
getLaunchWantForBundle();
getNameForUid();
getQueryAbilityByWant();
isDefaultApplicationTest();
getApplicationInfoJsunit();
getAllAppInfoJsunit();
getabilityInfo();
getAbilityLabelJsUnit();
isAbilityEnableETSUnit();
isApplicationEnabledETSUnit();
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
0 → 100644
浏览文件 @
6589be6f
此差异已折叠。
点击以展开。
bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
6589be6f
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录