diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json index 3b55239d095be39f47ef27bcbc8dc3145954a422..e5c7ab53ae398cc0a5b005dad2c82dc2497ec531 100644 --- a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json @@ -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 diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json index 7c3003b37be4f151c8e616c413817c51edb34251..dd5b0e1323ed1d091263316458a7e8dcb088d4db 100644 --- a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json @@ -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 diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets index 50168d40f3a57d05b88e980ea6e572ae16dbe843..2303c1beea4f3e05f737384db6cdcb4186953eb7 100644 --- a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets @@ -1002,5 +1002,186 @@ export default function abilityTest() { expect(exceptionFlag).assertEqual(true); 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 diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets index 528878d0d7055a1d00e4b52a2fdd0b61816cf7c6..5c30ed1898afd300885f5920ec2660bd26ffea09 100644 --- a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets @@ -88,8 +88,8 @@ export default function abilityTest() { /** * @tc.number: ACTS_CommonComponent_Call_1100 - * @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. + * @tc.name: The thirdApp is not allowed to startAbilityByCall. + * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall. */ it('ACTS_CommonComponent_Call_1100', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1100 begin'); @@ -111,8 +111,8 @@ export default function abilityTest() { /** * @tc.number: ACTS_CommonComponent_Call_1500 - * @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. + * @tc.name: The thirdApp is not allowed to startAbilityByCall. + * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall. */ it('ACTS_CommonComponent_Call_1500', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1500 begin'); @@ -122,20 +122,20 @@ export default function abilityTest() { } globalThis.abilityContext.startAbilityByCall(want) .then(data => { - console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); + console.info(`ACTS_CommonComponent_Call_1500 startAbilityByCall SUCCESS`); expect().assertFail(); done(); }) .catch(error => { - console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); + console.info(`ACTS_CommonComponent_Call_1500 startAbilityByCall Catch`); done(); }); }) /** * @tc.number: ACTS_CommonComponent_Call_1600 - * @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. + * @tc.name: The thirdApp is not allowed to startAbilityByCall. + * @tc.desc: Verify that the thirdApp is not allowed to startAbilityByCall. */ it('ACTS_CommonComponent_Call_1600', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1600 begin'); @@ -145,12 +145,12 @@ export default function abilityTest() { } globalThis.abilityContext.startAbilityByCall(want) .then(data => { - console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); + console.info(`ACTS_CommonComponent_Call_1600 startAbilityByCall SUCCESS`); expect().assertFail(); done(); }) .catch(error => { - console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); + console.info(`ACTS_CommonComponent_Call_1600 startAbilityByCall Catch`); done(); }); }) diff --git a/ability/ability_runtime/actssingleton/SystemSingletonExtension/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actssingleton/SystemSingletonExtension/entry/src/main/ets/test/Ability.test.ets index fea65476f559e7001229405c877b6d9986e1bff6..efbb1f09e27934dcc99cf7c5b8b5440d20dd7f88 100644 --- a/ability/ability_runtime/actssingleton/SystemSingletonExtension/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actssingleton/SystemSingletonExtension/entry/src/main/ets/test/Ability.test.ets @@ -48,7 +48,7 @@ export default function singleusermodelTest() { console.debug("====>start connectAbilityWithAccount====>"); - connId = globalThis.abilityContext.connectAbilityWithAccount( + connId = globalThis.abilityContext.connectServiceExtensionAbilityWithAccount( { bundleName: "com.singleusermodel.actssingleusertest", abilityName: "ServiceAbility1", @@ -86,7 +86,7 @@ export default function singleusermodelTest() { console.info('executeShellCommand : err : ' + JSON.stringify(err)); }) 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)); }) }, START_ABILITY_TIMEOUT); diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json index 10f133efe6e870d7c90b1698070b401f9cd91423..900ce2bf908e59eaaec972583ce250155c60f8be 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json @@ -114,6 +114,14 @@ { "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", "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" } ] } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/module.json index 3863039da8db2a8f9fa42ccf19aadc7f8d10b96e..7067b2afa0b090c91d2c706fce1347fec95a4f68 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/module.json @@ -61,6 +61,16 @@ "type": "service", "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" + } ] } } diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets index 16e4658887f2f8b7a740b1690a7cd4a3496cba37..6da29857f1c1b9c884ff27177dfcd6a02c831fe8 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets @@ -81,13 +81,12 @@ export default function abilityTest() { let id; let connId; - function subscribeCallBack(err, data) { console.debug("====>ACTS_ConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); console.debug("====>ACTS_ConnectAbility_0100 5 "); - globalThis.abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectServiceExtensionAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -98,7 +97,6 @@ export default function abilityTest() { } - commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { console.debug("====>ACTS_ConnectAbility_0100 2 Subscriber1====>"); subscriber = data; @@ -114,7 +112,7 @@ export default function abilityTest() { expect().assertFail(); console.debug('AMS_ConnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - globalThis.abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectServiceExtensionAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -139,7 +137,7 @@ export default function abilityTest() { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ConnectAbility_0100 3 "); - connId = await globalThis.abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectServiceExtensionAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -152,7 +150,6 @@ export default function abilityTest() { } ); console.debug("====>ACTS_ConnectAbility_0100 4 "); - }) /*