Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f0e73a66
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看板
未验证
提交
f0e73a66
编写于
5月 31, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3302 新增ExtensionAbility查询用例和application查询用例
Merge pull request !3302 from ry/master
上级
d89684d1
c4b935ab
变更
27
展开全部
隐藏空白更改
内联
并排
Showing
27 changed file
with
1481 addition
and
138 deletion
+1481
-138
appexecfwk/bundle_standard/bundlemanager/BUILD.gn
appexecfwk/bundle_standard/bundlemanager/BUILD.gn
+1
-0
appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
...try/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
+34
-0
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
...standard/bundlemanager/actsbundlemanageretstest/Test.json
+6
-3
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets
...eretstest/entry/src/main/ets/test/GetabilityInfo.test.ets
+0
-7
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
...try/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
+474
-17
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets
...ry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets
+104
-21
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets
...entry/src/main/ets/test/getApplicationInfoJsunit.test.ets
+159
-80
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/ets/ServiceAbility/FormAbility.ts
...edemoone/entry/src/main/ets/ServiceAbility/FormAbility.ts
+37
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json
...r/sceneProject/bmsstagedemoone/entry/src/main/module.json
+73
-2
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/AppScope/app.json
...dlemanager/sceneProject/bmsstagedemotwo/AppScope/app.json
+21
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/AppScope/resources/base/element/string.json
...sstagedemotwo/AppScope/resources/base/element/string.json
+8
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/BUILD.gn
...ndard/bundlemanager/sceneProject/bmsstagedemotwo/BUILD.gn
+43
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/Test.json
...dard/bundlemanager/sceneProject/bmsstagedemotwo/Test.json
+4
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/Application/AbilityStage.ts
...agedemotwo/entry/src/main/ets/Application/AbilityStage.ts
+9
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/FormAbility/FormAbility.ts
...tagedemotwo/entry/src/main/ets/FormAbility/FormAbility.ts
+37
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/MainAbility/MainAbility.ts
...tagedemotwo/entry/src/main/ets/MainAbility/MainAbility.ts
+36
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/ServiceAbility/FormAbility.ts
...edemotwo/entry/src/main/ets/ServiceAbility/FormAbility.ts
+37
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/pages/index/index.ets
.../bmsstagedemotwo/entry/src/main/ets/pages/index/index.ets
+66
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/pages/second/second.ets
...msstagedemotwo/entry/src/main/ets/pages/second/second.ets
+43
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/test/List.test.ets
...ect/bmsstagedemotwo/entry/src/main/ets/test/List.test.ets
+20
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json
...r/sceneProject/bmsstagedemotwo/entry/src/main/module.json
+132
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/element/string.json
...demotwo/entry/src/main/resources/base/element/string.json
+40
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/media/icon.png
...stagedemotwo/entry/src/main/resources/base/media/icon.png
+0
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/profile/form_config.json
...wo/entry/src/main/resources/base/profile/form_config.json
+81
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/profile/main_pages.json
...two/entry/src/main/resources/base/profile/main_pages.json
+6
-0
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/signature/openharmony_sx.p7b
...sceneProject/bmsstagedemotwo/signature/openharmony_sx.p7b
+0
-0
未找到文件。
appexecfwk/bundle_standard/bundlemanager/BUILD.gn
浏览文件 @
f0e73a66
...
...
@@ -57,6 +57,7 @@ group("bundlemanager") {
"sceneProject/bmsscenetwo:bmsJstest2",
"sceneProject/bmssecondright:second_right",
"sceneProject/bmsstagedemoone:bmsStageDemo1",
"sceneProject/bmsstagedemotwo:bmsStageDemo2",
]
}
}
appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets
浏览文件 @
f0e73a66
...
...
@@ -24,6 +24,8 @@ const SELF_BUNDLENAME = "com.example.actsbmsetsunpermissiontest";
const
SELF_ABILITYNAME
=
"com.example.actsbmsetsunpermissiontest.MainAbility"
;
const
BUNDLE_SETTINGS
=
"com.ohos.settings"
;
const
ABILITIY_SETTINGS
=
"com.ohos.settings.MainAbility"
;
const
BUNDLE_NAME1
=
"ohos.acts.bundle.stage"
;
const
ABILITY_NAME1
=
"ExtensionAbility1"
;
export
default
function
actsBmsJsUnPermissionTest
()
{
describe
(
'actsBmsJsUnPermissionTest'
,
function
()
{
...
...
@@ -183,6 +185,38 @@ export default function actsBmsJsUnPermissionTest() {
});
});
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0019
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos no permission
*/
it
(
'SUB_BMS_APPINFO_EXTENSION_0019'
,
0
,
async
function
(
done
)
{
await
bundle
.
queryExtensionAbilityInfos
(
{
"bundleName"
:
BUNDLE_NAME1
,
"abilityName"
:
ABILITY_NAME1
},
bundle
.
ExtensionAbilityType
.
FORM
,
bundle
.
ExtensionFlag
.
GET_EXTENSION_INFO_DEFAULT
,
100
)
.
then
(
data
=>
{
expect
(
data
)
.
assertFail
();
})
.
catch
(
err
=>
{
expect
(
err
)
.
assertEqual
(
1
);
});
bundle
.
queryExtensionAbilityInfos
(
{
"bundleName"
:
BUNDLE_NAME1
,
"abilityName"
:
ABILITY_NAME1
},
bundle
.
ExtensionAbilityType
.
FORM
,
bundle
.
ExtensionFlag
.
GET_EXTENSION_INFO_DEFAULT
,
100
,
(
err
,
data
)
=>
{
if
(
err
)
{
expect
(
err
)
.
assertEqual
(
1
);
done
();
return
;
}
expect
(
data
)
.
assertFail
();
done
();
})
})
async
function
checkAbilityInfo
(
data
)
{
console
.
info
(
"checkAbilityInfo start !!!"
);
expect
(
data
.
bundleName
)
.
assertEqual
(
"com.example.actsbmsetsunpermissiontest"
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
浏览文件 @
f0e73a66
...
...
@@ -28,7 +28,8 @@
"bmsThirdBundleTest1.hap -> /data/bmsThirdBundleTest1.hap "
,
"first_right.hap -> /data/test/first_right.hap"
,
"second_right.hap -> /data/second_right.hap"
,
"bmsStageDemo1.hap -> /data/test/bmsStageDemo1.hap"
"bmsStageDemo1.hap -> /data/test/bmsStageDemo1.hap"
,
"bmsStageDemo2.hap -> /data/test/bmsStageDemo2.hap"
]
},
{
...
...
@@ -37,11 +38,13 @@
"bm install -p /data/bmsThirdBundleTest1.hap"
,
"bm install -p /data/test/first_right.hap"
,
"bm install -p /data/second_right.hap"
,
"bm install -p /data/test/bmsStageDemo1.hap"
"bm install -p /data/test/bmsStageDemo1.hap"
,
"bm install -p /data/test/bmsStageDemo2.hap"
],
"teardown-command"
:[
"bm uninstall -n com.example.third1"
,
"bm uninstall -n com.example.l3jsdemo"
"bm uninstall -n com.example.l3jsdemo"
,
"bm uninstall -n ohos.acts.bundle.stage"
]
}
]
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets
浏览文件 @
f0e73a66
...
...
@@ -227,10 +227,6 @@ export default function GetabilityInfo() {
expect
(
typeof
(
data
.
description
))
.
assertEqual
(
"string"
);
expect
(
data
.
icon
)
.
assertEqual
(
"
$media
:icon"
);
expect
(
typeof
(
data
.
icon
))
.
assertEqual
(
"string"
);
expect
(
data
.
srcPath
)
.
assertEqual
(
"MainAbility"
);
expect
(
typeof
(
data
.
srcPath
))
.
assertEqual
(
"string"
);
expect
(
data
.
srcLanguage
)
.
assertEqual
(
"ets"
);
expect
(
typeof
(
data
.
srcLanguage
))
.
assertEqual
(
"string"
);
expect
(
data
.
isVisible
)
.
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
permissions
))
.
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
deviceCapabilities
))
.
assertEqual
(
true
);
...
...
@@ -284,8 +280,6 @@ export default function GetabilityInfo() {
expect
(
data
.
label
)
.
assertEqual
(
"
$string
:app_name"
);
expect
(
data
.
description
)
.
assertEqual
(
"
$string
:mainability_description"
);
expect
(
data
.
icon
)
.
assertEqual
(
"
$media
:icon"
);
expect
(
data
.
srcPath
)
.
assertEqual
(
""
);
expect
(
data
.
srcLanguage
)
.
assertEqual
(
"js"
);
expect
(
data
.
isVisible
)
.
assertEqual
(
true
);
expect
(
data
.
deviceTypes
[
0
])
.
assertEqual
(
"phone"
);
expect
(
data
.
process
)
.
assertEqual
(
""
);
...
...
@@ -304,7 +298,6 @@ export default function GetabilityInfo() {
expect
(
data
.
readPermission
)
.
assertEqual
(
""
);
expect
(
data
.
writePermission
)
.
assertEqual
(
""
);
expect
(
data
.
targetAbility
)
.
assertEqual
(
""
);
expect
(
data
.
theme
)
.
assertEqual
(
""
);
expect
(
data
.
metaData
.
length
)
.
assertEqual
(
0
);
expect
(
data
.
metadata
.
length
)
.
assertEqual
(
0
);
checkApplicationInfo_other
(
data
.
applicationInfo
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets
浏览文件 @
f0e73a66
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets
浏览文件 @
f0e73a66
...
...
@@ -26,9 +26,12 @@ const TAG_TEST_0300_001 = ' bundle_getAllApplicationInfo_test_0300_007 ';
const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const DEFAULT_FLAG = Bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const BUNDLE_OTHER = 'com.example.third1';
const PATH = "/data/app/el1/bundle/public";
const USER_ID_100 = 100;
export default function
applicationBundleJsuni
t() {
export default function
getAllApplicationBundleTes
t() {
describe('appInfoTest', function () {
...
...
@@ -215,47 +218,95 @@ export default function applicationBundleJsunit() {
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_00
9
* @tc.number: bundle_getApplicationInfo_test_0500_00
10
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_00
1
, 0, async function (done) {
it(TAG_TEST_0500_00
2
, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT').then((data) => {
console.info(TAG_TEST_0500_00
1
+ 'noUserId promise data is: ' + data);
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT'
, USER_ID_100
).then((data) => {
console.info(TAG_TEST_0500_00
2
+ 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_00
1 + 'no
UserId promise error is: ' + error);
console.info(TAG_TEST_0500_00
2 + '
UserId promise error is: ' + error);
errors = error;
expect(errors).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_00
1
, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0500_00
2
, startTime, endTime);
done();
});
/**
* @tc.number:
bundle_getApplicationInfo_test_0500_001
0
* @tc.number:
getApplicationInfos_100
0
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', USER_ID_100).then((data) => {
console.info(TAG_TEST_0500_002 + 'noUserId promise data is: ' + data);
it('getApplicationInfos_1000', 0, async function (done) {
await Bundle.getAllApplicationInfo(DEFAULT_FLAG).then((data) => {
expect(data.length).assertLarger(10);
let flag = 0;
for(let i in data){
if (data[i].name == BUNDLE_OTHER){
flag = 1;
getApplicationInfoSuccessOther(data[i]);
}
}
expect(flag).assertEqual(1);
}).catch((error) => {
expect(error).assertFail();
});
Bundle.getAllApplicationInfo(DEFAULT_FLAG, (err, data) => {
expect(err).assertEqual(0);
expect(data.length).assertLarger(10);
let flag = 0;
for(let i in data){
if (data[i].name == BUNDLE_OTHER){
flag = 1;
getApplicationInfoSuccessOther(data[i]);
}
}
expect(flag).assertEqual(1);
done();
});
});
/**
* @tc.number: getApplicationInfos_1200
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfos_1200', 0, async function (done) {
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT').then((data) => {
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
errors = error;
expect(errors).assertEqual(1);
expect(error).assertEqual(1);
});
await Bundle.getAllApplicationInfo(null).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
await Bundle.getAllApplicationInfo(undefined).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
Bundle.getAllApplicationInfo(undefined, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
Bundle.getAllApplicationInfo(null, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
done();
});
});
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
});
function expectData(msg, data) {
...
...
@@ -326,6 +377,38 @@ export default function applicationBundleJsunit() {
}
}
function getApplicationInfoSuccessOther(data) {
expect(data.name).assertEqual(BUNDLE_OTHER);
expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER);
expect(data.accessTokenId).assertLarger(0);
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId).assertLarger(0);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertLarger(0);
expect(data.label).assertEqual('$string:app_name');
expect(data.labelId).assertLarger(0);
expect(data.systemApp).assertFalse();
expect(data.supportedModes).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.permissions.length).assertEqual(0);
expect(data.moduleSourceDirs.length).assertEqual(1);
expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.moduleInfos.length).assertEqual(1);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' +
BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(JSON.stringify(data.metaData)).assertEqual("{}");
expect(JSON.stringify(data.metadata)).assertEqual("{}");
expect(data.enabled).assertTrue();
expect(data.flags).assertEqual(0);
expect(data.uid).assertLarger(0);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertTrue();
expect(data.fingerprint).assertEqual("");
console.info('check end');
}
});
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets
浏览文件 @
f0e73a66
...
...
@@ -30,10 +30,13 @@ const TAG_TEST_0600_001 = ' bundle_getApplicationInfo_test_0600_0011 ';
const TAG_TEST_0600_002 = ' bundle_getApplicationInfo_test_0600_0012 ';
const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const BUNDLE_OTHER = 'com.example.third1';
const BUNDLE_NOTEXIST = 'com.ohos.package';
const FLAG_DEFAULT = Bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const PATH = "/data/app/el1/bundle/public";
const USER_ID_100 = 100;
export default function
getApplicationInfo
Jsunit() {
export default function
applicationBundle
Jsunit() {
describe('appInfoTest', function () {
...
...
@@ -222,26 +225,6 @@ export default function getApplicationInfoJsunit() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_001, 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', Bundle.BundleFlag.GET_BUNDLE_DEFAULT).then((data) => {
console.info(TAG_TEST_0500_001 + 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_001 + 'noUserId promise error is: ' + error);
expect(error).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_002
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
...
@@ -262,29 +245,6 @@ export default function getApplicationInfoJsunit() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0600_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0600_001, 0, async function (done) {
let errors
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION).then((data) => {
console.info(TAG_TEST_0600_001 + 'other bundleName noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0600_001 + 'other bundleName noUserId promise error is: ' + error);
errors = error
expect(errors).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0600_002
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
...
@@ -294,7 +254,7 @@ export default function getApplicationInfoJsunit() {
it(TAG_TEST_0600_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
let errors
await Bundle.getApplicationInfo(BUNDLE_N
AME_OTHER
,
await Bundle.getApplicationInfo(BUNDLE_N
OTEXIST
,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100).then((data) => {
console.info(TAG_TEST_0600_002 + 'other bundleName UserId promise data is: ' + data);
expect(data).assertFail();
...
...
@@ -309,25 +269,111 @@ export default function getApplicationInfoJsunit() {
});
/**
* @tc.number:
bundle_getApplicationInfo_test_0600_003
* @tc.number:
getApplicationInfo_1300
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it(
TAG_TEST_0600_003
, 0, async function (done) {
it(
'getApplicationInfo_1300'
, 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_BUNDLE
_DEFAULT).then((data) => {
await Bundle.getApplicationInfo(BUNDLE_NAME,
FLAG
_DEFAULT).then((data) => {
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_003, startTime, endTime);
console.info(TAG_TEST_0600_003 + 'noUserId promise data is: ' + data);
expect(typeof (data)).assertEqual("object");
expectData(TAG_TEST_0600_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0600_003, data);
}).catch((error) => {
console.info(TAG_TEST_0600_003 + 'noUserId promise error is: ' + error);
expect(error).assertFail();
});
startTime = await Utils.getNowTime();
Bundle.getApplicationInfo(BUNDLE_NAME, FLAG_DEFAULT, (err, data) => {
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_003, startTime, endTime);
console.info(TAG_TEST_0600_003 + 'noUserId promise data is: ' + data);
expectData(TAG_TEST_0600_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0600_003, data);
expect(err).assertEqual(0);
done();
});
});
/**
* @tc.number: getApplicationInfo_1400
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfo_1400', 0, async function (done) {
await Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT).then((data) => {
console.info('noUserId promise data is: ' + data);
getApplicationInfoSuccessOther(data);
}).catch((error) => {
expect(error).assertFail();
});
Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT, (err, data) => {
console.info('noUserId promise data is: ' + data);
expect(err).assertEqual(0);
getApplicationInfoSuccessOther(data);
done();
});
});
/**
* @tc.number: getApplicationInfo_1500
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfo_1500', 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
});
startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT, (err, data) => {
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
expect(err).assertEqual(1);
expect(JSON.stringify(data)).assertEqual(undefined);
done();
});
});
/**
* @tc.number: getApplicationInfo_1700
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfo_1700', 0, async function (done) {
await Bundle.getApplicationInfo('', FLAG_DEFAULT).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
await Bundle.getApplicationInfo(null, FLAG_DEFAULT).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
await Bundle.getApplicationInfo(BUNDLE_NAME, null).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
Bundle.getApplicationInfo('', FLAG_DEFAULT, (err, data) => {
expect(err).assertEqual(1);
expect(JSON.stringify(data)).assertEqual(undefined);
Bundle.getApplicationInfo(null, FLAG_DEFAULT, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
Bundle.getApplicationInfo(BUNDLE_NAME, null, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
done();
});
});
});
});
function expectData(msg, data) {
...
...
@@ -358,8 +404,8 @@ export default function getApplicationInfoJsunit() {
}
function getApplicationInfoSuccess(msg, data) {
expect(data.name).assertEqual(
'com.open.harmony.packagemag'
);
expect(data.codePath).assertEqual(
'/data/app/el1/bundle/public/com.open.harmony.packagemag'
);
expect(data.name).assertEqual(
BUNDLE_NAME
);
expect(data.codePath).assertEqual(
PATH + '/' + BUNDLE_NAME
);
expect(data.accessTokenId > 0).assertEqual(true);
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId > 0).assertEqual(true);
...
...
@@ -372,16 +418,13 @@ export default function getApplicationInfoJsunit() {
expect(data.supportedModes).assertEqual(0);
expect(data.flags).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
'/com.open.harmony.packagemag');
expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME);
expect(data.enabled).assertEqual(true);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertEqual(true);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual('/data/app/el1/bundle/public/' +
'com.open.harmony.packagemag/com.open.harmony.packagemag');
expect(data.moduleSourceDirs[0]).assertEqual('/data/app/el1/bundle/public/' +
'com.open.harmony.packagemag/com.open.harmony.packagemag');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME);
expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME);
expect(data.permissions[0]).assertEqual("ohos.permission.CHANGE_ABILITY_ENABLED_STATE");
expect(data.permissions[1]).assertEqual("ohos.permission.GET_BUNDLE_INFO");
expect(data.permissions[2]).assertEqual("ohos.permission.GET_BUNDLE_INFO_PRIVILEGED");
...
...
@@ -389,31 +432,67 @@ export default function getApplicationInfoJsunit() {
}
function getApplicationInfoSuccess_plus(msg, data) {
expect(data.name).assertEqual(
'com.open.harmony.packagemag'
);
expect(data.codePath).assertEqual(
'/data/app/el1/bundle/public/com.open.harmony.packagemag'
);
expect(data.accessTokenId
> 0).assertEqual(true
);
expect(data.name).assertEqual(
BUNDLE_NAME
);
expect(data.codePath).assertEqual(
PATH + '/' + BUNDLE_NAME
);
expect(data.accessTokenId
).assertLarger(0
);
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId
> 0).assertEqual(true
);
expect(data.descriptionId
).assertLarger(0
);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId > 0).assertEqual(true);
expect(data.uid > 0).assertEqual(true);
expect(data.iconId).assertLarger(0);
expect(data.label).assertEqual('$string:entry_MainAbility');
expect(data.labelId
> 0).assertEqual(true
);
expect(data.systemApp).assert
Equal(true
);
expect(data.labelId
).assertLarger(0
);
expect(data.systemApp).assert
True(
);
expect(data.supportedModes).assertEqual(0);
expect(data.flags).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual(
'/data/app/el1/bundle/public/com.open.harmony.packagemag' +
'/com.open.harmony.packagemag'
);
expect(data.
enabled).assertEqual(true
);
expect(data.
entityType).assertEqual('unspecified'
);
expect(data.
removable).assertEqual(true
);
expect(data.entryDir).assertEqual(
PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME);
expect(data.permissions.length).assertEqual(0
);
expect(data.
moduleSourceDirs.length).assertEqual(1
);
expect(data.
moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME
);
expect(data.
moduleInfos.length).assertEqual(1
);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual('/data/app/el1/bundle/public/' +
'com.open.harmony.packagemag/com.open.harmony.packagemag');
expect(data.moduleSourceDirs[0]).assertEqual('/data/app/el1/bundle/public/' +
'com.open.harmony.packagemag/com.open.harmony.packagemag');
console.log(msg + ' end ' + JSON.stringify(data));
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' +
BUNDLE_NAME + '/' + BUNDLE_NAME);
expect(JSON.stringify(data.metaData)).assertEqual("{}");
expect(JSON.stringify(data.metadata)).assertEqual("{}");
expect(data.enabled).assertTrue();
expect(data.flags).assertEqual(0);
expect(data.uid).assertLarger(0);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertTrue();
expect(data.fingerprint).assertEqual("");
console.info(msg + ' end ');
}
function getApplicationInfoSuccessOther(data) {
expect(data.name).assertEqual(BUNDLE_OTHER);
expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER);
expect(data.accessTokenId).assertLarger(0);
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId).assertLarger(0);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertLarger(0);
expect(data.label).assertEqual('$string:app_name');
expect(data.labelId).assertLarger(0);
expect(data.systemApp).assertFalse();
expect(data.supportedModes).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.permissions.length).assertEqual(0);
expect(data.moduleSourceDirs.length).assertEqual(1);
expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.moduleInfos.length).assertEqual(1);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' +
BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(JSON.stringify(data.metaData)).assertEqual("{}");
expect(JSON.stringify(data.metadata)).assertEqual("{}");
expect(data.enabled).assertTrue();
expect(data.flags).assertEqual(0);
expect(data.uid).assertLarger(0);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertTrue();
expect(data.fingerprint).assertEqual("");
console.info('check end');
}
});
...
...
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn
浏览文件 @
f0e73a66
...
...
@@ -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/ets/ServiceAbility/FormAbility.ts
0 → 100644
浏览文件 @
f0e73a66
import
FormExtension
from
'
@ohos.application.FormExtension
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json
浏览文件 @
f0e73a66
...
...
@@ -40,13 +40,41 @@
"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"
}
]
},
{
"actions"
:
[
"action_1"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"path"
:
"query/student/name"
}
]
},
{
"actions"
:
[
"actionZ14"
],
"entities"
:
[
"entitiesZ14"
,
"entitiesCommon"
,
"entitiesZZ"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
],
"permissions"
:
[
"ohos.permission.GET_BUNDLE_INFO"
]
]
},
{
"name"
:
"ExtensionAbility1"
,
...
...
@@ -54,13 +82,56 @@
"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"
}
]
},
{
"actions"
:
[
"action_2"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"pathStartWith"
:
"query/teacher"
}
]
},
{
"actions"
:
[
"actionY14"
],
"entities"
:
[
"entitiesY14"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"value"
:
"testExtensionAbilities"
,
"resource"
:
"$profile:form_config"
}
],
"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"
}
]
}
]
...
...
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/AppScope/app.json
0 → 100644
浏览文件 @
f0e73a66
{
"app"
:{
"bundleName"
:
"ohos.acts.bundle.stage"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"debug"
:
false
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"description"
:
"$string:description_application"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
8
,
"targetAPIVersion"
:
8
,
"car"
:{
"apiCompatibleVersion"
:
8
,
"singleUser"
:
false
}
}
}
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
f0e73a66
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/BUILD.gn
0 → 100644
浏览文件 @
f0e73a66
# 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_hap("bmsStageDemo2") {
hap_profile = "entry/src/main/module.json"
hap_name = "bmsStageDemo2"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("bmsstagedemoone_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "entry/src/main/ets"
}
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/bmsstagedemotwo/Test.json
0 → 100644
浏览文件 @
f0e73a66
{
"description"
:
"Configuration for hjunit demo Tests"
,
}
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
f0e73a66
import
AbilityStage
from
"
@ohos.application.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
globalThis
.
stageOnCreateRun
=
1
;
globalThis
.
stageContext
=
this
.
context
;
}
}
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/FormAbility/FormAbility.ts
0 → 100644
浏览文件 @
f0e73a66
import
FormExtension
from
'
@ohos.application.FormExtension
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
f0e73a66
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
[Demo] MainAbility onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
//Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility onBackground
"
)
}
};
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/ServiceAbility/FormAbility.ts
0 → 100644
浏览文件 @
f0e73a66
import
FormExtension
from
'
@ohos.application.FormExtension
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/pages/index/index.ets
0 → 100644
浏览文件 @
f0e73a66
/*
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters)
testsuite(globalThis.abilityContext)
core.execute()
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/pages/second/second.ets
0 → 100644
浏览文件 @
f0e73a66
/*
* 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 router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
f0e73a66
/*
* 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 function testsuite(context) {
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json
0 → 100644
浏览文件 @
f0e73a66
{
"module"
:
{
"name"
:
"myfeature"
,
"type"
:
"feature"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:phone_entry_dsc"
,
"mainElement"
:
"MainAbility1"
,
"deviceTypes"
:
[
"phone"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"ohos.acts.bundle.stage.MainAbility1"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"orientation"
:
"portrait"
,
"visible"
:
true
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:[
"entity.system.home"
]
}
]
}
],
"extensionAbilities"
:
[
{
"name"
:
"ExtensionAbilityQ"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"form"
,
"skills"
:
[
{
"actions"
:
[
"actionQ"
],
"entities"
:
[
"entitiesQ"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
]
},
{
"name"
:
"ExtensionAbilityW"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"service"
,
"skills"
:
[
{
"actions"
:
[
"actionW"
],
"entities"
:
[
"entitiesW"
,
"entitiesCommon"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
],
"permissions"
:
[
"ohos.permission.GET_BUNDLE_INFO"
]
},
{
"name"
:
"ExtensionAbilityA"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"wallpaper"
,
"skills"
:
[
{
"actions"
:
[
"action_3"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"pathRegex"
:
"ab*c"
}
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
]
},
{
"name"
:
"ExtensionAbilityB"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"label"
:
"$string:form_FormAbility_label"
,
"description"
:
"$string:form_FormAbility_desc"
,
"type"
:
"workScheduler"
,
"skills"
:
[
{
"actions"
:
[
"action_4"
],
"uris"
:
[
{
"scheme"
:
"https"
,
"host"
:
"www.test.com"
,
"path"
:
"query/student/name"
,
"pathRegex"
:
"ab*c"
,
"pathStartWith"
:
"query/teacher"
}
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"resource"
:
"$profile:form_config"
}
],
"permissions"
:
[
"ohos.permission.GET_BUNDLE_INFO"
]
}
]
}
}
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
f0e73a66
{
"string"
:
[
{
"name"
:
"phone_entry_dsc"
,
"value"
:
"i am an entry for phone"
},
{
"name"
:
"phone_entry_main"
,
"value"
:
"the phone entry ability"
},
{
"name"
:
"entry_label"
,
"value"
:
"ActsContextTest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"my whether"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
},
{
"name"
:
"form_FormAbility_desc"
,
"value"
:
"form_description"
},
{
"name"
:
"form_FormAbility_label"
,
"value"
:
"form_label"
}
]
}
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
f0e73a66
15.1 KB
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/profile/form_config.json
0 → 100644
浏览文件 @
f0e73a66
{
"forms"
:
[
{
"isDefault"
:
true
,
"src"
:
"./js/widget/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"widget"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"2*2"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
},
{
"isDefault"
:
true
,
"src"
:
"./js/widget1/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"widget1"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"1*2"
,
"2*2"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
},
{
"isDefault"
:
true
,
"src"
:
"./js/widget2/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"widget2"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"2*2"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
},
{
"isDefault"
:
true
,
"src"
:
"./js/widget3/pages/index/index"
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"widget3"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"formConfigAbility"
:
"ability://xxxxx"
,
"supportDimensions"
:
[
"2*2"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
}
]
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
f0e73a66
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
]
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
f0e73a66
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录