From c36a0dfcb75c0967c747e7ccea468acb5ee2084d Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Thu, 18 Aug 2022 08:34:00 +0800 Subject: [PATCH] =?UTF-8?q?XTS=E5=85=8D=E5=AE=89=E8=A3=85=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A5=97=E9=83=A8=E4=BB=B6=E5=8C=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../main/js/test/MangerAbilityJsunit.test.js | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js index 6c881dad3..a35a7cd28 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -100,13 +100,21 @@ export default function ActsAmsCallBackFifthScene() { done(); } + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + /* * @tc.number : Acts_Ams_test_6600 * @tc.name : getProcessRunningInfos : Get All Running Processes Info * @tc.desc : Get All Running Processes Info(by CallBack) */ it('Acts_Ams_test_6600', 0, async function (done) { - console.info("Acts_Ams_test_6600 begin"); appManager.getProcessRunningInfos( (error, info) => { console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \ @@ -130,5 +138,37 @@ export default function ActsAmsCallBackFifthScene() { } ); }) + + /* + * @tc.number : Acts_Ams_test_6700 + * @tc.name : getProcessRunningInformation : Get All Running Processes Information + * @tc.desc : Get All Running Processes Information(by CallBack) + */ + it('Acts_Ams_test_6700', 0, async function (done) { + appManager.getProcessRunningInformation( + (error, info) => { + console.info('Acts_Ams_test_6700 getProcessRunningInformation error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_6700 getProcessRunningInformation[' + i + "]: \ + " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertLarger(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + } + ); + }) + }) } \ No newline at end of file -- GitLab