提交 43a69cd5 编写于 作者: Z zhangxingxia

add permission for xts

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