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

!2414 add permission for xts

Merge pull request !2414 from zhangxingxia/master
{
"app": {
"bundleName": "ohos.acts.storage.filemanager",
"apiVersion": {
"compatible": 6,
"target": 7
},
"vendor": "example",
"bundleName": "ohos.acts.storage.filemanager",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"apiVersion": {
"compatible": 4,
"target": 5
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.storage.filemanager",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
......@@ -36,15 +30,45 @@
]
}
],
"name": "ohos.acts.storage.filemanager.MainAbility",
"visible": true,
"icon": "$media:icon",
"name": "ohos.acts.storage.filemanager.MainAbility",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
"homeAbility": true,
"launchType": "standard"
}
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
}
],
"mainAbility": "ohos.acts.storage.filemanager.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.storage.filemanager",
"name": ".MyApplication",
"js": [
{
"pages": [
......@@ -53,7 +77,7 @@
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
"autoDesignWidth": true
}
}
]
......
......@@ -14,12 +14,9 @@
*/
import filemanager from '@ohos.filemanager';
import {
describe,
it,
expect
}
from 'deccjsunit/index'
import {describe,it,expect,beforeAll}from 'deccjsunit/index';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
// getRoot() interface, when the parameter is "local", the returned data and the data contrast, return the same data is correct
const ROOTFILE = [
......@@ -36,8 +33,19 @@ let AUDIO_ROOT = "";
let IMAGE_ALBUM = "";
let LOG_ = "FMS_XTS_TEXT: ";
let LENGTH = 0;
let tokenID = null;
describe("filemanager_test", function () {
beforeAll(async function (){
let appInfo = await bundle.getApplicationInfo('ohos.acts.storage.filemanager', 0, 100);
tokenID = appInfo.accessTokenId;
let atManager = abilityAccessCtrl.createAtManager();
let result = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA",1);
console.log("tokenID:" + tokenID + "-result:" + result);
let result1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA");
console.log("tokenID:" + tokenID + "-result:" + result1);
});
/**
* @tc.number SUB_DF_FILEMANAGER_GET_ROOT_0000
* @tc.name filemanager_test_get_root_async_000
......@@ -172,7 +180,7 @@ describe("filemanager_test", function () {
"name":1
}
}
await filemanager.getRoot(options)
await filemanager.getRoot(options);
} catch (error) {
console.log("filemanager_test_get_root_async_004 has failed for " + error);
expect(error.message == "GetRoot func get dev para fails").assertTrue();
......@@ -194,7 +202,6 @@ describe("filemanager_test", function () {
let path = IMAGE_ROOT;
let fileInfos = await filemanager.listFile(path, "image");
expect(Array.isArray(fileInfos)).assertTrue();
console.log(JSON.stringify(fileInfos))
for (let i = 0; i < fileInfos.length; i++) {
if (fileInfos[i].name == "image") {
console.log(JSON.stringify(fileInfos[i]))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册