提交 b7caccf1 编写于 作者: H HuangXW

启动规则Call调用整改

Change-Id: I746b7360bf88bf374399c0a24e015fb249b76ee5
Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 c0238e4d
......@@ -170,80 +170,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_0100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_0100 begin');
function unSubscribeCallBack() {
console.log('ACTS_CommonComponent_Call_0100 unSubscribeCallBack')
subscriber = null;
done();
}
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_0100 releaseCallBack' + data);
commonEvent.unsubscribe(subscriber, unSubscribeCallBack);
}
function subscribeCallBack(err, data) {
console.log('ACTS_CommonComponent_Call_0100 subscribeCallBack data:' + JSON.stringify(data))
expect(data.data).assertEqual('calleeCheckCallParam');
expect(data.parameters.num).assertEqual(100);
expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0100');
expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0100processed');
console.log('AMS_CallTest_0100 do release');
caller.release();
}
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, subscribeCallBack);
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
let want = {
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(100, "ACTS_CommonComponent_Call_0100", 'default');
caller.call('testCall', param).then(() => {
console.log('ACTS_CommonComponent_Call_0100 call success');
}).catch(err => {
console.log('ACTS_CommonComponent_Call_0100 call exception' + err);
expect().assertFail();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_0200
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_0200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_0200 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_0200 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(200, "ACTS_CommonComponent_Call_0200", 'default');
caller.callWithResult('testCallWithResult', param).then((data) => {
console.log('ACTS_CommonComponent_Call_0200 call success');
var result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.num).assertEqual(200);
expect(result.str).assertEqual('ACTS_CommonComponent_Call_0200');
expect(result.result).assertEqual('ACTS_CommonComponent_Call_0200processed');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_0200 call exception' + err);
expect().assertFail();
caller.release();
})
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall SUCCESS`);
expect().assertFail();
done();
})
.catch(error => {
console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall Catch`);
done();
});
})
/**
......@@ -665,89 +605,6 @@ export default function abilityTest() {
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_1900
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_1900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1900 begin');
var callBackCnt = 0;
function checkFinish() {
if (callBackCnt >= 3) {
console.log('ACTS_CommonComponent_Call_1900 finish release')
caller.release();
}
}
function unSubscribeCallBack() {
console.log('ACTS_CommonComponent_Call_1900 unSubscribeCallBack')
subscriber = null;
done();
}
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1900 releaseCallBack' + data);
commonEvent.unsubscribe(subscriber, unSubscribeCallBack);
}
function subscribeCallBack(err, data) {
console.log('ACTS_CommonComponent_Call_1900 subscribeCallBack data:' + JSON.stringify(data))
if (data.data == 'calleeCheckCallParam') {
expect(data.parameters.num).assertEqual(1900);
expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900');
expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed');
callBackCnt++;
checkFinish();
} else if (data.data == 'calleeCheckCall2Param') {
expect(data.parameters.num).assertEqual(1900);
expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900');
expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed2');
callBackCnt++;
checkFinish();
}
}
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, subscribeCallBack);
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(1900, "ACTS_CommonComponent_Call_1900", 'default');
caller.call('testCall', param).then(() => {
console.log('ACTS_CommonComponent_Call_1900 call success');
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1900 call exception' + err);
expect().assertFail();
})
caller.call('testCall2', param).then(() => {
console.log('ACTS_CommonComponent_Call_1900 call2 success');
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1900 call2 exception' + err);
expect().assertFail();
})
caller.callWithResult('testCallWithResult', param).then((data) => {
console.log('ACTS_CommonComponent_Call_1900 call success');
var result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.num).assertEqual(1900);
expect(result.str).assertEqual('ACTS_CommonComponent_Call_1900');
expect(result.result).assertEqual('ACTS_CommonComponent_Call_1900processed');
callBackCnt++;
checkFinish();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1900 call exception' + err);
expect().assertFail();
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2000
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
......@@ -783,404 +640,121 @@ export default function abilityTest() {
})
/**
* @tc.number: ACTS_CommonComponent_Call_2300
* @tc.name: Callee is in standalone process AbilityStage of the same app.
* @tc.desc: Verify Callee is in standalone process AbilityStage of the same app.
* @tc.number: ACTS_CommonComponent_Call_3100
* @tc.name: The parameter method of the Callee.on function is an empty string.
* @tc.desc: Verify that the parameter method of the Callee.on function is an empty string.
*/
it('ACTS_CommonComponent_Call_2300', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2300 begin');
let bundleNameCallee = "com.example.systemcalltest";
let abilityNameCallee = "com.example.second.MainAbility";
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_2300 releaseCallBack:' + data);
expect(data).assertEqual("release");
done();
}
it('ACTS_CommonComponent_Call_3100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3100 begin');
let want = {
bundleName: bundleNameCallee,
abilityName: abilityNameCallee,
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want);
if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_2300 startAbilityByCall fail');
expect().assertFail();
done();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3100 onTest');
}
let finishFlag = 0;
try {
caller.onRelease(releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_2300 Caller onRelease fail ' + e);
expect().assertFail();
done();
globalThis.callee.on('', onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
let param = new MySequenceable(2300, "case2300", 'default');
caller.callWithResult('test2300', param).then((data) => {
console.log('ACTS_CommonComponent_Call_2300 callWithResult ' + JSON.stringify(data));
let result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.str).assertEqual("onCreateonBackground");
expect(result.num).assertEqual(0);
});
try {
caller.release();
} catch (e) {
console.log('ACTS_CommonComponent_Call_2300 Caller Release fail:' + e);
expect().assertFail();
done();
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_2400
* @tc.name: The service party cannot provide the corresponding service after calling Callee.off.
* @tc.desc: The verification service party cannot provide the corresponding service after calling Callee.off.
* @tc.number: ACTS_CommonComponent_Call_3200
* @tc.name: The parameter method of the Callee.on function is null.
* @tc.desc: Verify that the parameter method of the Callee.on function is null.
*/
it('ACTS_CommonComponent_Call_2400', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2400 begin');
it('ACTS_CommonComponent_Call_3200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3200 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2400 releaseCallBack ' + data);
done();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3200 onTest');
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2400, "case2400", 'default');
let beforeOff = 0;
let afterOff = 0;
await caller.call('testOff', param).then(() => {
console.log('ACTS_CommonComponent_Call_2400 call success');
beforeOff = 1;
}).catch(err => {
beforeOff = 2;
})
globalThis.secondCallee.off('testOff');
await caller.call('testOff', param).then(() => {
console.log('ACTS_CommonComponent_Call_2400 call success');
afterOff = 1;
}).catch(err => {
afterOff = 2;
})
let finishFlag = 0;
try {
globalThis.callee.on(null, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(beforeOff).assertEqual(1);
expect(afterOff).assertEqual(2);
caller.release();
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_2500
* @tc.name: The parameter "method" of the Caller.call function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.call function is an empty string.
* @tc.number: ACTS_CommonComponent_Call_3300
* @tc.name: The parameter method of the Caller.callWithResult function is undefined.
* @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined.
*/
it('ACTS_CommonComponent_Call_2500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2500 begin');
it('ACTS_CommonComponent_Call_3300', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3300 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2500 releaseCallBack' + data);
done();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3300 onTest');
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2500, "case2500", 'default');
caller.call('', param).then(() => {
console.log('ACTS_CommonComponent_Call_2500 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_2500 call exception' + err);
let finishFlag = 0;
try {
globalThis.callee.on(undefined, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_2600
* @tc.name: The parameter "method" of the Caller.call function is null.
* @tc.desc: Verify that the parameter "method" of the Caller.call function is null.
* @tc.number: ACTS_CommonComponent_Call_3400
* @tc.name: The parameter "method" of the Callee.off function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string.
*/
it('ACTS_CommonComponent_Call_2600', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2600 begin');
it('ACTS_CommonComponent_Call_3400', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3400 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2600 releaseCallBack' + data);
done();
let finishFlag = 0;
try {
globalThis.callee.off('');
} catch (err) {
console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2600, "case2600", 'default');
caller.call(null, param).then(() => {
console.log('ACTS_CommonComponent_Call_2600 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_2600 call exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_2700
* @tc.name: The parameter "method" of the Caller.call function is undefined.
* @tc.desc: Verify that the parameter "method" of the Caller.call function is undefined.
* @tc.number: ACTS_CommonComponent_Call_3500
* @tc.name: The parameter "method" of the Callee.off function is null.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is null.
*/
it('ACTS_CommonComponent_Call_2700', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2700 begin');
it('ACTS_CommonComponent_Call_3500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3500 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2700 releaseCallBack' + data);
done();
let finishFlag = 0;
try {
globalThis.callee.off(null);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2700, "case2700", 'default');
caller.call(undefined, param).then(() => {
console.log('ACTS_CommonComponent_Call_2700 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_2700 call exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2800
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_2800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2800 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2800 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2800, "case2800", 'default');
caller.callWithResult('', param).then((data) => {
console.log('ACTS_CommonComponent_Call_2800 callWithResult success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_2800 callWithResult exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2900
* @tc.name: The parameter "method" of the Caller.callWithResult function is null.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is null.
*/
it('ACTS_CommonComponent_Call_2900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_2900 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_2900 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(2900, "case2900", 'default');
caller.callWithResult(null, param).then((data) => {
console.log('ACTS_CommonComponent_Call_2900 callWithResult success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_2900 callWithResult exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_3000
* @tc.name: The parameter "method" of the Caller.callWithResult function is undefined.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is undefined.
*/
it('ACTS_CommonComponent_Call_3000', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3000 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_3000 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(3000, "case3000", 'default');
caller.callWithResult(undefined, param).then((data) => {
console.log('ACTS_CommonComponent_Call_3000 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_3000 catch exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_3100
* @tc.name: The parameter method of the Callee.on function is an empty string.
* @tc.desc: Verify that the parameter method of the Callee.on function is an empty string.
*/
it('ACTS_CommonComponent_Call_3100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3100 begin');
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3100 onTest');
}
let finishFlag = 0;
try {
globalThis.callee.on('', onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3200
* @tc.name: The parameter method of the Callee.on function is null.
* @tc.desc: Verify that the parameter method of the Callee.on function is null.
*/
it('ACTS_CommonComponent_Call_3200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3200 begin');
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3200 onTest');
}
let finishFlag = 0;
try {
globalThis.callee.on(null, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3300
* @tc.name: The parameter method of the Caller.callWithResult function is undefined.
* @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined.
*/
it('ACTS_CommonComponent_Call_3300', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3300 begin');
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3300 onTest');
}
let finishFlag = 0;
try {
globalThis.callee.on(undefined, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3400
* @tc.name: The parameter "method" of the Callee.off function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string.
*/
it('ACTS_CommonComponent_Call_3400', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3400 begin');
let finishFlag = 0;
try {
globalThis.callee.off('');
} catch (err) {
console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3500
* @tc.name: The parameter "method" of the Callee.off function is null.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is null.
*/
it('ACTS_CommonComponent_Call_3500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3500 begin');
let finishFlag = 0;
try {
globalThis.callee.off(null);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3600
......@@ -1203,201 +777,6 @@ export default function abilityTest() {
done();
})
/*
* @tc.number: ACTS_CommonComponent_Call_3700
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_3700', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3700 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_3700 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
console.log('ACTS_CommonComponent_Call_3700 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_3700 before call')
caller.call('testCall', "").then(() => {
console.log('ACTS_CommonComponent_Call_3700 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_3700 catch exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_3800
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_3800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3800 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_3800 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
console.log('ACTS_CommonComponent_Call_3800 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_3800 before call')
caller.call('testCall', null).then(() => {
console.log('ACTS_CommonComponent_Call_3800 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_3800 catch exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_3900
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_3900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3900 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_3900 releaseCallBack' + data);
done();
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
console.log('ACTS_CommonComponent_Call_3900 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_3900 before call')
caller.call('testCall', undefined).then(() => {
console.log('ACTS_CommonComponent_Call_3900 call success');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_3900 catch exception' + err);
expect(err.message).assertEqual("function input parameter error");
caller.release();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4000
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_4000', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_4000 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_4000 release CallBack' + data);
done();
}
globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
}).then((data) => {
let caller = data;
console.log('ACTS_CommonComponent_Call_4000 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_4000 before call')
caller.callWithResult('testCallWithResult', "").then((data) => {
console.log('ACTS_CommonComponent_Call_4000 call success');
expect(data).assertEqual(undefined);
caller.release();
}).catch((e) => {
console.log('ACTS_CommonComponent_Call_4000 call err' + e);
caller.release();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4100
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_4100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_4100 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_4100 release CallBack' + data);
done();
}
globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
}).then((data) => {
let caller = data;
console.log('ACTS_CommonComponent_Call_4100 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_4100 before call')
caller.callWithResult('testCallWithResult', null).then((data) => {
console.log('ACTS_CommonComponent_Call_4100 call success');
expect(data).assertEqual(undefined);
caller.release();
}).catch((e) => {
console.log('ACTS_CommonComponent_Call_4100 call err' + e);
caller.release();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4200
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_4200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_4200 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_4200 release CallBack' + data);
done();
}
globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
}).then((data) => {
let caller = data;
console.log('ACTS_CommonComponent_Call_4200 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_4200 before call')
caller.callWithResult('testCallWithResult', undefined).then((data) => {
console.log('ACTS_CommonComponent_Call_4200 call success');
expect(data).assertEqual(undefined);
caller.release();
}).catch((e) => {
console.log('ACTS_CommonComponent_Call_4200 call err' + e);
caller.release();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4300
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
......@@ -1458,102 +837,6 @@ export default function abilityTest() {
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_4800
* @tc.name: Callee is in standalone process AbilityStage of the same app.
* @tc.desc: Verify Callee is in standalone process AbilityStage of the same app.
*/
it('ACTS_CommonComponent_Call_4800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_4800 begin');
let bundleNameCallee = "com.example.systemcalltest";
let abilityNameCallee = "com.example.second.MainAbility";
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_4800 releaseCallBack:' + data);
expect(data).assertEqual("release");
done();
}
let want = {
bundleName: bundleNameCallee,
abilityName: abilityNameCallee,
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want);
if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_4800 startAbilityByCall fail');
expect().assertFail();
done();
}
try {
caller.onRelease(releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_4800 Caller onRelease fail ' + e);
expect().assertFail();
done();
}
let param = new MySequenceable(4600, "case4600", 'default');
caller.callWithResult('test4600', param).then((data) => {
let result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.str).assertEqual("onCreateonBackground");
expect(result.num).assertEqual(0);
});
try {
caller.release();
} catch (e) {
console.log('ACTS_CommonComponent_Call_4800 Caller Release fail:' + e);
expect().assertFail();
done();
}
})
/*
* @tc.number: ACTS_CommonComponent_Call_4900
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_CommonComponent_Call_4900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_4900 begin');
let caller;
let sequenceable = new MySequenceable(1, 'ACTS_CommonComponent_Call_4900', 'default');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_4900 releaseCallBack ' + data);
caller.call('testCall', sequenceable).then(() => {
console.log('ACTS_CommonComponent_Call_4900 call2 success');
expect().assertFail();
done();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_4900 call2 err ' + err);
expect(err.message).assertEqual("function inner object error");
done();
})
}
globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
}).then((data) => {
caller = data;
console.log('ACTS_CommonComponent_Call_4900 before onRelease')
caller.onRelease(releaseCallback);
console.log('ACTS_CommonComponent_Call_4900 before call')
delay(100);
caller.call('testCall', sequenceable).then(() => {
console.log('ACTS_CommonComponent_Call_4900 call1 success');
caller.release();
}).catch((e) => {
console.log('ACTS_CommonComponent_Call_4900 call err' + e);
expect().assertFail();
done();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_5000
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
......@@ -1695,109 +978,5 @@ export default function abilityTest() {
expect(exceptionFlag).assertEqual(true);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_5700
* @tc.name: The mission of callee is not in recent list when startAbilityByCall only.
* @tc.desc: Verify the mission of callee is not in recent list when startAbilityByCall only.
*/
it('ACTS_CommonComponent_Call_5700', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5700 begin');
let bundleNameCallee = "com.example.systemcalltest";
let abilityNameCallee = "com.example.systemcalltest.SecondAbility";
let want = {
bundleName: bundleNameCallee,
abilityName: abilityNameCallee,
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want);
if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail');
expect().assertFail();
done();
}
async function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5700 releaseCallBack:' + data);
expect(data).assertEqual("release");
let missionId = await getMissionId(abilityNameCallee, 0);
expect(missionId == -1).assertTrue();
done();
}
try {
caller.onRelease(releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e);
expect().assertFail();
done();
}
try {
caller.release();
} catch (e) {
console.log('ACTS_CommonComponent_Call_5700 Caller Release fail:' + e);
expect().assertFail();
done();
}
})
/**
* @tc.number: ACTS_CommonComponent_Call_5800
* @tc.name: The mission of callee is in recent list when startAbilityByCall then startAbility.
* @tc.desc: Verify the mission of callee is in recent list when startAbilityByCall then startAbility.
*/
it('ACTS_CommonComponent_Call_5800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5800 begin');
let bundleNameCallee = "com.example.systemcalltest";
let abilityNameCallee = "com.example.systemcalltest.SecondAbility";
let want = {
bundleName: bundleNameCallee,
abilityName: abilityNameCallee,
}
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want);
if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail');
expect().assertFail();
done();
}
function startAbilityCallback(err) {
console.log('ACTS_CommonComponent_Call_5800 startAbilityCallback');
if (err.code != 0) {
expect().assertFail();
done();
}
}
await sleep(1000);
await globalThis.globalThis.abilityContext.startAbility(want, startAbilityCallback);
async function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5800 releaseCallBack:' + data);
expect(data).assertEqual("release");
let missionId = await getMissionId(abilityNameCallee, 0);
expect(missionId != -1).assertTrue();
done();
}
try {
caller.onRelease(releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e);
expect().assertFail();
done();
}
try {
caller.release();
} catch (e) {
console.log('ACTS_CommonComponent_Call_5800 Caller Release fail:' + e);
expect().assertFail();
done();
}
})
})
}
\ No newline at end of file
......@@ -80,6 +80,18 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
},
{
"name":"ohos.permission.START_INVISIBLE_ABILITY",
"reason":"need use ohos.permission.START_INVISIBLE_ABILITY"
},
{
"name":"ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
"reason":"need use ohos.permission.ABILITY_BACKGROUND_COMMUNICATION"
}
]
}
......
......@@ -93,201 +93,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_1100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1100 begin');
var subscriber;
function unSubscribeCallBack() {
console.log('ACTS_CommonComponent_Call_1100 unSubscribeCallBack')
setTimeout(()=>{done();}, 100)
}
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1100 releaseCallBack' + data);
commonEvent.unsubscribe(subscriber, unSubscribeCallBack);
}
function subscribeCallBack(err, data) {
console.log('ACTS_CommonComponent_Call_1100 subscribeCallBack data:' + JSON.stringify(data))
expect(data.data).assertEqual('calleeCheckCallParam');
expect(data.parameters.num).assertEqual(1100);
expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1100');
expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1100processed');
console.log('AMS_CallTest_0100 do release');
caller.release();
}
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, subscribeCallBack);
let caller = await globalThis.abilityContext.startAbilityByCall({
let want = {
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestForthAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(1100, "ACTS_CommonComponent_Call_1100", 'default');
caller.call('testCall', param).then(() => {
console.log('ACTS_CommonComponent_Call_1100 call success');
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1100 call exception' + err);
expect().assertFail();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_1200
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_1200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1200 begin');
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1200 releaseCallBack' + data);
setTimeout(()=>{done();}, 100)
}
let caller = await globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestFifthAbilityName,
});
caller.onRelease(releaseCallback);
let param = new MySequenceable(1200, "ACTS_CommonComponent_Call_1200", 'default');
caller.callWithResult('testCallWithResult', param).then((data) => {
console.log('ACTS_CommonComponent_Call_1200 call success');
var result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.num).assertEqual(1200);
expect(result.str).assertEqual('ACTS_CommonComponent_Call_1200');
expect(result.result).assertEqual('ACTS_CommonComponent_Call_1200processed');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1200 call exception' + err);
expect().assertFail();
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_1300
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_1300', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1300 begin');
var subscriber;
var caller
function unSubscribeCallBack() {
console.log('ACTS_CommonComponent_Call_1300 unSubscribeCallBack')
setTimeout(()=>{done();}, 100)
}
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1300 releaseCallBack' + data);
commonEvent.unsubscribe(subscriber, unSubscribeCallBack);
}
function releaseCallback1(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1300 releaseCallBack1' + data);
setTimeout(() => {
globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestSecondAbilityName,
}).then(data => {
caller = data;
console.log('ACTS_CommonComponent_Call_1300 caller get')
caller.onRelease(releaseCallback);
let param = new MySequenceable(1300, "ACTS_CommonComponent_Call_1300", 'default');
caller.call('testCall', param).then(() => {
console.log('ACTS_CommonComponent_Call_1300 call success');
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1300 call exception' + err);
expect().assertFail();
})
})
},100);
}
function subscribeCallBack(err, data) {
console.log('ACTS_CommonComponent_Call_1300 subscribeCallBack data:' + JSON.stringify(data))
expect(data.data).assertEqual('calleeCheckCallParam');
expect(data.parameters.num).assertEqual(1300);
expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1300');
expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1300processed');
console.log('ACTS_CommonComponent_Call_1300 do release');
caller.release();
}
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestSecondAbilityName,
}).then(data => {
caller = data;
console.log('ACTS_CommonComponent_Call_1300 caller get')
caller.onRelease(releaseCallback1);
caller.release();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_1400
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_1400', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1400 begin');
var caller
function releaseCallback(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1400 releaseCallBack' + data);
setTimeout(()=>{done();}, 100)
}
function releaseCallback1(data) {
expect(data).assertEqual('release');
console.log('ACTS_CommonComponent_Call_1400 releaseCallBack' + data);
setTimeout(() => {
globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestSecondAbilityName,
}).then(data => {
caller = data;
caller.onRelease(releaseCallback);
let param = new MySequenceable(1400, "ACTS_CommonComponent_Call_1400", 'default');
caller.callWithResult('testCallWithResult', param).then((data) => {
console.log('ACTS_CommonComponent_Call_1400 call success');
var result = new MySequenceable(0, '', '');
data.readSequenceable(result);
expect(result.num).assertEqual(1400);
expect(result.str).assertEqual('ACTS_CommonComponent_Call_1400');
expect(result.result).assertEqual('ACTS_CommonComponent_Call_1400processed');
caller.release();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1400 call exception' + err);
expect().assertFail();
caller.release();
})
});
},100);
}
globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestSecondAbilityName,
}).then(data => {
caller = data;
console.log('ACTS_CommonComponent_Call_1400 caller get')
caller.onRelease(releaseCallback1);
caller.release();
})
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`);
expect().assertFail();
done();
})
.catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`);
done();
});
})
/**
......@@ -297,17 +116,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_1500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1500 begin');
var caller;
try{
caller = await globalThis.abilityContext.startAbilityByCall({
bundleName: systemAppCalleeABundleName,
abilityName: systemAppCalleeAMainAbilityName,
});
}catch(error){
console.log('ACTS_CommonComponent_Call_1500 start err'+error);
expect(error=="Error: function request remote error").assertTrue();
done();
let want = {
bundleName: systemAppCalleeABundleName,
abilityName: systemAppCalleeAMainAbilityName,
}
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`);
expect().assertFail();
done();
})
.catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`);
done();
});
})
/**
......@@ -317,49 +139,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_1600', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1600 begin');
let caller;
let exceptionFlag = false;
try {
caller = await globalThis.abilityContext.startAbilityByCall({
bundleName: thirdAppABundleName,
abilityName: thirdAppAMainAbilityName,
});
console.log('ACTS_CommonComponent_Call_1600 startAbilityByCall' + JSON.stringify(caller))
} catch(err) {
console.log('ACTS_CommonComponent_Call_1600 exception' + err);
exceptionFlag = true;
expect(err.message).assertEqual("function request remote error");
let want = {
bundleName: thirdAppABundleName,
abilityName: thirdAppAMainAbilityName,
}
expect(exceptionFlag).assertEqual(true);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_1800
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string.
*/
it('ACTS_CommonComponent_Call_1800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1800 begin');
let caller;
let exceptionFlag = false;
try {
caller = await globalThis.abilityContext.startAbilityByCall({
bundleName: thirdCallTestBundleName,
abilityName: thirdCallTestThirdAbilityName,
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`);
expect().assertFail();
done();
})
.catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`);
done();
});
console.log('ACTS_CommonComponent_Call_1800 startAbilityByCall' + JSON.stringify(caller))
} catch(err) {
console.log('ACTS_CommonComponent_Call_1800 exception' + err);
exceptionFlag = true;
expect(err.message).assertEqual("function request remote error");
}
expect(exceptionFlag).assertEqual(true);
done();
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册