Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0b3dbb53
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看板
提交
0b3dbb53
编写于
7月 19, 2023
作者:
X
xinking129
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify runningprocess done
Signed-off-by:
N
xinking129
<
xinxin13@huawei.com
>
上级
074a8805
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
121 addition
and
75 deletion
+121
-75
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
...eOneReply/entry/src/main/ets/entryability/EntryAbility.ts
+1
-2
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/Test.json
...essinformation/GetRunningProcessInformationTest/Test.json
+8
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
...sInformationTest/entry/src/main/ets/test/Ability.test.ets
+112
-73
未找到文件。
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
0b3dbb53
...
...
@@ -41,8 +41,7 @@ let ApplicationStateChangeCallbackFir = {
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
commonEventData
.
parameters
.
commonStateArr
[
1
]
=
1
if
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
if
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
)
{
console
.
info
(
'
entered needbackgroundoff!
'
)
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackFir
)
}
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/Test.json
浏览文件 @
0b3dbb53
...
...
@@ -24,12 +24,20 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"param set persist.sys.suspend_manager_enabled false"
,
"reboot"
,
"power-shell wakeup"
,
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
,
"power-shell setmode 602"
,
"hilog -Q pidoff"
,
"hilog -Q domainoff"
,
"hilog -b D"
,
"setenforce 0"
],
"teardown-command"
:
[
"param set persist.sys.suspend_manager_enabled true"
,
"power-shell setmode 601"
,
"reboot"
]
}
]
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
0b3dbb53
...
...
@@ -24,11 +24,7 @@ let ACTS_ProcessState = {
export default function abilityTest() {
describe('GetRunningProcessInformationTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function () {
var abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
...
...
@@ -38,6 +34,7 @@ export default function abilityTest() {
});
await abilityDelegator.executeShellCommand("hilog -G 20M", async (err, data) => {})
})
afterEach(async function () {
var abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
...
...
@@ -47,58 +44,59 @@ export default function abilityTest() {
let cmd4 = 'aa force-stop com.example.getrunningprocessinformationonereply'
let cmd5 = 'aa force-stop com.example.getrunningprocessinformationtworeply'
let cmd3 = 'hilog -r'
await abilityDelegator.executeShellCommand(cmd1
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd1
).then((
) => {
console.info("executeShellCommand1 callback");
});
await abilityDelegator.executeShellCommand(cmd2
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd2
).then((
) => {
console.info("executeShellCommand2 callback");
});
await abilityDelegator.executeShellCommand(cmd3
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd3
).then((
) => {
console.info("executeShellCommand3 callback");
});
await abilityDelegator.executeShellCommand(cmd4
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd4
).then((
) => {
console.info("executeShellCommand3 callback");
});
await abilityDelegator.executeShellCommand(cmd5
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd5
).then((
) => {
console.info("executeShellCommand3 callback");
});
await abilityDelegator.executeShellCommand(cmd6
, (err : any, data : any
) => {
await abilityDelegator.executeShellCommand(cmd6
).then((
) => {
console.info("executeShellCommand3 callback");
});
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
/*
* @tc.number: Acts_ApplicationStateChange_0100
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, the on interface is called once, but the off interface is not called, and the
* foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0100',0, function (done) {
let want = {
"deviceId": "",
"bundleName": "com.example.applicationstatechangeonereply",
"abilityName": "EntryAbility",
"action": "Normal"
}
}
;
let wantAuxiliary = {
"deviceId": "",
"bundleName": "com.example.applicationstatechangetworeply",
"abilityName": "EntryAbility",
"action": "Normal"
}
let subscriber
}
;
let subscriber
;
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0100 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0100 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0100 err: " + JSON.stringify(err));
if(data.event == "processState") {
try{
expect(data.parameters.commonStateArr[0]).assertEqual(1)
expect(data.parameters.commonStateArr[1]).assertEqual(1)
expect(data.parameters.commonStateArr[2]).assertEqual(-1)
expect(data.parameters.commonStateArr[3]).assertEqual(-1)
expect(data.parameters.commonStateArr[0]).assertEqual(1)
;
expect(data.parameters.commonStateArr[1]).assertEqual(1)
;
expect(data.parameters.commonStateArr[2]).assertEqual(-1)
;
expect(data.parameters.commonStateArr[3]).assertEqual(-1)
;
}
catch(error) {
console.log("An error is generated")
...
...
@@ -113,24 +111,27 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
},3000)
setTimeout(()=>{
done();
}, 18000);
});
},700);
})
/*
* @tc.number: Acts_ApplicationStateChange_0200
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, the on interface is called once, and the off interface is called, and the
* foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0200',0, async function (done) {
let want = {
"deviceId": "",
...
...
@@ -147,6 +148,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0200 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0200 data: " + JSON.stringify(data));
...
...
@@ -174,22 +176,25 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
})
/*
* @tc.number: Acts_ApplicationStateChange_0300
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, the on interface is called many times, but the off interface is not called,
* and the foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0300',0, async function (done) {
let want = {
"deviceId": "",
...
...
@@ -207,6 +212,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0300 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0300 data: " + JSON.stringify(data));
...
...
@@ -233,22 +239,24 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
})
/*
* @tc.number: Acts_ApplicationStateChange_0400
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, the on interface is called many times, and the off interface is called
* (Callback is specified), and the foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0400',0, async function (done) {
let abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
...
...
@@ -268,6 +276,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0400 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0400 data: " + JSON.stringify(data));
...
...
@@ -294,21 +303,24 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
})
/*
* @tc.number: Acts_ApplicationStateChange_0500
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the different application, the on interface is called many times, and the off interface is called,
* and the foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0500',0, async function (done) {
let abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
...
...
@@ -328,6 +340,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0500 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0500 data: " + JSON.stringify(data));
...
...
@@ -354,20 +367,24 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
})
/*
* @tc.number: Acts_ApplicationStateChange_0600
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, the on interface is called many times, and the off interface is called
* (Callback is not specified), and the foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0600',0, async function (done) {
let abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
...
...
@@ -387,6 +404,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0600 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0600 data: " + JSON.stringify(data));
...
...
@@ -413,22 +431,24 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
},700);
})
/*
* @tc.number: Acts_ApplicationStateChange_0700
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, call on interface, call off interface and then call on again., and the
* foreground and background changes can be monitored.
*/
it('Acts_ApplicationStateChange_0700',0, function (done) {
let want = {
"deviceId": "",
...
...
@@ -445,6 +465,7 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0700 unSubscribeCallback");
done();
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_ApplicationStateChange_0700 data: " + JSON.stringify(data));
...
...
@@ -470,23 +491,26 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
},700);
})
/*
* @tc.number: Acts_ApplicationStateChange_0800
* @tc.name: Register and deregister to monitor the foreground and background changes of this application.
* @tc.desc: In the same application, start multiple abilities, call the on interface, and not all the application
* abilities can't be monitored in the background.
*/
it('Acts_ApplicationStateChange_0800', 0, async function (done) {
let want = {
"deviceId": "",
...
...
@@ -501,11 +525,11 @@ export default function abilityTest() {
"action": "DoubleAbilityTest"
}
let subscriber
let subscriber
;
function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0800 unSubscribeCallback");
done()
done()
;
}
function subscribeCallBack(err, data) {
...
...
@@ -531,17 +555,24 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
}, 3000)
})
}, 700)
}, 700);
})
/*
* @tc.number: Acts_GetRunningProcessInformation_AsyncCallback_0100
* @tc.name: When getting ProcessInfo, add the state field.
* @tc.desc: When the application obtains and does not obtain the focus, it can get the process information by
* calling the getRunningProcessInformation interface in AsyncCallback mode.
*/
it('Acts_GetRunningProcessInformation_AsyncCallback_0100', 0, async function (done) {
let TAG = 'getRunningProcess'
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0100 start<=====")
...
...
@@ -588,6 +619,7 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("start normal ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(async () => {
...
...
@@ -609,8 +641,14 @@ export default function abilityTest() {
}, 3000)
})
}, 1000)
})
})
/*
* @tc.number: Acts_GetRunningProcessInformation_Promise_0100
* @tc.name: When getting ProcessInfo, add the state field.
* @tc.desc: When the application obtains and does not obtain the focus, it can get the process information by
* calling the getRunningProcessInformation interface in promise mode.
*/
it('Acts_GetRunningProcessInformation_Promise_0100', 0, async function (done) {
let TAG = 'getRunningProcess'
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0100 start<=====")
...
...
@@ -624,7 +662,7 @@ export default function abilityTest() {
function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 unSubscribeCallback");
done()
done()
;
}
function subscribeCallBack(err, data) {
...
...
@@ -657,6 +695,7 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("start normal ability error.code = " + error.code)
expect(error.code).assertEqual(0);
})
setTimeout(async () => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录