Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ffcf4bed
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ffcf4bed
编写于
6月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3871 增加测试用例
Merge pull request !3871 from shilei91/master
上级
cc070d2f
d32f9949
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
1349 addition
and
0 deletion
+1349
-0
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
+1
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/AppScope/app.json
...ndard/bundlemanager/actsbmsstageetstest/AppScope/app.json
+21
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/AppScope/resources/base/element/string.json
...sstageetstest/AppScope/resources/base/element/string.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn
...undle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn
+40
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json
...ndle_standard/bundlemanager/actsbmsstageetstest/Test.json
+25
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/Application/AbilityStage.ts
...ageetstest/entry/src/main/ets/Application/AbilityStage.ts
+9
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/FormAbility/FormAbility.ts
...tageetstest/entry/src/main/ets/FormAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts
...tageetstest/entry/src/main/ets/MainAbility/MainAbility.ts
+36
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/ServiceAbility/FormAbility.ts
...eetstest/entry/src/main/ets/ServiceAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets
...sbmsstageetstest/entry/src/main/ets/pages/index/index.ets
+66
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets
...msstageetstest/entry/src/main/ets/pages/second/second.ets
+43
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets
...test/entry/src/main/ets/test/GetProfileByAbility.test.ets
+416
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets
...y/src/main/ets/test/GetProfileByExtensionAbility.test.ets
+416
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets
...actsbmsstageetstest/entry/src/main/ets/test/List.test.ets
+22
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json
...dlemanager/actsbmsstageetstest/entry/src/main/module.json
+113
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/element/string.json
...etstest/entry/src/main/resources/base/element/string.json
+40
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/media/icon.png
...stageetstest/entry/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json
...st/entry/src/main/resources/base/profile/form_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config1.txt
...st/entry/src/main/resources/base/profile/form_config1.txt
+1
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json
...try/src/main/resources/base/profile/shortcuts_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/signature/openharmony_sx.p7b
...emanager/actsbmsstageetstest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
浏览文件 @
ffcf4bed
...
...
@@ -25,6 +25,7 @@ group("bundlemanager") {
"actsbmsjstest:ActsBmsJsTest",
"actsbmsjsunpermissiontest:ActsBmsJsUnPermissionTest",
"actsbmsmetadatatest:ActsBmsMetaDataTest",
"actsbmsstageetstest:ActBmsStageEtsTest",
"actsbundlemanageretstest:ActsBundleManagerEtsTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"sceneProject/bmsaccesstokenfive:bmsAccessTokenTest5",
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/AppScope/app.json
0 → 100755
浏览文件 @
ffcf4bed
{
"app"
:{
"bundleName"
:
"ohos.acts.bundle.stage.test"
,
"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
}
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/AppScope/resources/base/element/string.json
0 → 100755
浏览文件 @
ffcf4bed
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn
0 → 100755
浏览文件 @
ffcf4bed
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActBmsStageEtsTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":actbmsstageetstest_js_assets",
":actbmsstageetstest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActBmsStageEtsTest"
}
ohos_app_scope("actbmsstageetstest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actbmsstageetstest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actbmsstageetstest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actbmsstageetstest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json
0 → 100755
浏览文件 @
ffcf4bed
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"ohos.acts.bundle.stage.test"
,
"shell-timeout"
:
"600000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActBmsStageEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"teardown-command"
:[
"bm uninstall -n ohos.acts.bundle.stage.test"
]
}
]
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/Application/AbilityStage.ts
0 → 100755
浏览文件 @
ffcf4bed
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
;
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/FormAbility/FormAbility.ts
0 → 100755
浏览文件 @
ffcf4bed
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
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100755
浏览文件 @
ffcf4bed
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
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/ServiceAbility/FormAbility.ts
0 → 100755
浏览文件 @
ffcf4bed
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
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets
0 → 100755
浏览文件 @
ffcf4bed
/*
* 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 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
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets
0 → 100755
浏览文件 @
ffcf4bed
/*
* 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 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
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets
0 → 100755
浏览文件 @
ffcf4bed
/**
* 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 bundle from '@ohos.bundle';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
const MODULE_NAME = "phone"
const MODULE_NAME_TEST = "phone1"
const ABILITY_NAME = "ohos.acts.bundle.stage.test.MainAbility"
const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1"
const ABILITY_NAME_TEST = "ohos.acts.bundle.stage.test.MainAbilityTest"
const METADATA_NAME = "ohos.ability.form"
const METADATA_NAME1 = "ohos.ability.form1"
const METADATA_NAME2 = "ohos.ability.form2"
const METADATA_NAME3 = "ohos.ability.form3"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}"
export default function getProfileByAbility() {
describe('getProfileByAbility', function () {
/*
* @tc.number: getProfileByAbility_0400
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0400', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0400 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0400 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0500
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0500', 0, async function (done) {
await bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0500 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0500 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0600
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_0600', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_0600]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_0700
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_0700', 0, async function (done) {
bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_0700]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_0800
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0800', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0800 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0800 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0900
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0900', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByAbility_0900 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0900 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_1000
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1000', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1000]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_1100
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1100', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1100]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_1200
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1200', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1200]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: getProfileByAbility_1300
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1300', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1300]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_1400
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1400', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
if (err) {
console.error('[getProfileByAbility_1400]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: getProfileByAbility_1500
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1500', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1500]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1600
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1600', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done()
}).catch(err => {
console.error('[getProfileByAbility_1600]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1700
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1700', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1700]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1800
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1800', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1800]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1900
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1900', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbility_1900]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2000
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByAbility_2000', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbility_2000]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2100
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByAbility_2100', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
if (err) {
console.error('[getProfileByAbility_2100]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByAbility_2200
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: profile is not json-format (by promise)
* @tc.level 0
*/
it('getProfileByAbility_2200', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbility_2200]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2300
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: profile is not json-format (by callback)
* @tc.level 0
*/
it('getProfileByAbility_2300', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
if (err) {
console.error('[getProfileByAbility_2300]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets
0 → 100755
浏览文件 @
ffcf4bed
/**
* 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 bundle from '@ohos.bundle';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
const MODULE_NAME = "phone"
const MODULE_NAME_TEST = "phone1"
const ABILITY_NAME = "Form"
const ABILITY_NAME1 = "Form1"
const ABILITY_NAME_TEST = "FromTest"
const METADATA_NAME = "ohos.extension.form"
const METADATA_NAME1 = "ohos.extension.form1"
const METADATA_NAME2 = "ohos.extension.form2"
const METADATA_NAME3 = "ohos.extension.form3"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}"
export default function getProfileByExtensionAbility() {
describe('getProfileByExtensionAbility', function () {
/*
* @tc.number: getProfileByExtensionAbility_0400
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0400', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0400 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0400 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0500
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0500', 0, async function (done) {
await bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0500 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0500 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0600
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0600', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_0600]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_0700
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0700', 0, async function (done) {
bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_0700]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_0800
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0800', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0800 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0800 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0900
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0900', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0900 success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0900 failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_1000
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1000', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1000]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_1100
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1100', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1100]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_1200
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1200', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1200]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_1300
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1300', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1300]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_1400
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1400', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1400]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_1500
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1500', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByExtensionAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1500]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1600
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1600', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByExtensionAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done()
}).catch(err => {
console.error('[getProfileByExtensionAbility_1600]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1700
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1700', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByExtensionAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1700]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1800
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1800', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByExtensionAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1800]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1900
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1900', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByExtensionAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1900]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2000
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2000', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByExtensionAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_2000]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2100
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2100', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_2100]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
/*
* @tc.number: getProfileByExtensionAbility_2200
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: profile is not json-format (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2200', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByExtensionAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_2200]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2300
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: profile is not json-format (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2300', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_2300]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
});
})
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets
0 → 100755
浏览文件 @
ffcf4bed
/*
* 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 getProfileByAbility from './GetProfileByAbility.test.ets';
import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets';
export default function testsuite(context) {
getProfileByAbility();
getProfileByExtensionAbility();
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json
0 → 100755
浏览文件 @
ffcf4bed
{
"module"
:
{
"name"
:
"phone"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:phone_entry_dsc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"phone"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"ohos.acts.bundle.stage.test.MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"orientation"
:
"portrait"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:[
"entity.system.home"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.ability.form"
,
"value"
:
""
,
"resource"
:
"$profile:shortcuts_config"
},
{
"name"
:
"ohos.ability.form1"
,
"value"
:
""
,
"resource"
:
"$profile:form_config"
},
{
"name"
:
"ohos.ability.form2"
,
"value"
:
""
,
"resource"
:
"@profile:form_config"
},
{
"name"
:
"ohos.ability.form3"
,
"value"
:
""
,
"resource"
:
"$profile:form_config1"
}
]
},
{
"name"
:
"ohos.acts.bundle.stage.test.MainAbility1"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"orientation"
:
"portrait"
,
"skills"
:
[]
}
],
"extensionAbilities"
:
[
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"value"
:
""
,
"resource"
:
"$profile:shortcuts_config"
},
{
"name"
:
"ohos.extension.form1"
,
"value"
:
""
,
"resource"
:
"$profile:form_config"
},
{
"name"
:
"ohos.extension.form2"
,
"value"
:
""
,
"resource"
:
"@profile:form_config"
},
{
"name"
:
"ohos.extension.form3"
,
"value"
:
""
,
"resource"
:
"$profile:form_config1"
}
],
"name"
:
"Form"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"form"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"name"
:
"Form1"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"form"
,
"visible"
:
true
}
]
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/element/string.json
0 → 100755
浏览文件 @
ffcf4bed
{
"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"
}
]
}
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/media/icon.png
0 → 100755
浏览文件 @
ffcf4bed
15.1 KB
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json
0 → 100755
浏览文件 @
ffcf4bed
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config1.txt
0 → 100755
浏览文件 @
ffcf4bed
{"forms" :[{"colorMode" : "auto","defaultDimension" : "2*2","description" : "$string:16777219","formConfigAbility" : "ability://xxxxx","formVisibleNotify" : false,"isDefault" : true,"name" : "Form_Js","scheduledUpdateTime" : "10:30","src" : "pages/card/index","supportDimensions" :["2*2"],"updateDuration" : 1,"updateEnabled" : true,"window" :{"autoDesignWidth" : true,"designWidth" : 720}}]}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json
0 → 100755
浏览文件 @
ffcf4bed
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json
0 → 100755
浏览文件 @
ffcf4bed
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/signature/openharmony_sx.p7b
0 → 100755
浏览文件 @
ffcf4bed
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录