Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
43a69cd5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
43a69cd5
编写于
3月 15, 2022
作者:
Z
zhangxingxia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add permission for xts
Signed-off-by:
N
zhangxingxia
<
zhangxingxia1@huawei.com
>
上级
3f93c7ca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
90 addition
and
59 deletion
+90
-59
storage/storagefilemanagerjstest/signature/openharmony_sx.p7b
...age/storagefilemanagerjstest/signature/openharmony_sx.p7b
+0
-0
storage/storagefilemanagerjstest/src/main/config.json
storage/storagefilemanagerjstest/src/main/config.json
+75
-51
storage/storagefilemanagerjstest/src/main/js/default/test/filemanager.test.js
...anagerjstest/src/main/js/default/test/filemanager.test.js
+15
-8
未找到文件。
storage/storagefilemanagerjstest/signature/openharmony_sx.p7b
浏览文件 @
43a69cd5
无法预览此类型文件
storage/storagefilemanagerjstest/src/main/config.json
浏览文件 @
43a69cd5
{
"app"
:
{
"bundleName"
:
"ohos.acts.storage.filemanager"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
"compatible"
:
6
,
"target"
:
7
},
"vendor"
:
"example"
,
"bundleName"
:
"ohos.acts.storage.filemanager"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
}
},
"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"
:
[
{
"skills"
:
[
"abilities"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
"iconId"
:
16777218
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"visible"
:
true
,
"icon"
:
"$media:icon"
,
"name"
:
"ohos.acts.storage.filemanager.MainAbility"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"homeAbility"
:
true
,
"launchType"
:
"standard"
}
],
"name"
:
"ohos.acts.storage.filemanager.MainAbility"
,
"icon"
:
"$media:icon
"
,
"description"
:
"$string:mainability_description
"
,
"label"
:
"$string:app_name
"
,
"type"
:
"page"
,
"launchType"
:
"standard"
,
"visible"
:
true
}
]
,
"js"
:
[
{
"pages"
:
[
"
pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"
designWidth"
:
720
,
"
autoDesignWidth"
:
false
],
"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"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
}
}
]
}
}
\ No newline at end of file
storage/storagefilemanagerjstest/src/main/js/default/test/filemanager.test.js
浏览文件 @
43a69cd5
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录