提交 aa96e176 编写于 作者: H HuangXW 提交者: jerry

fixed 1a8d58a2 from https://gitee.com/littlejerry1/xts_acts/pulls/6425

CallTest

Change-Id: I4e86341ea8e823cb8be43aec99665c8ac4a12953
Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 da971d02
...@@ -1003,40 +1003,6 @@ export default function abilityTest() { ...@@ -1003,40 +1003,6 @@ export default function abilityTest() {
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.number: ACTS_CommonComponent_Call_5600
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully. * @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
...@@ -1069,7 +1035,6 @@ export default function abilityTest() { ...@@ -1069,7 +1035,6 @@ export default function abilityTest() {
expect().assertFail(); expect().assertFail();
done(); done();
} }
await appManager.killProcessesByBundleName(bundleNameCallee);
done(); done();
}) })
...@@ -1097,6 +1062,7 @@ export default function abilityTest() { ...@@ -1097,6 +1062,7 @@ export default function abilityTest() {
if (typeof caller !== "object" || caller == null) { if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail'); console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail');
expect().assertFail(); expect().assertFail();
done();
} }
let flag = false; let flag = false;
try { try {
...@@ -1104,10 +1070,8 @@ export default function abilityTest() { ...@@ -1104,10 +1070,8 @@ export default function abilityTest() {
} catch (e) { } catch (e) {
console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e); console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e);
flag = true; flag = true;
done();
} }
await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).assertEqual(true);
done();
}) })
/** /**
...@@ -1134,17 +1098,15 @@ export default function abilityTest() { ...@@ -1134,17 +1098,15 @@ export default function abilityTest() {
if (typeof caller !== "object" || caller == null) { if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail'); console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail');
expect().assertFail(); expect().assertFail();
done();
} }
let flag = false; let flag = false;
try { try {
caller.off('Not release', releaseCallback); caller.off('Not release', releaseCallback);
} catch (e) { } catch (e) {
console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e); console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e);
flag = true; done();
} }
await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).assertEqual(true);
done();
}) })
/** /**
...@@ -1155,8 +1117,37 @@ export default function abilityTest() { ...@@ -1155,8 +1117,37 @@ export default function abilityTest() {
it('ACTS_CommonComponent_Call_5900', 0, async function (done) { it('ACTS_CommonComponent_Call_5900', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5900 begin'); console.log('ACTS_CommonComponent_Call_5900 begin');
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();
done();
}
let flag = false;
try {
caller.off('Not release');
} catch (e) {
console.log('ACTS_CommonComponent_Call_5900 Caller onRelease fail ' + e);
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) { function releaseCallback(data) {
console.log('ACTS_CommonComponent_Call_5900 releaseCallBack:' + data); console.log('ACTS_CommonComponent_Call_5500 releaseCallBack:' + data);
expect(data).assertEqual("died"); expect(data).assertEqual("died");
done(); done();
} }
...@@ -1169,19 +1160,17 @@ export default function abilityTest() { ...@@ -1169,19 +1160,17 @@ export default function abilityTest() {
} }
let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want); let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want);
if (typeof caller !== "object" || caller == null) { if (typeof caller !== "object" || caller == null) {
console.log('ACTS_CommonComponent_Call_5900 startAbilityByCall fail'); console.log('ACTS_CommonComponent_Call_5500 startAbilityByCall fail');
expect().assertFail(); expect().assertFail();
} }
let flag = false;
try { try {
caller.off('Not release'); caller.on('release', releaseCallback);
} catch (e) { } catch (e) {
console.log('ACTS_CommonComponent_Call_5900 Caller onRelease fail ' + e); console.log('ACTS_CommonComponent_Call_5500 Caller onRelease fail ' + e);
flag = true; expect().assertFail();
done();
} }
await appManager.killProcessesByBundleName(bundleNameCallee); await appManager.killProcessesByBundleName(bundleNameCallee);
expect(flag).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.
先完成此消息的编辑!
想要评论请 注册