Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9e139fd8
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看板
提交
9e139fd8
编写于
5月 25, 2022
作者:
I
inter515
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增queryExtensionAbilityInfos接口6条用例
Signed-off-by:
N
inter515
<
ry.renyi@huawei.com
>
上级
1b278639
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
322 addition
and
20 deletion
+322
-20
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
...try/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
+268
-10
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn
...ndard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn
+10
-8
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json
...r/sceneProject/bmsstagedemoone/entry/src/main/module.json
+44
-2
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
浏览文件 @
9e139fd8
...
...
@@ -20,6 +20,7 @@ const BUNDLE_NAME1 = "ohos.acts.bundle.stage";
const BUNDLE_NAME2 = "com.noexit.com";
const ABILITY_NAME1 = "ExtensionAbility1";
const ABILITY_NAME2 = "noexitAbility";
const ABILITY_NAME3 = "ServiceAbility";
export default function QueryExtensionAbilityInfos() {
...
...
@@ -79,14 +80,14 @@ export default function QueryExtensionAbilityInfos() {
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
}).catch(err => {
expect(err).assert
Equal(1
);
expect(err).assert
Fail(
);
});
bundle.queryExtensionAbilityInfos({
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, 100, (err, data) => {
if (err) {
expect(err).assert
Equal(1
);
expect(err).assert
Fail(
);
done();
return;
}
...
...
@@ -134,7 +135,7 @@ export default function QueryExtensionAbilityInfos() {
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
}).catch(err => {
expect(err).assert
Equal(1
);
expect(err).assert
Fail(
);
});
bundle.queryExtensionAbilityInfos(
{
...
...
@@ -143,7 +144,7 @@ export default function QueryExtensionAbilityInfos() {
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100, (err, data) => {
if (err) {
expect(err).assert
Equal(1
);
expect(err).assert
Fail(
);
done();
return;
}
...
...
@@ -172,9 +173,9 @@ export default function QueryExtensionAbilityInfos() {
it('SUB_BMS_APPINFO_EXTENSION_0004', 0, async function (done) {
await bundle.queryExtensionAbilityInfos({
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION,
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION,
100).then(data => {
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
...
...
@@ -194,9 +195,9 @@ export default function QueryExtensionAbilityInfos() {
expect(err).assertFail();
});
bundle.queryExtensionAbilityInfos({
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION,
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION,
100, (err, data) => {
if (err) {
expect(err).assertFail();
...
...
@@ -372,6 +373,263 @@ export default function QueryExtensionAbilityInfos() {
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0009
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos get service extensionAbility
*/
it('SUB_BMS_APPINFO_EXTENSION_0009', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME3
}, bundle.ExtensionAbilityType.SERVICE, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100).then(data => {
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual(ABILITY_NAME3);
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(3);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME3
}, bundle.ExtensionAbilityType.SERVICE, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100, (err, data) => {
if (err) {
expect(err).assertEqual(1);
done();
return;
}
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual(ABILITY_NAME3);
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(3);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0010
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos with invalid bundleName
*/
it('SUB_BMS_APPINFO_EXTENSION_0010', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME2
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME2
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => {
if (err) {
expect(err).assertEqual(1);
done();
return;
}
expect(data).assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0011
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos of Implicit query with get permission flag
*/
it('SUB_BMS_APPINFO_EXTENSION_0011', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"action": "actionY"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION,
100).then(data => {
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual("ExtensionAbility1");
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(0);
expect(data[0].permissions[0]).assertEqual("ohos.permission.GET_BUNDLE_INFO");
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
}).catch(err => {
expect(err).assertFail();
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"action": "actionY"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION,
100, (err, data) => {
if (err) {
expect(err).assertFail();
done();
return;
}
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual("ExtensionAbility1");
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(0);
expect(data[0].permissions[0]).assertEqual("ohos.permission.GET_BUNDLE_INFO");
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0012
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos of Implicit query with get permission flag
*/
it('SUB_BMS_APPINFO_EXTENSION_0012', 0, async function (done) {
await bundle.queryExtensionAbilityInfos({
"bundleName": BUNDLE_NAME1,
"action": "actionY12", "uri": "https://www.test.com/query/student/name"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA,
100).then(data => {
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual("ExtensionAbility1");
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(0);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].metadata[0].name).assertEqual("ohos.extension.form");
expect(data[0].metadata[0].value).assertEqual("");
expect(data[0].metadata[0].resource).assertEqual("$profile:form_config");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryExtensionAbilityInfos({
"bundleName": BUNDLE_NAME1,
"action": "actionY12", "uri": "https://www.test.com/query/student/name"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA,
100, (err, data) => {
if (err) {
expect(err).assertFail();
done();
return;
}
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual("ExtensionAbility1");
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(0);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata[0].name).assertEqual("ohos.extension.form");
expect(data[0].metadata[0].value).assertEqual("");
expect(data[0].metadata[0].resource).assertEqual("$profile:form_config");
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0013
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos of Implicit query with get permission flag
*/
it('SUB_BMS_APPINFO_EXTENSION_0013', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"action": "actionY12",
"uri": "https://www.test.com/query/teacher/name"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"action": "actionY12",
"uri": "https://www.test.com/query/teacher/name"
}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100, (err, data) => {
if (err) {
expect(err).assertEqual(1);
done();
return;
}
expect(data).assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0015
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos of Implicit query with invalid param
*/
it('SUB_BMS_APPINFO_EXTENSION_0015', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
null, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
100, (err, data) => {
if (err) {
expect(err).assertEqual(1);
done();
return;
}
expect(data).assertFail();
done();
})
})
function checkApplication(data) {
expect(data[0].applicationInfo.name).assertEqual("ohos.acts.bundle.stage");
expect(data[0].applicationInfo.codePath).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage");
...
...
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn
浏览文件 @
9e139fd8
...
...
@@ -13,16 +13,18 @@
import("//test/xts/tools/build/suite.gni")
ohos_
js_hap_suite
("bmsStageDemo1") {
ohos_
hap
("bmsStageDemo1") {
hap_profile = "entry/src/main/module.json"
hap_name = "bmsStageDemo1"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":
bmsstagedemoone
_js_assets",
":
bmsstagedemoone
_resources",
":
hjs_demo
_js_assets",
":
hjs_demo
_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "bmsStageDemo1"
testonly = true
}
ohos_app_scope("bmsstagedemoone_app_profile") {
...
...
@@ -30,11 +32,11 @@ ohos_app_scope("bmsstagedemoone_app_profile") {
sources = [ "AppScope/resources" ]
}
ohos_js_assets("
bmsstagedemoone
_js_assets") {
ohos_js_assets("
hjs_demo
_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("
bmsstagedemoone
_resources") {
ohos_resources("
hjs_demo
_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":bmsstagedemoone_app_profile" ]
hap_profile = "entry/src/main/module.json"
...
...
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json
浏览文件 @
9e139fd8
...
...
@@ -40,13 +40,27 @@
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"form"
,
"skills"
:
[
{
"actions"
:
[
"actionZ"
]
},
{
"actions"
:
[
"actionZ12"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"pathStartWith"
:
"query/teacher"
}
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
],
"permissions"
:
[
"ohos.permission.GET_BUNDLE_INFO"
]
]
},
{
"name"
:
"ExtensionAbility1"
,
...
...
@@ -54,6 +68,21 @@
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"form"
,
"skills"
:
[
{
"actions"
:
[
"actionY"
]
},
{
"actions"
:
[
"actionY12"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"path"
:
"query/student/name"
}
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
...
...
@@ -61,6 +90,19 @@
}
],
"permissions"
:
[
"ohos.permission.GET_BUNDLE_INFO"
]
},
{
"name"
:
"ServiceAbility"
,
"srcEntrance"
:
"./ets/ServiceAbility/FormAbility.ts"
,
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"service"
,
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
]
}
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录