Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f9c07c93
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f9c07c93
编写于
9月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5700 XTS适配启动管控---Call调用
Merge pull request !5700 from HuangXW/startUp_Call
上级
b805015f
b7caccf1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
137 addition
and
1153 deletion
+137
-1153
ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets
...temcallentrytest/entry/src/main/ets/test/Ability.test.ets
+89
-910
ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json
...tscalltest/systemcallentrytest/entry/src/main/module.json
+12
-0
ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets
...st/thirdcalltest/entry/src/main/ets/test/Ability.test.ets
+36
-243
未找到文件。
ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
f9c07c93
...
...
@@ -170,80 +170,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_0100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_0100 begin');
function
unSubscribeCallBack
()
{
console
.
log
(
'ACTS_CommonComponent_Call_0100 unSubscribeCallBack'
)
subscriber
=
null
;
done
();
}
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_0100 releaseCallBack'
+
data
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallBack
);
}
function
subscribeCallBack
(
err
,
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_0100 subscribeCallBack data:'
+
JSON
.
stringify
(
data
))
expect
(
data
.
data
)
.
assertEqual
(
'calleeCheckCallParam'
);
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
100
);
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'ACTS_CommonComponent_Call_0100'
);
expect
(
data
.
parameters
.
result
)
.
assertEqual
(
'ACTS_CommonComponent_Call_0100processed'
);
console
.
log
(
'AMS_CallTest_0100 do release'
);
caller
.
release
();
}
subscriber
=
await
commonEvent
.
createSubscriber
(
subscriberInfo
);
commonEvent
.
subscribe
(
subscriber
,
subscribeCallBack
);
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
let want = {
bundleName: sysABundleName,
abilityName: sysASecondAbilityName,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
100
,
"ACTS_CommonComponent_Call_0100"
,
'default'
);
caller
.
call
(
'testCall'
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_0100 call success'
);
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_0100 call exception'
+
err
);
}
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall SUCCESS`);
expect().assertFail();
done();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_0200
* @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_0200'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_0200 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_0200 releaseCallBack'
+
data
);
.catch(error => {
console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall Catch`);
done();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
200
,
"ACTS_CommonComponent_Call_0200"
,
'default'
);
caller
.
callWithResult
(
'testCallWithResult'
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_0200 call success'
);
var
result
=
new
MySequenceable
(
0
,
''
,
''
);
data
.
readSequenceable
(
result
);
expect
(
result
.
num
)
.
assertEqual
(
200
);
expect
(
result
.
str
)
.
assertEqual
(
'ACTS_CommonComponent_Call_0200'
);
expect
(
result
.
result
)
.
assertEqual
(
'ACTS_CommonComponent_Call_0200processed'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_0200 call exception'
+
err
);
expect
()
.
assertFail
();
caller
.
release
();
})
})
/**
...
...
@@ -665,89 +605,6 @@ export default function abilityTest() {
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_1900
* @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_1900'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 begin'
);
var
callBackCnt
=
0
;
function
checkFinish
()
{
if
(
callBackCnt
>=
3
)
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 finish release'
)
caller
.
release
();
}
}
function
unSubscribeCallBack
()
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 unSubscribeCallBack'
)
subscriber
=
null
;
done
();
}
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_1900 releaseCallBack'
+
data
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallBack
);
}
function
subscribeCallBack
(
err
,
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 subscribeCallBack data:'
+
JSON
.
stringify
(
data
))
if
(
data
.
data
==
'calleeCheckCallParam'
)
{
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
1900
);
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900'
);
expect
(
data
.
parameters
.
result
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900processed'
);
callBackCnt
++
;
checkFinish
();
}
else
if
(
data
.
data
==
'calleeCheckCall2Param'
)
{
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
1900
);
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900'
);
expect
(
data
.
parameters
.
result
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900processed2'
);
callBackCnt
++
;
checkFinish
();
}
}
subscriber
=
await
commonEvent
.
createSubscriber
(
subscriberInfo
);
commonEvent
.
subscribe
(
subscriber
,
subscribeCallBack
);
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
1900
,
"ACTS_CommonComponent_Call_1900"
,
'default'
);
caller
.
call
(
'testCall'
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call success'
);
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call exception'
+
err
);
expect
()
.
assertFail
();
})
caller
.
call
(
'testCall2'
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call2 success'
);
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call2 exception'
+
err
);
expect
()
.
assertFail
();
})
caller
.
callWithResult
(
'testCallWithResult'
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call success'
);
var
result
=
new
MySequenceable
(
0
,
''
,
''
);
data
.
readSequenceable
(
result
);
expect
(
result
.
num
)
.
assertEqual
(
1900
);
expect
(
result
.
str
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900'
);
expect
(
result
.
result
)
.
assertEqual
(
'ACTS_CommonComponent_Call_1900processed'
);
callBackCnt
++
;
checkFinish
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_1900 call exception'
+
err
);
expect
()
.
assertFail
();
caller
.
release
();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2000
* @tc.name: The callee exits abnormally after the caller requests the call to be called successfully.
...
...
@@ -783,403 +640,120 @@ export default function abilityTest() {
})
/**
* @tc.number: ACTS_CommonComponent_Call_
23
00
* @tc.name:
Callee is in standalone process AbilityStage of the same app
.
* @tc.desc: Verify
Callee is in standalone process AbilityStage of the same app
.
* @tc.number: ACTS_CommonComponent_Call_
31
00
* @tc.name:
The parameter method of the Callee.on function is an empty string
.
* @tc.desc: Verify
that the parameter method of the Callee.on function is an empty string
.
*/
it
(
'ACTS_CommonComponent_Call_2300'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_2300 begin'
);
let
bundleNameCallee
=
"com.example.systemcalltest"
;
let
abilityNameCallee
=
"com.example.second.MainAbility"
;
function
releaseCallback
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_2300 releaseCallBack:'
+
data
);
expect
(
data
)
.
assertEqual
(
"release"
);
done
();
}
it('ACTS_CommonComponent_Call_3100', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_3100 begin');
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_2300 startAbilityByCall fail'
);
expect
()
.
assertFail
();
done
();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3100 onTest');
}
let finishFlag = 0;
try {
caller
.
onRelease
(
releaseCallback
);
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_
2300 Caller onRelease fail '
+
e
);
expect
(
)
.
assertFail
(
);
done
()
;
globalThis.callee.on('', onTest
);
} catch (e
rr
) {
console.log('ACTS_CommonComponent_Call_
3100 callee.on err' + err
);
expect(
err.message).assertEqual("function input parameter error"
);
finishFlag = 1
;
}
let
param
=
new
MySequenceable
(
2300
,
"case2300"
,
'default'
);
caller
.
callWithResult
(
'test2300'
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2300 callWithResult '
+
JSON
.
stringify
(
data
));
let
result
=
new
MySequenceable
(
0
,
''
,
''
);
data
.
readSequenceable
(
result
);
expect
(
result
.
str
)
.
assertEqual
(
"onCreateonBackground"
);
expect
(
result
.
num
)
.
assertEqual
(
0
);
});
try
{
caller
.
release
();
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_2300 Caller Release fail:'
+
e
);
expect
()
.
assertFail
();
expect(finishFlag).assertEqual(1);
done();
}
})
/**
* @tc.number: ACTS_CommonComponent_Call_
24
00
* @tc.name: The
service party cannot provide the corresponding service after calling Callee.off
.
* @tc.desc:
The verification service party cannot provide the corresponding service after calling Callee.off
.
* @tc.number: ACTS_CommonComponent_Call_
32
00
* @tc.name: The
parameter method of the Callee.on function is null
.
* @tc.desc:
Verify that the parameter method of the Callee.on function is null
.
*/
it
(
'ACTS_CommonComponent_Call_
24
00'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_
24
00 begin'
);
it('ACTS_CommonComponent_Call_
32
00', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_
32
00 begin');
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2400 releaseCallBack '
+
data
);
done
();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3200 onTest');
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2400
,
"case2400"
,
'default'
);
let
beforeOff
=
0
;
let
afterOff
=
0
;
await
caller
.
call
(
'testOff'
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2400 call success'
);
beforeOff
=
1
;
})
.
catch
(
err
=>
{
beforeOff
=
2
;
})
globalThis
.
secondCallee
.
off
(
'testOff'
);
await
caller
.
call
(
'testOff'
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2400 call success'
);
afterOff
=
1
;
})
.
catch
(
err
=>
{
afterOff
=
2
;
})
let finishFlag = 0;
try {
globalThis.callee.on(null, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
expect
(
beforeOff
)
.
assertEqual
(
1
);
expect
(
afterOff
)
.
assertEqual
(
2
);
caller
.
release
();
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_
25
00
* @tc.name: The parameter
"method" of the Caller.call function is an empty string
.
* @tc.desc: Verify that the parameter
"method" of the Caller.call function is an empty string
.
* @tc.number: ACTS_CommonComponent_Call_
33
00
* @tc.name: The parameter
method of the Caller.callWithResult function is undefined
.
* @tc.desc: Verify that the parameter
method of the Caller.callWithResult function is undefined
.
*/
it
(
'ACTS_CommonComponent_Call_
25
00'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_
25
00 begin'
);
it('ACTS_CommonComponent_Call_
33
00', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_
33
00 begin');
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2500 releaseCallBack'
+
data
);
done
();
function onTest(data) {
console.log('ACTS_CommonComponent_Call_3300 onTest');
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2500
,
"case2500"
,
'default'
);
caller
.
call
(
''
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2500 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2500 call exception'
+
err
);
let finishFlag = 0;
try {
globalThis.callee.on(undefined, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
caller
.
release
();
})
finishFlag = 1;
}
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_
26
00
* @tc.name: The parameter "method" of the Calle
r.call function is null
.
* @tc.desc: Verify that the parameter "method" of the Calle
r.call function is null
.
* @tc.number: ACTS_CommonComponent_Call_
34
00
* @tc.name: The parameter "method" of the Calle
e.off function is an empty string
.
* @tc.desc: Verify that the parameter "method" of the Calle
e.off function is an empty string
.
*/
it
(
'ACTS_CommonComponent_Call_
26
00'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_
26
00 begin'
);
it('ACTS_CommonComponent_Call_
34
00', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_
34
00 begin');
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2600 releaseCallBack'
+
data
);
done
();
let finishFlag = 0;
try {
globalThis.callee.off('');
} catch (err) {
console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2600
,
"case2600"
,
'default'
);
caller
.
call
(
null
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2600 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2600 call exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
expect(finishFlag).assertEqual(1);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_
27
00
* @tc.name: The parameter "method" of the Calle
r.call function is undefined
.
* @tc.desc: Verify that the parameter "method" of the Calle
r.call function is undefined
.
* @tc.number: ACTS_CommonComponent_Call_
35
00
* @tc.name: The parameter "method" of the Calle
e.off function is null
.
* @tc.desc: Verify that the parameter "method" of the Calle
e.off function is null
.
*/
it
(
'ACTS_CommonComponent_Call_
27
00'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_
27
00 begin'
);
it('ACTS_CommonComponent_Call_
35
00', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_
35
00 begin');
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2700 releaseCallBack'
+
data
);
done
();
let finishFlag = 0;
try {
globalThis.callee.off(null);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
finishFlag = 1;
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2700
,
"case2700"
,
'default'
);
caller
.
call
(
undefined
,
param
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2700 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2700 call exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2800
* @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_2800'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_2800 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2800 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2800
,
"case2800"
,
'default'
);
caller
.
callWithResult
(
''
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2800 callWithResult success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2800 callWithResult exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_2900
* @tc.name: The parameter "method" of the Caller.callWithResult function is null.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is null.
*/
it
(
'ACTS_CommonComponent_Call_2900'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_2900 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_2900 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
2900
,
"case2900"
,
'default'
);
caller
.
callWithResult
(
null
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2900 callWithResult success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_2900 callWithResult exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_3000
* @tc.name: The parameter "method" of the Caller.callWithResult function is undefined.
* @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is undefined.
*/
it
(
'ACTS_CommonComponent_Call_3000'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3000 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_3000 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
caller
.
onRelease
(
releaseCallback
);
let
param
=
new
MySequenceable
(
3000
,
"case3000"
,
'default'
);
caller
.
callWithResult
(
undefined
,
param
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3000 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3000 catch exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/**
* @tc.number: ACTS_CommonComponent_Call_3100
* @tc.name: The parameter method of the Callee.on function is an empty string.
* @tc.desc: Verify that the parameter method of the Callee.on function is an empty string.
*/
it
(
'ACTS_CommonComponent_Call_3100'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3100 begin'
);
function
onTest
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3100 onTest'
);
}
let
finishFlag
=
0
;
try
{
globalThis
.
callee
.
on
(
''
,
onTest
);
}
catch
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3100 callee.on err'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
finishFlag
=
1
;
}
expect
(
finishFlag
)
.
assertEqual
(
1
);
done
();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3200
* @tc.name: The parameter method of the Callee.on function is null.
* @tc.desc: Verify that the parameter method of the Callee.on function is null.
*/
it
(
'ACTS_CommonComponent_Call_3200'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3200 begin'
);
function
onTest
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3200 onTest'
);
}
let
finishFlag
=
0
;
try
{
globalThis
.
callee
.
on
(
null
,
onTest
);
}
catch
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3200 callee.on err'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
finishFlag
=
1
;
}
expect
(
finishFlag
)
.
assertEqual
(
1
);
done
();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3300
* @tc.name: The parameter method of the Caller.callWithResult function is undefined.
* @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined.
*/
it
(
'ACTS_CommonComponent_Call_3300'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3300 begin'
);
function
onTest
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3300 onTest'
);
}
let
finishFlag
=
0
;
try
{
globalThis
.
callee
.
on
(
undefined
,
onTest
);
}
catch
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3300 callee.on err'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
finishFlag
=
1
;
}
expect
(
finishFlag
)
.
assertEqual
(
1
);
done
();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3400
* @tc.name: The parameter "method" of the Callee.off function is an empty string.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string.
*/
it
(
'ACTS_CommonComponent_Call_3400'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3400 begin'
);
let
finishFlag
=
0
;
try
{
globalThis
.
callee
.
off
(
''
);
}
catch
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3400 callee.off err'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
finishFlag
=
1
;
}
expect
(
finishFlag
)
.
assertEqual
(
1
);
done
();
})
/**
* @tc.number: ACTS_CommonComponent_Call_3500
* @tc.name: The parameter "method" of the Callee.off function is null.
* @tc.desc: Verify that the parameter "method" of the Callee.off function is null.
*/
it
(
'ACTS_CommonComponent_Call_3500'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3500 begin'
);
let
finishFlag
=
0
;
try
{
globalThis
.
callee
.
off
(
null
);
}
catch
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3500 callee.off err'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
finishFlag
=
1
;
}
expect
(
finishFlag
)
.
assertEqual
(
1
);
done
();
expect(finishFlag).assertEqual(1);
done();
})
/**
...
...
@@ -1203,201 +777,6 @@ export default function abilityTest() {
done();
})
/*
* @tc.number: ACTS_CommonComponent_Call_3700
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_3700'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3700 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_3700 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
console
.
log
(
'ACTS_CommonComponent_Call_3700 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_3700 before call'
)
caller
.
call
(
'testCall'
,
""
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3700 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3700 catch exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_3800
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_3800'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3800 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_3800 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
console
.
log
(
'ACTS_CommonComponent_Call_3800 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_3800 before call'
)
caller
.
call
(
'testCall'
,
null
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3800 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3800 catch exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_3900
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_3900'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_3900 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_3900 releaseCallBack'
+
data
);
done
();
}
let
caller
=
await
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
});
console
.
log
(
'ACTS_CommonComponent_Call_3900 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_3900 before call'
)
caller
.
call
(
'testCall'
,
undefined
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3900 call success'
);
caller
.
release
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_3900 catch exception'
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function input parameter error"
);
caller
.
release
();
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4000
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_4000'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4000 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_4000 release CallBack'
+
data
);
done
();
}
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
})
.
then
((
data
)
=>
{
let
caller
=
data
;
console
.
log
(
'ACTS_CommonComponent_Call_4000 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_4000 before call'
)
caller
.
callWithResult
(
'testCallWithResult'
,
""
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4000 call success'
);
expect
(
data
)
.
assertEqual
(
undefined
);
caller
.
release
();
})
.
catch
((
e
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4000 call err'
+
e
);
caller
.
release
();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4100
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_4100'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4100 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_4100 release CallBack'
+
data
);
done
();
}
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
})
.
then
((
data
)
=>
{
let
caller
=
data
;
console
.
log
(
'ACTS_CommonComponent_Call_4100 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_4100 before call'
)
caller
.
callWithResult
(
'testCallWithResult'
,
null
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4100 call success'
);
expect
(
data
)
.
assertEqual
(
undefined
);
caller
.
release
();
})
.
catch
((
e
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4100 call err'
+
e
);
caller
.
release
();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4200
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_4200'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4200 begin'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_4200 release CallBack'
+
data
);
done
();
}
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
})
.
then
((
data
)
=>
{
let
caller
=
data
;
console
.
log
(
'ACTS_CommonComponent_Call_4200 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_4200 before call'
)
caller
.
callWithResult
(
'testCallWithResult'
,
undefined
)
.
then
((
data
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4200 call success'
);
expect
(
data
)
.
assertEqual
(
undefined
);
caller
.
release
();
})
.
catch
((
e
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4200 call err'
+
e
);
caller
.
release
();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_4300
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
...
...
@@ -1458,102 +837,6 @@ export default function abilityTest() {
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_4800
* @tc.name: Callee is in standalone process AbilityStage of the same app.
* @tc.desc: Verify Callee is in standalone process AbilityStage of the same app.
*/
it
(
'ACTS_CommonComponent_Call_4800'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4800 begin'
);
let
bundleNameCallee
=
"com.example.systemcalltest"
;
let
abilityNameCallee
=
"com.example.second.MainAbility"
;
function
releaseCallback
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4800 releaseCallBack:'
+
data
);
expect
(
data
)
.
assertEqual
(
"release"
);
done
();
}
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_4800 startAbilityByCall fail'
);
expect
()
.
assertFail
();
done
();
}
try
{
caller
.
onRelease
(
releaseCallback
);
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4800 Caller onRelease fail '
+
e
);
expect
()
.
assertFail
();
done
();
}
let
param
=
new
MySequenceable
(
4600
,
"case4600"
,
'default'
);
caller
.
callWithResult
(
'test4600'
,
param
)
.
then
((
data
)
=>
{
let
result
=
new
MySequenceable
(
0
,
''
,
''
);
data
.
readSequenceable
(
result
);
expect
(
result
.
str
)
.
assertEqual
(
"onCreateonBackground"
);
expect
(
result
.
num
)
.
assertEqual
(
0
);
});
try
{
caller
.
release
();
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4800 Caller Release fail:'
+
e
);
expect
()
.
assertFail
();
done
();
}
})
/*
* @tc.number: ACTS_CommonComponent_Call_4900
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it
(
'ACTS_CommonComponent_Call_4900'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_4900 begin'
);
let
caller
;
let
sequenceable
=
new
MySequenceable
(
1
,
'ACTS_CommonComponent_Call_4900'
,
'default'
);
function
releaseCallback
(
data
)
{
expect
(
data
)
.
assertEqual
(
'release'
);
console
.
log
(
'ACTS_CommonComponent_Call_4900 releaseCallBack '
+
data
);
caller
.
call
(
'testCall'
,
sequenceable
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4900 call2 success'
);
expect
()
.
assertFail
();
done
();
})
.
catch
(
err
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4900 call2 err '
+
err
);
expect
(
err
.
message
)
.
assertEqual
(
"function inner object error"
);
done
();
})
}
globalThis
.
globalThis
.
abilityContext
.
startAbilityByCall
({
bundleName
:
sysABundleName
,
abilityName
:
sysASecondAbilityName
,
})
.
then
((
data
)
=>
{
caller
=
data
;
console
.
log
(
'ACTS_CommonComponent_Call_4900 before onRelease'
)
caller
.
onRelease
(
releaseCallback
);
console
.
log
(
'ACTS_CommonComponent_Call_4900 before call'
)
delay
(
100
);
caller
.
call
(
'testCall'
,
sequenceable
)
.
then
(()
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4900 call1 success'
);
caller
.
release
();
})
.
catch
((
e
)
=>
{
console
.
log
(
'ACTS_CommonComponent_Call_4900 call err'
+
e
);
expect
()
.
assertFail
();
done
();
});
})
})
/*
* @tc.number: ACTS_CommonComponent_Call_5000
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
...
...
@@ -1695,109 +978,5 @@ export default function abilityTest() {
expect(exceptionFlag).assertEqual(true);
done();
})
/**
* @tc.number: ACTS_CommonComponent_Call_5700
* @tc.name: The mission of callee is not in recent list when startAbilityByCall only.
* @tc.desc: Verify the mission of callee is not in recent list when startAbilityByCall only.
*/
it
(
'ACTS_CommonComponent_Call_5700'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5700 begin'
);
let
bundleNameCallee
=
"com.example.systemcalltest"
;
let
abilityNameCallee
=
"com.example.systemcalltest.SecondAbility"
;
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
();
done
();
}
async
function
releaseCallback
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5700 releaseCallBack:'
+
data
);
expect
(
data
)
.
assertEqual
(
"release"
);
let
missionId
=
await
getMissionId
(
abilityNameCallee
,
0
);
expect
(
missionId
==
-
1
)
.
assertTrue
();
done
();
}
try
{
caller
.
onRelease
(
releaseCallback
);
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5700 Caller onRelease fail '
+
e
);
expect
()
.
assertFail
();
done
();
}
try
{
caller
.
release
();
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5700 Caller Release fail:'
+
e
);
expect
()
.
assertFail
();
done
();
}
})
/**
* @tc.number: ACTS_CommonComponent_Call_5800
* @tc.name: The mission of callee is in recent list when startAbilityByCall then startAbility.
* @tc.desc: Verify the mission of callee is in recent list when startAbilityByCall then startAbility.
*/
it
(
'ACTS_CommonComponent_Call_5800'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5800 begin'
);
let
bundleNameCallee
=
"com.example.systemcalltest"
;
let
abilityNameCallee
=
"com.example.systemcalltest.SecondAbility"
;
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
();
done
();
}
function
startAbilityCallback
(
err
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5800 startAbilityCallback'
);
if
(
err
.
code
!=
0
)
{
expect
()
.
assertFail
();
done
();
}
}
await
sleep
(
1000
);
await
globalThis
.
globalThis
.
abilityContext
.
startAbility
(
want
,
startAbilityCallback
);
async
function
releaseCallback
(
data
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5800 releaseCallBack:'
+
data
);
expect
(
data
)
.
assertEqual
(
"release"
);
let
missionId
=
await
getMissionId
(
abilityNameCallee
,
0
);
expect
(
missionId
!=
-
1
)
.
assertTrue
();
done
();
}
try
{
caller
.
onRelease
(
releaseCallback
);
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5800 Caller onRelease fail '
+
e
);
expect
()
.
assertFail
();
done
();
}
try
{
caller
.
release
();
}
catch
(
e
)
{
console
.
log
(
'ACTS_CommonComponent_Call_5800 Caller Release fail:'
+
e
);
expect
()
.
assertFail
();
done
();
}
})
})
}
\ No newline at end of file
ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json
浏览文件 @
f9c07c93
...
...
@@ -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"
}
]
}
...
...
ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
f9c07c93
...
...
@@ -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);
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`);
expect().assertFail();
caller.releas
e();
don
e();
})
.catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`);
done();
});
},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();
})
})
/**
...
...
@@ -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({
let want = {
bundleName: systemAppCalleeABundleName,
abilityName: systemAppCalleeAMainAbilityName,
});
}catch(error){
console.log('ACTS_CommonComponent_Call_1500 start err'+error);
expect(error=="Error: function request remote error").assertTrue();
done();
}
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({
let want = {
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");
}
expect(exceptionFlag).assertEqual(true);
globalThis.abilityContext.startAbilityByCall(want)
.then(data => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`);
expect().assertFail();
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,
});
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);
.catch(error => {
console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`);
done();
});
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录