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

!6195 【Monthly1018挑单】覆盖Caller与AbilityContext的新增接口

Merge pull request !6195 from HuangXW/cherry-pick-1666878504
...@@ -32,6 +32,16 @@ ...@@ -32,6 +32,16 @@
} }
] ]
} }
],
"requestPermissions": [
{
"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"
}
] ]
} }
} }
\ No newline at end of file
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
} }
] ]
} }
],
"requestPermissions": [
{
"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"
}
] ]
} }
} }
\ No newline at end of file
...@@ -1002,5 +1002,186 @@ export default function abilityTest() { ...@@ -1002,5 +1002,186 @@ export default function abilityTest() {
expect(exceptionFlag).assertEqual(true); expect(exceptionFlag).assertEqual(true);
done(); done();
}) })
/**
* @tc.number: ACTS_CommonComponent_Call_5500
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
* @tc.desc: Verify that the caller can register the server's death listener.
*/
it('ACTS_CommonComponent_Call_5500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5500 begin');
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5500 releaseCallBack:' + data);
expect(data).assertEqual("died");
done();
}
let bundleNameCallee = "com.example.systemappcalleea";
let abilityNameCallee = "com.example.systemappcalleea.MainAbility";
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_5500 startAbilityByCall fail');
expect().assertFail();
}
try {
caller.on('release', releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_5500 Caller onRelease fail ' + e);
expect().assertFail();
}
await appManager.killProcessesByBundleName(bundleNameCallee);
})
/**
* @tc.number: ACTS_CommonComponent_Call_5600
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
* @tc.desc: Verify that the caller can unregister the server's death listener.
*/
it('ACTS_CommonComponent_Call_5600', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5600 begin');
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5600 releaseCallBack:' + data);
expect(data).assertEqual("died");
done();
}
let bundleNameCallee = "com.example.systemappcalleea";
let abilityNameCallee = "com.example.systemappcalleea.MainAbility";
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_5600 startAbilityByCall fail');
expect().assertFail();
}
try {
caller.off('release', releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_5600 Caller onRelease fail ' + e);
expect().assertFail();
done();
}
await appManager.killProcessesByBundleName(bundleNameCallee);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_5700
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
* @tc.desc: Verify that the caller can unregister the server's death listener.
*/
it('ACTS_CommonComponent_Call_5700', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5700 begin');
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5700 releaseCallBack:' + data);
expect(data).assertEqual("died");
done();
}
let bundleNameCallee = "com.example.systemappcalleea";
let abilityNameCallee = "com.example.systemappcalleea.MainAbility";
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();
}
let flag = false;
try {
caller.off('release');
} catch (e) {
console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e);
flag = true;
}
await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).assertEqual(true);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_5800
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
* @tc.desc: Verify that the caller can unregister the server's death listener.
*/
it('ACTS_CommonComponent_Call_5800', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5800 begin');
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5800 releaseCallBack:' + data);
expect(data).assertEqual("died");
done();
}
let bundleNameCallee = "com.example.systemappcalleea";
let abilityNameCallee = "com.example.systemappcalleea.MainAbility";
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();
}
let flag = false;
try {
caller.off('Not release', releaseCallback);
} catch (e) {
console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e);
flag = true;
}
await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).assertEqual(true);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_5900
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
* @tc.desc: Verify that the caller can unregister the server's death listener.
*/
it('ACTS_CommonComponent_Call_5900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5900 begin');
function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5900 releaseCallBack:' + data);
expect(data).assertEqual("died");
done();
}
let bundleNameCallee = "com.example.systemappcalleea";
let abilityNameCallee = "com.example.systemappcalleea.MainAbility";
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_5900 startAbilityByCall fail');
expect().assertFail();
}
let flag = false;
try {
caller.off('Not release');
} catch (e) {
console.log('ACTS_CommonComponent_Call_5900 Caller onRelease fail ' + e);
flag = true;
}
await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).assertEqual(true);
done();
})
}) })
} }
\ No newline at end of file
...@@ -88,8 +88,8 @@ export default function abilityTest() { ...@@ -88,8 +88,8 @@ export default function abilityTest() {
/** /**
* @tc.number: ACTS_CommonComponent_Call_1100 * @tc.number: ACTS_CommonComponent_Call_1100
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. * @tc.name: The thirdApp is not allowed to startAbilityByCall.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall.
*/ */
it('ACTS_CommonComponent_Call_1100', 0, async function (done) { it('ACTS_CommonComponent_Call_1100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1100 begin'); console.log('ACTS_CommonComponent_Call_1100 begin');
...@@ -111,8 +111,8 @@ export default function abilityTest() { ...@@ -111,8 +111,8 @@ export default function abilityTest() {
/** /**
* @tc.number: ACTS_CommonComponent_Call_1500 * @tc.number: ACTS_CommonComponent_Call_1500
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. * @tc.name: The thirdApp is not allowed to startAbilityByCall.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall.
*/ */
it('ACTS_CommonComponent_Call_1500', 0, async function (done) { it('ACTS_CommonComponent_Call_1500', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1500 begin'); console.log('ACTS_CommonComponent_Call_1500 begin');
...@@ -122,20 +122,20 @@ export default function abilityTest() { ...@@ -122,20 +122,20 @@ export default function abilityTest() {
} }
globalThis.abilityContext.startAbilityByCall(want) globalThis.abilityContext.startAbilityByCall(want)
.then(data => { .then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); console.info(`ACTS_CommonComponent_Call_1500 startAbilityByCall SUCCESS`);
expect().assertFail(); expect().assertFail();
done(); done();
}) })
.catch(error => { .catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); console.info(`ACTS_CommonComponent_Call_1500 startAbilityByCall Catch`);
done(); done();
}); });
}) })
/** /**
* @tc.number: ACTS_CommonComponent_Call_1600 * @tc.number: ACTS_CommonComponent_Call_1600
* @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. * @tc.name: The thirdApp is not allowed to startAbilityByCall.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall.
*/ */
it('ACTS_CommonComponent_Call_1600', 0, async function (done) { it('ACTS_CommonComponent_Call_1600', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1600 begin'); console.log('ACTS_CommonComponent_Call_1600 begin');
...@@ -145,12 +145,12 @@ export default function abilityTest() { ...@@ -145,12 +145,12 @@ export default function abilityTest() {
} }
globalThis.abilityContext.startAbilityByCall(want) globalThis.abilityContext.startAbilityByCall(want)
.then(data => { .then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); console.info(`ACTS_CommonComponent_Call_1600 startAbilityByCall SUCCESS`);
expect().assertFail(); expect().assertFail();
done(); done();
}) })
.catch(error => { .catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); console.info(`ACTS_CommonComponent_Call_1600 startAbilityByCall Catch`);
done(); done();
}); });
}) })
......
...@@ -48,7 +48,7 @@ export default function singleusermodelTest() { ...@@ -48,7 +48,7 @@ export default function singleusermodelTest() {
console.debug("====>start connectAbilityWithAccount====>"); console.debug("====>start connectAbilityWithAccount====>");
connId = globalThis.abilityContext.connectAbilityWithAccount( connId = globalThis.abilityContext.connectServiceExtensionAbilityWithAccount(
{ {
bundleName: "com.singleusermodel.actssingleusertest", bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility1", abilityName: "ServiceAbility1",
...@@ -86,7 +86,7 @@ export default function singleusermodelTest() { ...@@ -86,7 +86,7 @@ export default function singleusermodelTest() {
console.info('executeShellCommand : err : ' + JSON.stringify(err)); console.info('executeShellCommand : err : ' + JSON.stringify(err));
}) })
console.debug('ACTS_ExtensionSingleUserModel_0500====>timeout====>'); console.debug('ACTS_ExtensionSingleUserModel_0500====>timeout====>');
await globalThis.abilityContext.disconnectAbility(connId).then((data) => { await globalThis.abilityContext.disconnectServiceExtensionAbility(connId).then((data) => {
console.debug("====>data is====>" + JSON.stringify(data)); console.debug("====>data is====>" + JSON.stringify(data));
}) })
}, START_ABILITY_TIMEOUT); }, START_ABILITY_TIMEOUT);
......
...@@ -114,6 +114,14 @@ ...@@ -114,6 +114,14 @@
{ {
"name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION",
"reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"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"
} }
] ]
} }
......
...@@ -61,6 +61,16 @@ ...@@ -61,6 +61,16 @@
"type": "service", "type": "service",
"visible": true "visible": true
} }
],
"requestPermissions": [
{
"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"
}
] ]
} }
} }
...@@ -81,13 +81,12 @@ export default function abilityTest() { ...@@ -81,13 +81,12 @@ export default function abilityTest() {
let id; let id;
let connId; let connId;
function subscribeCallBack(err, data) { function subscribeCallBack(err, data) {
console.debug("====>ACTS_ConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); console.debug("====>ACTS_ConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id); clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent");
console.debug("====>ACTS_ConnectAbility_0100 5 "); console.debug("====>ACTS_ConnectAbility_0100 5 ");
globalThis.abilityContext.disconnectAbility( globalThis.abilityContext.disconnectServiceExtensionAbility(
connId, connId,
(error, data) => { (error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...@@ -98,7 +97,6 @@ export default function abilityTest() { ...@@ -98,7 +97,6 @@ export default function abilityTest() {
} }
commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => {
console.debug("====>ACTS_ConnectAbility_0100 2 Subscriber1====>"); console.debug("====>ACTS_ConnectAbility_0100 2 Subscriber1====>");
subscriber = data; subscriber = data;
...@@ -114,7 +112,7 @@ export default function abilityTest() { ...@@ -114,7 +112,7 @@ export default function abilityTest() {
expect().assertFail(); expect().assertFail();
console.debug('AMS_ConnectAbility_0100 timeout'); console.debug('AMS_ConnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback) commonEvent.unsubscribe(subscriber, unSubscribeCallback)
globalThis.abilityContext.disconnectAbility( globalThis.abilityContext.disconnectServiceExtensionAbility(
connId, connId,
(error, data) => { (error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...@@ -139,7 +137,7 @@ export default function abilityTest() { ...@@ -139,7 +137,7 @@ export default function abilityTest() {
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ConnectAbility_0100 3 "); console.debug("====>ACTS_ConnectAbility_0100 3 ");
connId = await globalThis.abilityContext.connectAbility( connId = await globalThis.abilityContext.connectServiceExtensionAbility(
{ {
bundleName: "com.example.actsconnectabilitysystemabilitytest", bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...@@ -152,7 +150,6 @@ export default function abilityTest() { ...@@ -152,7 +150,6 @@ export default function abilityTest() {
} }
); );
console.debug("====>ACTS_ConnectAbility_0100 4 "); console.debug("====>ACTS_ConnectAbility_0100 4 ");
}) })
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册