From 7c534bd7f7998d019473092cddfbafd5c728a191 Mon Sep 17 00:00:00 2001 From: bayanxing Date: Mon, 23 May 2022 17:05:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E5=92=8C=E8=A1=A5=E5=85=85co?= =?UTF-8?q?ntext.requestPermissionsFromUser=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bayanxing --- .../src/main/js/test/ContextJsunit.test.js | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js index f476f53b3..a67c88111 100644 --- a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js +++ b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js @@ -229,15 +229,39 @@ describe('ActsContextTest', function () { it('ACTS_RequestPermissionForUser_0100', 0, async function (done) { var ret = false var context = await featureAbility.getContext(); - console.log("RequestPermissionForUser ----------1"); + console.log("ACTS_RequestPermissionForUser_0100 ----------1"); context.requestPermissionsFromUser([], 1, (err, data)=>{ - console.log("====>requestdata====>" + JSON.stringify(data)); - console.log("====>requesterrcode====>" + JSON.stringify(err.code)); + console.log("====>ACTS_RequestPermissionForUser_0100 data====>" + JSON.stringify(data)); + console.log("====>ACTS_RequestPermissionForUser_0100 err====>" + JSON.stringify(err.code)); expect(err.code).assertEqual(-104) }); - console.log("RequestPermissionForUser ----------2"); + console.log("ACTS_RequestPermissionForUser_0100 ----------2"); + ret = true + done(); + setTimeout(function(){ + expect(ret).assertEqual(true) + },1000) + }) + + // @tc.number: ACTS_RequestPermissionForUser_0200 + // @tc.name: requestPermissionsFromUser : Requests certain permissions from the system. + // permission: The list of permissions to be requested. + // @tc.desc: Requests certain permissions from the system. + // process is the current process. (by promise) + it('ACTS_RequestPermissionForUser_0200', 0, async function (done) { + var ret = false + var context = await featureAbility.getContext(); + console.log("ACTS_RequestPermissionForUser_0200 ----------1"); + + context.requestPermissionsFromUser([], 1).then((data) => { + console.log("====>ACTS_RequestPermissionForUser_0200 data====>" + JSON.stringify(data)); + }).catch((err) => { + console.log("====>ACTS_RequestPermissionForUser_0200 err====>" + JSON.stringify(err.code)); + expect(err.code).assertEqual(-104) + }) + console.log("ACTS_RequestPermissionForUser_0200 ----------2"); ret = true done(); setTimeout(function(){ -- GitLab