提交 754af1da 编写于 作者: H HuangXW

覆盖Caller、AbilityContext的新增接口

Change-Id: I2618ae540fefe848dd4de579208d226156c33b5f
Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 985060db
......@@ -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 @@
}
]
}
],
"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() {
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
......@@ -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();
});
})
......
......@@ -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);
......
......@@ -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"
}
]
}
......
......@@ -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"
}
]
}
}
......@@ -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 ");
})
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册