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

!5700 XTS适配启动管控---Call调用

Merge pull request !5700 from HuangXW/startUp_Call
......@@ -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.
先完成此消息的编辑!
想要评论请 注册