提交 2147ca0d 编写于 作者: C chengxingzhen

Add xts test

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 1b278639
......@@ -18,6 +18,7 @@ group("formmanager") {
if (is_standard_system) {
deps = [
"formhostst_ets/formsystemhostk:FormSystemHostK",
"formhostst_ets/formsystemhostl:FormSystemHostL",
"formproviderst_ets/formsupplyapplicationF:FormSupplyAppF",
"formproviderst_ets/formsupplyapplicationG:FormSupplyAppG",
"formproviderst_ets/formsystemprovidera:FormSystemProviderA",
......@@ -30,6 +31,8 @@ group("formmanager") {
"formsystemtest_ets/formgetformsinfotest/formsoneandzerotest:FormsOneAndZeroTest",
"formsystemtest_ets/formgetformsinfotest/formswithoutpermtest:FormsWithoutPermTest",
"formsystemtest_ets/formgetformsinfotest/formszerotest:FormsZeroTest",
"formsystemtest_ets/formhostdeathrecipienttest:FormHostDeathRecipientTest",
"formsystemtest_ets/formperformancetest:FormPerformanceTest",
"formsystemtest_ets/formstresstest:FormStressTest",
]
}
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("FormSystemHostL") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FormSystemHostL"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests"
}
{
"app": {
"bundleName": "com.ohos.st.formsystemhostl",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.st.formsystemhostl",
"name": ".FormStHostAppL",
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormDelete_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnAcquired_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnError_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnRequest_commonEvent"
}
],
"reqPermissions": [
{
"name": "FMS_FormOnAcquired_commonEvent"
},
{
"name": "FMS_FormDelete_commonEvent",
"reason": "need use FMS_FormDelete_commonEvent"
},
{
"name": "FMS_FormOnError_commonEvent",
"reason": "need use delete commonEvent"
},
{
"name": "FMS_FormOnRequest_commonEvent"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name": "ohos.permission.REQUIRE_FORM"
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent.hostl] Application onCreate')
},
onDestroy() {
console.info('[FormComponent.hostl] Application onDestroy')
},
}
\ No newline at end of file
/*
* 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 formManager from '@ohos.ability.formmanager';
import bundleManager from '@ohos.bundle';
import abilityManager from '@ohos.app.abilityManager';
export default class FormViewModel {
private static sFormViewModel: FormViewModel = null;
public static getInstance(): FormViewModel {
if (FormViewModel.sFormViewModel == null) {
FormViewModel.sFormViewModel = new FormViewModel();
}
return FormViewModel.sFormViewModel;
}
public async castTempFormToNormal(formId: string) {
formManager.castTempForm(formId)
.then((data) => {
console.info('[FormComponent] castTempForm result:' + data);
});
}
public async requestForm(formId: string) {
formManager.requestForm(formId)
.then((data) => {
console.info('[FormComponent] requestForm result:' + data);
});
}
public async deleteCard(formId: string) {
formManager.deleteForm(formId)
.then((data) => {
console.info('[FormComponent] deleteForm result:' + data);
});
}
public async releaseCard(formId: string) {
formManager.releaseForm(formId)
.then((data) => {
console.info('[FormComponent] releaseForm result:' + data);
});
}
public async enableCard(formId: string) {
formManager.enableFormsUpdate([formId])
.then((data) => {
console.info('[FormComponent] enableFormsUpdate result:' + data);
});
}
public async disableCard(formId: string) {
formManager.disableFormsUpdate([formId])
.then((data) => {
console.info('[FormComponent] disableCard result:' + data);
});
}
public async changeCardVisible(formId: string, isVisible: boolean) {
if (isVisible) {
formManager.notifyVisibleForms([formId])
.then((data) => {
console.info('[FormComponent] changeCardVisible result:' + data + ', isVisible:' + isVisible);
});
} else {
formManager.notifyInvisibleForms([formId])
.then((data) => {
console.info('[FormComponent] changeCardVisible result:' + data + ', isVisible:' + isVisible);
});
}
}
public async isFmsReady() {
formManager.isSystemReady()
.then((data) => {
console.info('[FormComponent] isFmsReady result:' + data);
});
}
public async getAllFormsInfo() {
formManager.getAllFormsInfo()
.then((data) => {
console.info('[FormComponent] getAllFormsInfo result:' + JSON.stringify(data));
});
}
public async getFormsInfoByApp(bundle: string) {
formManager.getFormsInfo(bundle)
.then((data) => {
console.info('[FormComponent] getFormsInfoByApp result:' + JSON.stringify(data));
});
}
public async getFormsInfoByModule(bundle: string, moduleName: string) {
formManager.getFormsInfo(bundle, moduleName)
.then((data) => {
console.info('[FormComponent] getFormsInfoByModule result:' + JSON.stringify(data));
});
}
public async clearFormUserCache() {
abilityManager.clearUpApplicationData('com.ohos.myapplicationform')
.then((data) => {
console.info('[FormComponent] cleanBundleCacheFiles result:' + JSON.stringify(data));
});
}
public async clearFormProviderCache(bundle: string) {
abilityManager.clearUpApplicationData(bundle)
.then((data) => {
console.info('[FormComponent] cleanBundleCacheFiles result:' + JSON.stringify(data));
});
}
}
\ No newline at end of file
/*
* 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 FormViewModel from './FormViewModel.ets';
import commonEvent from '@ohos.commonEvent';
import featureAbility from '@ohos.ability.featureAbility';
import formManager from '@ohos.application.formHost';
// @ts-nocheck
@Entry
@Component
struct Index {
@State formId: number = 0;
@State bundle: string = `com.form.formsystemtestservicea.hmservice`;
@State ability: string = `com.form.formsystemtestservicea.hmservice.MainAbility`;
@State moduleName: string = `entry`;
@State name: string = `Form_Js001`;
@State canCreateForm: boolean = false;
@State allowUpdate: boolean = true;
@State isShowing: boolean = true;
@State dimension: FormDimension = FormDimension.Dimension_1_2;
@State temporary: boolean = false;
private mFormViewModel: FormViewModel;
private requestForm = false;
private requestId = `-1`;
private subscriberDel;
private subscriberFormDeleteEvent = {
events: ["FMS_FormDelete_commonEvent"]
};
private TAG = `[FormComponent.hostl]`;
private formOnAcquiredEvent = `FMS_FormOnAcquired_commonEvent`;
private formOnRequestEvent = `FMS_FormOnRequest_commonEvent`;
private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent";
private onAcquiredCallback() {
console.info(`====>${this.TAG} onAcquiredCallback====>`);
}
private onRequestCallback() {
console.info(`====>${this.TAG} onRequestCallback====>`);
}
private unsubscribeDeleteCallback() {
console.info(`${this.TAG} unSubscribeDeleteCallback====>`);
}
async private aboutToAppear() {
this.mFormViewModel = FormViewModel.getInstance();
const onDeleteEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormDeleteEvent);
commonEvent.subscribe(onDeleteEventSubscriber, async (err, data) => {
console.info(`${this.TAG} deleteCallBack start:====> ${JSON.stringify(data)}`);
data.parameters.formIds.forEach(async (formId) => {
await formHost.deleteForm(formId)
.then((res) => {
console.info(`${this.TAG} deleteForm result: ${JSON.stringify(res)}`);
});
});
commonEvent.unsubscribe(onDeleteEventSubscriber, () => this.unsubscribeDeleteCallback());
console.info(`${this.TAG} deleteCallBack end ====>`);
});
featureAbility.getWant()
.then((want: any) => {
console.info(`${this.TAG} getWant: ${JSON.stringify(want)}`);
this.formId = want.parameters.formId;
this.name = want.parameters.name;
this.bundle = want.parameters.bundle;
this.ability = want.parameters.ability;
if (want.parameters.moduleName) {
this.moduleName = want.parameters.moduleName;
}
if (want.parameters.temporary) {
this.temporary = want.parameters.temporary;
}
if (want.parameters.dimension) {
this.dimension = want.parameters.dimension;
}
if (want.parameters.requestForm) {
this.requestForm = want.parameters.requestForm;
}
if (want.parameters.requestId) {
this.requestId = want.parameters.requestId;
}
if (want.parameters.isCreate) {
this.canCreateForm = want.parameters.isCreate;
}
if (!this.canCreateForm && this.requestForm) {
let commonEventPublishData;
formManager.requestForm(this.requestId)
.then((data) => {
console.info(`${this.TAG} requestForm result: ${JSON.stringify(data)}`);
commonEventPublishData = {
data: data.toString(),
parameters: {
"formId": this.requestId
}
};
commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback);
})
.catch((error) => {
console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`);
commonEventPublishData = {
parameters: {
"error": error
}
};
commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback);
});
}
})
.catch((error: any) => {
console.error(`${this.TAG} Operation failed. Cause: ${JSON.stringify(error)}`);
})
}
build() {
Column() {
Text(`form component test begin`);
Column() {
if (this.canCreateForm) {
FormComponent({
id: this.formId,
name: this.name,
bundle: this.bundle,
ability: this.ability,
module: this.moduleName,
dimension: this.dimension,
temporary: this.temporary,
})
.allowUpdate(this.allowUpdate)
.visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden)
.onAcquired((form) => {
console.info(`${this.TAG} onAcquired, form id: ${form.id}`);
this.formId = form.id;
const commonEventPublishData = {
data: this.formId.toString()
};
commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.onAcquiredCallback);
})
.onUninstall((info) => {
console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`);
})
.onError((error) => {
console.error(`${this.TAG} onError: ${JSON.stringify(error)}`);
});
}
}
.backgroundColor(Color.White)
Text(`form component test end`);
}
.backgroundColor(Color.White)
}
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "formhostL"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.form.formsystemtestservicef.hmservice",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"releaseType": "Release",
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.form.formsystemtestservicef.hmservice",
"name": ".FormSupplyAppF",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"name": ".FormAbility",
"srcPath": "FormAbility",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "service",
"formsEnabled": true,
"forms": [
{
"jsComponentName": "Form_Js001",
"isDefault": true,
"scheduledUpdateTime": "10:30",
"formVisibleNotify": true,
"defaultDimension": "1*2",
"name": "Form_Js001",
"description": "This is a form widget",
"colorMode": "auto",
"type": "JS",
"supportDimensions": [
"1*2", "2*2"
],
"updateEnabled": true,
"updateDuration": 1
}
],
"srcLanguage": "ets"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": "Form_Js001",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"type": "form"
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormSupply_commonEvent"
}
],
"reqPermissions": [
{
"reason": "need use FormSupply commonEvent",
"name": "FMS_FormSupply_commonEvent"
}
]
}
{
"app": {
"bundleName": "com.form.formsystemtestservicef.hmservice",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"releaseType": "Release",
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.form.formsystemtestservicef.hmservice",
"name": ".FormSupplyAppF",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"name": ".FormAbility",
"srcPath": "FormAbility",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "service",
"formsEnabled": true,
"forms": [
{
"jsComponentName": "Form_Js001",
"isDefault": true,
"formVisibleNotify": true,
"defaultDimension": "1*2",
"name": "Form_Js001",
"description": "This is a form widget",
"colorMode": "auto",
"type": "JS",
"supportDimensions": [
"1*2",
"2*2"
],
"updateEnabled": true,
"updateDuration": 1
},
{
"jsComponentName": "Form_Js002",
"isDefault": false,
"scheduledUpdateTime": "10:30",
"formVisibleNotify": true,
"defaultDimension": "1*2",
"name": "Form_Js002",
"description": "This is a form widget",
"colorMode": "auto",
"type": "JS",
"supportDimensions": [
"1*2",
"2*2"
],
"updateEnabled": true
}
],
"srcLanguage": "ets"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": "widget",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"type": "form"
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormSupply_commonEvent"
}
],
"reqPermissions": [
{
"reason": "need use FormSupply commonEvent",
"name": "FMS_FormSupply_commonEvent"
}
]
}
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("FormHostDeathRecipientTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FormHostDeathRecipientTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.ohos.st.formhostdeathrecipienttest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"FormHostDeathRecipientTest.hap",
"FormSystemHostK.hap",
"FormSystemHostL.hap",
"FormSupplyAppF.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.ohos.st.formhostdeathrecipienttest",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.st.formhostdeathrecipienttest",
"name": ".FormHostDeathRecipientSTApp",
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnAcquired_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormSupply_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormTerminate_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnRequest_commonEvent"
}
],
"reqPermissions": [
{
"name": "FMS_FormOnAcquired_commonEvent",
"reason": "need use onAcquired commonEvent"
},
{
"name": "FMS_FormSupply_commonEvent",
"reason": "need use FormSupply commonEvent"
},
{
"name": "FMS_FormTerminate_commonEvent"
},
{
"name": "FMS_FormOnRequest_commonEvent"
},
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.REMOVE_CACHE_FILES",
"reason": "need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name": "ohos.permission.CLEAN_APPLICATION_DATA"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent] Application onCreate')
},
onDestroy() {
console.info('[FormComponent] Application onDestroy')
},
}
\ No newline at end of file
/*
* 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.
*/
// @ts-nocheck
import featureAbility from "@ohos.ability.featureAbility";
import file from '@system.file';
import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("[FormComponent] start run testcase!!!!");
featureAbility.getWant()
.then((want: any) => {
console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want));
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');
want.parameters['timeout'] = 60000;
console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters));
configService.setConfig(want.parameters);
testsuite();
core.execute();
})
.catch((error: any) => {
console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Fms Host Death Recipient Test')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/*
* 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 featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets';
const onAcquiredEvent = {
events: [`FMS_FormOnAcquired_commonEvent`],
};
const onSupplyEvent = {
events: [`FMS_FormSupply_commonEvent`],
};
const onRequestEvent = {
events: [`FMS_FormOnRequest_commonEvent`],
};
const formOnTerminateEvent = `FMS_FormTerminate_commonEvent`;
let tcNumber;
let hostCounter;
let providerCounter;
let onAcquiredEventSubscriber;
let onSupplyEventSubscriber;
let onRequestEventSubscriber;
export default function test() {
describe(`FmsHostDeathRecipientTest`, () => {
beforeEach(async () => {
tcNumber = `FmsHostDeathRecipientTest`;
hostCounter = 0;
providerCounter = 0;
onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent);
onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent);
onRequestEventSubscriber = await commonEvent.createSubscriber(onRequestEvent);
});
/**
* @tc.number: FMS_hostDeathRecipient_0100
* @tc.name: Reset host ability.
* @tc.desc: The provider's onDestroy event will be triggered.
*/
it(`FMS_hostDeathRecipient_0100`, 0, async (done) => {
tcNumber = `FMS_hostDeathRecipient_0100`;
let tempFormId;
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
const hostFormId = data.data;
console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`);
if (data.parameters?.cast) {
tempFormId = hostFormId;
}
if (++hostCounter == 2) {
// onAcquired * 2
commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback);
// terminate host
commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback);
console.info(`${tcNumber} onAcquiredCallBack end`);
}
});
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const supplyFormId = getSupplyFormId(data);
console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`);
if (`onDestroy` == kind) {
expect(tempFormId).assertEqual(supplyFormId);
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
await sleep(1000);
done();
}
});
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
isCreate: true,
createTempAndNormal: true,
subscribeTerminate: true
});
});
/**
* @tc.number: FMS_hostDeathRecipient_0200
* @tc.name: Reset host ability and requestForm.
* @tc.desc: The provider's onDestroy event will be triggered.
*/
it(`FMS_hostDeathRecipient_0200`, 0, async (done) => {
tcNumber = `FMS_hostDeathRecipient_0200`;
let normalFormId;
let tempFormId;
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
const hostFormId = data.data;
console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`);
if (data.parameters?.cast) {
tempFormId = hostFormId;
} else {
normalFormId = hostFormId;
}
if (++hostCounter == 2) {
// onAcquired * 2
commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback);
// terminate host
commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback);
await sleep(2000);
// reset host
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
formId: normalFormId,
isCreate: true,
requestForm: true,
requestId: normalFormId,
subscribeTerminate: true
});
console.info(`${tcNumber} onAcquiredCallBack end`);
}
});
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const supplyFormId = getSupplyFormId(data);
console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`);
if (`onDestroy` == kind) {
expect(tempFormId).assertEqual(supplyFormId);
} else if (`onUpdate` == kind) {
expect(normalFormId).assertEqual(supplyFormId);
}
if (++providerCounter == 4) {
// onCreate * 2 onDestroy * 1 onUpdate * 1
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
console.info(`${tcNumber} onSupplyCallBack end`);
await sleep(1000);
done();
}
});
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
isCreate: true,
createTempAndNormal: true,
subscribeTerminate: true
});
});
/**
* @tc.number: FMS_hostDeathRecipient_0300
* @tc.name: Reset host ability.
* @tc.desc: The provider's onDestroy event will be triggered but requestForm will be failed.
*/
it(`FMS_hostDeathRecipient_0300`, 0, async (done) => {
tcNumber = `FMS_hostDeathRecipient_0300`;
let tempFormId;
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
const hostFormId = data.data;
console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`);
if (data.parameters) {
tempFormId = hostFormId;
commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback);
// terminate host
commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback);
console.info(`${tcNumber} onAcquiredCallBack end`);
}
});
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const supplyFormId = getSupplyFormId(data);
console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`);
if (`onDestroy` == kind) {
expect(tempFormId).assertEqual(supplyFormId);
}
if (++providerCounter == 2) {
// onCreate * 1
// onDestroy * 1
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
await sleep(1000);
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
requestForm: true,
requestId: tempFormId
});
console.info(`${tcNumber} onSupplyCallBack end`);
}
});
commonEvent.subscribe(onRequestEventSubscriber, async (err, data) => {
console.info(`${tcNumber} onRequestCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
commonEvent.unsubscribe(onRequestEventSubscriber, unsubscribeOnRequestCallback);
const error = data.parameters.error;
expect(error.code).assertEqual(9);
expect(error.message).assertEqual(`the ID of the form to be operated does not exist`);
console.info(`${tcNumber} onRequestCallBack end`);
await sleep(1000);
done();
});
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
isCreate: true,
temporary: true,
subscribeTerminate: true
});
});
/**
* @tc.number: FMS_hostDeathRecipient_0500
* @tc.name: Reset host ability and requestForm.
* @tc.desc: The provider's onUpdate event will be triggered.
*/
it(`FMS_hostDeathRecipient_0500`, 0, async (done) => {
tcNumber = `FMS_hostDeathRecipient_0500`;
let hostFormId;
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
hostFormId = data.data;
console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`);
commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback);
// start abilityb
await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, {
formId: hostFormId,
isCreate: true
});
// terminate host
commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback);
await sleep(2000);
// reset host a
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
formId: hostFormId,
requestForm: true,
requestId: hostFormId,
});
console.info(`${tcNumber} onAcquiredCallBack end`);
});
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const supplyFormId = getSupplyFormId(data);
console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`);
if (`onUpdate` == kind) {
expect(hostFormId).assertEqual(supplyFormId);
}
if (++providerCounter == 2) {
// onCreate * 1 host A
// onUpdate * 1
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
console.info(`${tcNumber} onSupplyCallBack end`);
await sleep(1000);
done();
}
});
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
isCreate: true,
subscribeTerminate: true
});
});
/**
* @tc.number: FMS_hostDeathRecipient_0600
* @tc.name: Reset host ability and requestForm.
* @tc.desc: The provider's onUpdate event will be triggered.
*/
it(`FMS_hostDeathRecipient_0600`, 0, async (done) => {
tcNumber = `FMS_hostDeathRecipient_0600`;
let hostFormId;
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
hostFormId = data.data;
console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`);
commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback);
// start abilityb
await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, {
formId: hostFormId,
isCreate: true
});
// terminate host
commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback);
await sleep(2000);
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
formId: hostFormId,
isCreate: true,
requestForm: true,
requestId: hostFormId,
subscribeTerminate: true
});
await sleep(2000);
await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, {
formId: hostFormId,
requestForm: true,
requestId: hostFormId,
});
console.info(`${tcNumber} onAcquiredCallBack end`);
});
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const supplyFormId = getSupplyFormId(data);
console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`);
if (`onUpdate` == kind) {
expect(hostFormId).assertEqual(supplyFormId);
}
if (++providerCounter == 3) {
// onCreate * 1 host A
// onUpdate * 2
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
console.info(`${tcNumber} onSupplyCallBack end`);
await sleep(1000);
done();
}
});
await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, {
isCreate: true,
subscribeTerminate: true
});
});
});
}
const sleep = async delay => {
return new Promise((resolve, _) => {
setTimeout(async () => {
resolve(0);
}, delay);
});
};
const getSupplyFormId = (data) => {
switch (data.parameters.kind) {
case `onCreate`:
return JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`];
case `onVisibilityChange`:
return Object.keys(JSON.parse(data.parameters.parameters))[0]
default:
return data.parameters.parameters;
}
}
const unsubscribeOnAcquiredCallback = () => {
console.info(`${tcNumber} unsubscribeOnAcquired callback`);
}
const unsubscribeOnSupplyCallback = () => {
console.info(`${tcNumber} unsubscribeOnSupply callback`);
}
const unsubscribeOnRequestCallback = () => {
console.info(`${tcNumber} unsubscribeOnRequest callback`);
}
const publishOnTerminateCallback = () => {
console.info(`${tcNumber} publishOnTerminate callback`);
}
interface Parameters {
formId?: String,
name?: String,
bundle?: String,
ability?: String,
moduleName?: String,
temporary?: Boolean,
isCreate?: Boolean,
createTempAndNormal?: Boolean,
subscribeTerminate?: Boolean,
tempParam?: Object,
[key: string]: any
}
const startAbility = async (
bundleName,
abilityName,
parameters: Parameters) => {
parameters = Object.assign({
formId: `0`,
name: `Form_Js001`,
bundle: `com.form.formsystemtestservicef.hmservice`,
ability: `com.form.formsystemtestservicef.hmservice.FormAbility`,
moduleName: `entry`,
temporary: false,
isCreate: false,
createTempAndNormal: false,
subscribeTerminate: false,
}, parameters);
if (parameters.createTempAndNormal) {
parameters.tempParam = {
formId: `0`,
name: `Form_Js001`,
bundle: `com.form.formsystemtestservicef.hmservice`,
ability: `com.form.formsystemtestservicef.hmservice.FormAbility`,
moduleName: `entry`
};
}
try {
const res = await featureAbility.startAbility({
want: {
bundleName: bundleName,
abilityName: abilityName,
parameters: parameters
}
});
console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`);
} catch (error) {
console.info(`${tcNumber} featureAbility.startAbility error: ${JSON.stringify(error)}`);
console.info(`${tcNumber} should not reach here`);
expect().assertFail();
}
};
/*
* 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 from './FmsHostDeathRecipient.test.ets';
export default function testsuite() {
test();
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "formsttest"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("FormPerformanceTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FormPerformanceTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.ohos.st.formperformancetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"FormPerformanceTest.hap",
"FormSystemHostK.hap",
"FormSupplyAppG.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.ohos.st.formperformancetest",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.st.formperformancetest",
"name": ".FormPerformanceSTApp",
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormOnAcquired_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormSupply_commonEvent"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "FMS_FormDelete_commonEvent"
}
],
"reqPermissions": [
{
"name": "FMS_FormOnAcquired_commonEvent",
"reason": "need use onAcquired commonEvent"
},
{
"name": "FMS_FormSupply_commonEvent",
"reason": "need use FormSupply commonEvent"
},
{
"name": "FMS_FormDelete_commonEvent",
"reason": "need use delete commonEvent"
},
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.REMOVE_CACHE_FILES",
"reason": "need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name": "ohos.permission.CLEAN_APPLICATION_DATA"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent] Application onCreate')
},
onDestroy() {
console.info('[FormComponent] Application onDestroy')
},
}
\ No newline at end of file
/*
* 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.
*/
// @ts-nocheck
import featureAbility from "@ohos.ability.featureAbility";
import file from '@system.file';
import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("[FormComponent] start run testcase!!!!");
featureAbility.getWant()
.then((want: any) => {
console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want));
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');
want.parameters['timeout'] = 20000;
console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters));
configService.setConfig(want.parameters);
testsuite();
core.execute();
})
.catch((error: any) => {
console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Fms Performance Test')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/*
* 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 from './FmsPerformanceTest.test.ets';
export default function testsuite() {
test();
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "formsttest"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册