未验证 提交 3a81f84f 编写于 作者: O openharmony_ci 提交者: Gitee

!3837 XTS元能力un测试套整改

Merge pull request !3837 from chengxingzhen/master
......@@ -98,23 +98,6 @@ async function startAbilityProcess(abilityContext, parameters) {
})
}
function getMissionId() {
return new Promise(async (resolve, reject) => {
var missionId = -1;
var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM);
for (let i = 0; i < missionInfos.length; i++) {
console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i]))
if ((missionInfos[i].want.abilityName == "com.example.amsabilitymultiinstancetest.MainAbility") &&
(missionInfos[i].runningState == 0)) {
missionId = missionInfos[i].missionId;
break;
}
}
console.log('======>getMissionId resolve missionId<=======' + missionId);
resolve(missionId);
})
}
export default function abilityTest(abilityContext) {
describe('ActsAbilityTest', function () {
......@@ -126,19 +109,6 @@ export default function abilityTest(abilityContext) {
afterEach(async (done) => {
let installer = await bundle.getBundleInstaller();
var count = 0;
var testMissionId;
testMissionId = await getMissionId();
console.log('======>afterEach test missionId<=======' + testMissionId);
if (testMissionId != -1) {
await missionManager.moveMissionToFront(testMissionId);
}
await appManager.killProcessesByBundleName("com.example.amsabilitymultiinstanceappa");
await appManager.killProcessesByBundleName("com.example.amsabilitymultiinstanceappb");
await appManager.killProcessesByBundleName("com.example.amsabilitymultiinstanceappc");
await appManager.killProcessesByBundleName("com.example.amsabilitymultiinstanceappd");
await appManager.killProcessesByBundleName("com.example.amsabilitymultiinstanceappe");
done();
})
......
......@@ -14,7 +14,6 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import commonEvent from '@ohos.commonEvent'
import missionManager from '@ohos.application.missionManager'
const MAX_MISSION_NUM = 1024;
......@@ -64,22 +63,6 @@ class MySequenceable {
}
}
function getMissionId(abilityName, state) {
return new Promise(async (resolve, reject) => {
let missionId = -1;
let missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM);
for (let i = 0; i < missionInfos.length; i++) {
if ((missionInfos[i].want.abilityName == abilityName)
&& (missionInfos[i].runningState == state)) {
missionId = missionInfos[i].missionId;
break;
}
}
console.log('======>getMissionId resolve missionId<=======' + missionId);
resolve(missionId);
})
}
function delay(time) {
let delta;
if (typeof time != 'number' || time <= 0) {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
import ohosDataAbility from '@ohos.data.dataability'
import ohosDataAbility from '@ohos.data.dataAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('ActsDataAbilityHelperTest', function () {
......
......@@ -16,8 +16,6 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import commonEvent from '@ohos.commonEvent'
import bundle from '@ohos.bundle'
import missionManager from '@ohos.application.missionManager'
import appManager from '@ohos.application.appManager'
var subscriberInfoMultiInstance = {
......@@ -53,37 +51,9 @@ async function startAbilityProcess(abilityContext, options, parameters) {
}
}
function getMissionId() {
return new Promise(async (resolve, reject) => {
var missionId = -1;
var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM);
for (let i = 0; i < missionInfos.length; i++) {
console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i]))
if ((missionInfos[i].want.abilityName == "com.example.actsgetdisplayidtest.MainAbility") &&
(missionInfos[i].runningState == 0)) {
missionId = missionInfos[i].missionId;
break;
}
}
console.log('======>getMissionId resolve missionId<=======' + missionId);
resolve(missionId);
})
}
export default function abilityTest(abilityContext) {
describe('ActsGetDisplayIdStartAbilityTest', function () {
afterEach(async (done) => {
var testMissionId;
testMissionId = await getMissionId();
console.log('======>afterEach test missionId<=======' + testMissionId);
await missionManager.moveMissionToFront(testMissionId);
await appManager.killProcessesByBundleName("com.example.actsspecifytesthap");
done();
})
/*
* @tc.number: ACTS_StartAbility_0100
* @tc.name: Get the specified displayId to start Ability
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import appManager from '@ohos.application.AppManager'
import appManager from '@ohos.application.appManager'
describe('ActsAbilityRunningInfosTest', function () {
......
......@@ -83,8 +83,10 @@ export default function test() {
console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0200 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_0300
......@@ -121,8 +123,10 @@ export default function test() {
console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0300 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_0400
......@@ -159,8 +163,10 @@ export default function test() {
console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0400 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_0500
......@@ -197,8 +203,10 @@ export default function test() {
console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0500 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_0600
......@@ -235,8 +243,10 @@ export default function test() {
console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0600 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_0700
......@@ -273,8 +283,10 @@ export default function test() {
console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_0700 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
* @tc.number: FMS_acquireForm_1000
......@@ -312,8 +324,10 @@ export default function test() {
console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_1000 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
......@@ -396,8 +410,11 @@ export default function test() {
console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_1100 featureAbility.startAbility end`);
await sleepTime(3000)
done()
});
/**
......@@ -481,6 +498,8 @@ export default function test() {
console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
});
console.info(`FMS_acquireForm_1200 featureAbility.startAbility end`);
await sleepTime(3000)
done()
});
/**
* @tc.number: FMS_acquireForm_1400
......@@ -502,6 +521,7 @@ export default function test() {
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_1400 publish' + JSON.stringify(err));
});
done()
}
async function onAcquiredCallBack(_, data) {
console.info("!!!====>FMS_acquireForm_1400 onAcquiredCallBack data:====>" + JSON.stringify(data));
......@@ -531,6 +551,8 @@ export default function test() {
console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
});
console.info(`FMS_acquireForm_1400 featureAbility.startAbility again end`);
await sleepTime(3000)
}
commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack);
......@@ -581,6 +603,7 @@ export default function test() {
console.info('FMS_acquireForm_1500 publish' + JSON.stringify(err));
});
}
done()
}
async function onAcquiredCallBack(_, data) {
console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBack data:====>" + JSON.stringify(data));
......@@ -653,8 +676,10 @@ export default function test() {
console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_1500 featureAbility.startAbility end`);
await sleepTime(3000)
});
/**
......@@ -1075,12 +1100,11 @@ export default function test() {
}).catch((err: any) => {
console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
});
console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbility end`);
console.info(`FMS_acquireForm_1800_Temp2 end`);
}
FMS_acquireForm_1800_normal1();
await FMS_acquireForm_1800_normal1();
await sleepTime(5000)
});
/**
* @tc.number: FMS_acquireForm_1900
......@@ -1107,6 +1131,7 @@ export default function test() {
console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err));
});
}
done()
}
commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack);
......@@ -1188,6 +1213,7 @@ export default function test() {
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_2100 publish' + JSON.stringify(err));
});
done()
}
async function onAcquiredCallBack(_, data) {
console.info("!!!====>FMS_acquireForm_2100 onAcquiredCallBack data:====>" + JSON.stringify(data));
......@@ -1261,6 +1287,7 @@ export default function test() {
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_2200 publish' + JSON.stringify(err));
});
done()
}
commonEvent.subscribe(subscriberCast, onCastCallBack);
......@@ -1290,7 +1317,7 @@ export default function test() {
});
/**
* @tc.number: FMS_acquireForm_2300
* @tc.name: Cast to normal form when the temporary formIdis set to 0.
* @tc.name: Cast to normal form when the temporary formId is set to 0.
* @tc.desc: Failed to convert to normal form when verifying that the temporary formIdis set to 0
*/
it(`FMS_acquireForm_2300`, 0, async (done) => {
......@@ -1306,6 +1333,7 @@ export default function test() {
};
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_2300 publish' + JSON.stringify(err));
done()
});
}
commonEvent.subscribe(subscriberCast, onCastCallBack);
......@@ -1330,6 +1358,7 @@ export default function test() {
console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_2300 featureAbility.startAbility end`);
});
......@@ -1351,6 +1380,7 @@ export default function test() {
};
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_2400 publish' + JSON.stringify(err));
done()
});
}
async function onAcquiredCallBack(_, data) {
......@@ -1379,6 +1409,7 @@ export default function test() {
console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_2400 featureAbility.startAbility again end`);
}
......@@ -1424,6 +1455,7 @@ export default function test() {
};
commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => {
console.info('FMS_acquireForm_2500 publish' + JSON.stringify(err));
done()
});
}
commonEvent.subscribe(subscriberCast, onCastCallBack);
......@@ -1448,10 +1480,12 @@ export default function test() {
console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`);
}).catch((err: any) => {
console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`);
done()
});
console.info(`FMS_acquireForm_2500 featureAbility.startAbility end`);
await sleep(3000)
});
/**
/**
* @tc.number: FMS_acquireForm_2600
* @tc.name: When the normal form does not reach the maximum value created by the form, the temporary form changes to the normal form.
* @tc.desc: Verify that when the normal form does not reach the maximum value created by the form.
......@@ -1465,7 +1499,7 @@ export default function test() {
function onCastCallBack(_, data) {
console.info("!!!====>FMS_acquireForm_2600 onCastCallBack data:====>" + JSON.stringify(data));
expect(data.event).assertEqual("FMS_FormCast_commonEvent");
expect(data.data).assertEqual("0");
expect(data.data).assertEqual("undefined");
commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2600"))
formId1 = data.parameters.formId;
if (formId1 && formId2) {
......@@ -1473,8 +1507,8 @@ export default function test() {
let commonEventPublishData = {
data: formId1
};
}
commonEvent.publish(deleteForm_Event, () => delPublishCallBack("FMS_acquireForm_2600", done));
}
}
async function onAcquiredCallBack(_, data) {
......@@ -1520,6 +1554,7 @@ export default function test() {
};
commonEvent.publish(deleteForm_Event, commonEventPublishData, () =>
publishCallback1("FMS_acquireForm_2600"));
done()
}
}
}
......@@ -1569,6 +1604,10 @@ const delPublishCallBack = async (tcNumber, done) => {
}, 1000);
}
function sleepTime(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
const unsubscribeOnErrorCallback = (tcNumber) => {
console.debug(`====>${tcNumber} unsubscribeOnErrorCallback====>`);
}
......
......@@ -47,52 +47,6 @@ export default function test() {
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.
......@@ -138,205 +92,26 @@ export default function test() {
if (`onDestroy` == kind) {
expect(tempFormId).assertEqual(supplyFormId);
done()
} else if (`onUpdate` == kind) {
expect(normalFormId).assertEqual(supplyFormId);
done()
}
if (++providerCounter == 4) {
console.info(`${tcNumber} onSupplyCallBack 123`);
// onCreate * 2 onDestroy * 1 onUpdate * 1
commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback);
console.info(`${tcNumber} onSupplyCallBack end`);
await sleep(1000);
done();
//await sleep(1000);
}
});
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,
createTempAndNormal: true,
subscribeTerminate: true
});
});
});
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册