未验证 提交 c4212774 编写于 作者: O openharmony_ci 提交者: Gitee

!7406 包管理修改用例,仅支持系统资源Hap定义权限生效

Merge pull request !7406 from wangtiantian/fix_definePerm
......@@ -63,14 +63,12 @@ describe('ActsBmsAccessTokenTest', function () {
await bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME3);
expect(bundleInfo.reqPermissions.length).assertEqual(3);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissionStates.length).assertEqual(3);
expect(bundleInfo.reqPermissions.length).assertEqual(2);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.DISTRIBUTED_DATASYNC");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissionStates.length).assertEqual(2);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
done();
}).catch((err) => {
expect(err).assertFail();
......@@ -87,18 +85,16 @@ describe('ActsBmsAccessTokenTest', function () {
await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME2);
expect(bundleInfo.reqPermissions.length).assertEqual(5);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.VIBRATE");
expect(bundleInfo.reqPermissionStates.length).assertEqual(5);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissions.length).assertEqual(4);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.VIBRATE");
expect(bundleInfo.reqPermissionStates.length).assertEqual(4);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
done();
}).catch((err) => {
expect(err).assertFail();
......@@ -115,20 +111,18 @@ describe('ActsBmsAccessTokenTest', function () {
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions.length).assertEqual(6);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.VIBRATE");
expect(bundleInfo.reqPermissionStates.length).assertEqual(6);
expect(bundleInfo.reqPermissions.length).assertEqual(5);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.DISTRIBUTED_DATASYNC");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.VIBRATE");
expect(bundleInfo.reqPermissionStates.length).assertEqual(5);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
expect(bundleInfo.reqPermissionStates[5]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED);
done();
}).catch((err) => {
expect(err).assertFail();
......
......@@ -67,34 +67,10 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
"name":"ohos.permission.DISTRIBUTED_DATASYNC",
"reason":"use ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
......
......@@ -67,34 +67,10 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
"name":"ohos.permission.DISTRIBUTED_DATASYNC",
"reason":"use ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
......
......@@ -67,34 +67,10 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
"name":"ohos.permission.DISTRIBUTED_DATASYNC",
"reason":"use ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
......
......@@ -67,31 +67,7 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
"reason": "use ohos.permission.KEEP_BACKGROUND_RUNNING"
......
......@@ -67,31 +67,7 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
"reason": "use ohos.permission.KEEP_BACKGROUND_RUNNING"
......
......@@ -67,34 +67,10 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
"name":"ohos.permission.DISTRIBUTED_DATASYNC",
"reason":"use ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
......
......@@ -67,34 +67,10 @@
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
"name":"ohos.permission.DISTRIBUTED_DATASYNC",
"reason":"use ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
......
......@@ -17,8 +17,8 @@
"package": "ohos.acts.security.access_token.normal",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"tablet",
"default",
"phone"
],
"distro": {
......@@ -26,34 +26,9 @@
"moduleName": "entry",
"moduleType": "entry"
},
"definePermissions": [
{
"name": "ohos.permission.ALPHA",
"grantMode": "user_grant",
"availableLevel": "system_basic",
"provisionEnable": true,
"distributedSceneEnable": true,
"label": "ALPHA label",
"description": "ALPHA description"
},
{
"name": "ohos.permission.BETA",
"grantMode": "system_grant",
"availableLevel": "system_basic",
"provisionEnable": true,
"distributedSceneEnable": true,
"label": "BETA label",
"description": "BETA description"
}
],
"reqPermissions": [
{
"name": "ohos.permission.ALPHA",
"reason": "use ohos.permission.ALPHA"
},
{
"name": "ohos.permission.BETA",
"reason": "use ohos.permission.BETA"
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
......
......@@ -35,8 +35,8 @@ const TIMEOUT = 5000;
const ERR_PARAM_INVALID = 12100001;
const DEFAULT_PERMISSION_FALG = 0;
var permissionNameUser = "ohos.permission.ALPHA";
var permissionNameSystem = "ohos.permission.BETA";
var permissionNameUser = "ohos.permission.DISTRIBUTED_DATASYNC";
var permissionNameSystem = "ohos.permission.GET_BUNDLE_INFO";
var tokenID = undefined;
export default function AccessTokenTest() {
describe('AccessTokenTest', function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册